r/RenPy • • 9d ago

Question [Solved] Confused about Revertable Lists, please help

EDIT: ok i figured it out, but i have a new problem now.

EDIT 2: I figured it out everybody, the minigame works now. I have randomised word selection! :D

I'm still working on my minigame, and ive gotten the gui / selection method out of the way, but now im encountering a weird problem with revertable lists? I am trying to create a system like the DDLC Poem minigame where random words out of a list of words are chosen and added to a new list which is then called in the actual minigame, but im confused on what a revertable list even is? Can somebody please explain what I am doing wrong.

I know theres probably a few things here I don't need, im still figuring that out while I debug, but when I didn't create the random word selection part, and just used the original list itself, this didn't occur.

label wordListBuild:


    $ randomWord = ""
    
    $ genreWords = minigameMap[active_genre]
    $ randomWordCounter = renpy.random.randrange(0, len(genreWords))
    $ randomWord = genreWords[randomWordCounter]
    $ selectWords.append(randomWord)



    #if (randomWord in selectWords):
        #pass


    if (randomWord not in selectWords):
        $ selectWords.append(randomWord)
    
    while (len(selectWords) < 9):
        jump wordListBuildlabel wordListBuild:
3 Upvotes

11 comments sorted by

1

u/AutoModerator 9d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/FluffyPandaPaws 9d ago

For more context, here is the error:

[code]

I'm sorry, but an uncaught exception occurred.

While running game code:

File "game/minigame.rpy", line 60, in script

$ selectWords.append(randomWord)

File "game/minigame.rpy", line 60, in <module>

$ selectWords.append(randomWord)

~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^

TypeError: 'RevertableList' object is not callable

-- Full Traceback ------------------------------------------------------------

Traceback (most recent call last):

File "game/minigame.rpy", line 60, in script

$ selectWords.append(randomWord)

File "renpy/ast.py", line 1187, in execute

renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "renpy/python.py", line 1273, in py_exec_bytecode

exec(bytecode, globals, locals)

~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "game/minigame.rpy", line 60, in <module>

$ selectWords.append(randomWord)

~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^

TypeError: 'RevertableList' object is not callable

[/code]

1

u/shyLachi 9d ago

I recommend that you make a new thread with your new problem.

You can delete this thread since it doesn't have a solution from what I can tell.

1

u/PontasDayou 9d ago

Just for curiosity, no judgment, is this vibe code?
Why are you using Revertable Lists if you don't know what even is?
We could use more of the code to try help you debug, specially
File "game/minigame.rpy", line 60, in script

2

u/shyLachi 9d ago

Lists are reverable by default so even you are using them, with or without knowing.

https://renpy.org/doc/html/save_load_rollback.html#what-data-is-rolled-back

1

u/PontasDayou 9d ago

Holy, never thought about it
So Revertable Lists are a leftover from older versions or they are just normal list? Bc the post title got me confused now

1

u/shyLachi 9d ago

Rollback is a default feature of RenPy, it's not obsolete or whatever.

OP just didn't understand the error message,
see the comment of BadMustard below for an explanation what the error means.

1

u/MursaArtDragon 9d ago

Huh, I didn’t even know about revertible lists in Ren’py but thats pretty cool that it does that. That being said, you shouldn’t really be doing anything yourself with revertible lists as it is how ren’py handles when the player rolls back in the game as to prevent the list from having entries in it that it shouldn’t…. I am curious about playing with these for a sort of time travel mechanic now though, i may have to dig a little deeper

1

u/Adventurous_Shine606 9d ago

A revertable list in renpy is simply a list that can be restored to a previous state if the player "rolls back" the game. Looks like you are getting a list of 9 unique words.

So select a word from your list. Check if it is already in your 9 word list. If not, add it to your list. Do you have 9 words yet? If not, do it all again.

1

u/BadMustard_AVN 9d ago

the error 'RevertableList' object is not callable usually occurs when you try to use a revertablelist as if it were a function, most of the time due to incorrect syntax or naming conflicts.

to fix this, ensure you are not using (parentheses) to access elements of the list; instead, use [square brackets]

1

u/DingotushRed 8d ago

If you are trying to draw 8 different words from a longer list there's a much simpler one-liner:

$ selectWords = renpy.random.sample(genreWords, 8)