If I have an accumulating score, can rollback cheat it?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

If I have an accumulating score, can rollback cheat it?

#1 Post by SuperbowserX »

I am making a game that accumulates points for the user based on the (in)correctness of their decision.

Suppose a user is presented with a choice. One choice is good and will boost a variable by 5 for 5 points; the other is bad and will not. The variable is currently 0. If a user makes a good choice, and gains 5 points...

But, for whatever reason, rolls back to right before the choice -- will the score of that variable now be 0?

Basically, when you rollback, are you also undoing any changes in any variablse in-between the statement from which you are rolling back and the statement you roll back to?

Example:

Code: Select all

define score = 0

menu:
    "What do you do?"

    "Correct choice.":
        score+=5
        "You made this choice."

    "Incorrect choice.":
        "You made this choice."
Suppose the user makes the correct choice. The value of score is now 5. Suppose they then rollback to "What do you do?"

At this point, once they've rolledback, will the value of score be 0 or 5?

And on a second point: is it possible to disable roll back? I am making a game with infinite continues and trying to make extended game over what-if cutscenes so I'm thinking about it. How can you disable it?

One other quick thing I just remembered. Is there a command that can distort or partially darken a currently-showing image (i.e. to be used when you are keeping a character's icon on the screen but they are not speaking at that moment)? A command that can first darken a showing image, and then a command that undoes that and shows the normal image??

Flair
Newbie
Posts: 10
Joined: Fri Dec 11, 2015 11:05 pm
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#2 Post by Flair »

Based on your code, if the user rollbacks to before the choice is made, the score variable should revert to 0.
If you are unsure, you can always output the score variable using "[score]" or $renpy.notify(str(score)) for debugging purpose.

And yes, it's possible to disable rollback entirely or after a certain point in the game. Read more about it here: https://www.renpy.org/doc/html/save_loa ... k#rollback

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#3 Post by SuperbowserX »

Thank you! :)

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#4 Post by SuperbowserX »

Also, how can I remove the "back" command from the user's HUD?

Flair
Newbie
Posts: 10
Joined: Fri Dec 11, 2015 11:05 pm
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#5 Post by Flair »

Open the screens.rpy in your game folder. It should contain the code for the whole default gui. Just look for the one you wanted to edit. (If memory serves right it should be a textbutton labelled "back" in a screen called quickmenu)

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#6 Post by SuperbowserX »

Thanks. Anyway I can do the same for the mousewheel and other ways of triggering rollback altogether? I want it to be impossible to correct a decision for my game because of the kind of game I am writing.

Placing "$ renpy.block_rollback()" after my label start isn't working. Page Up/Dn, and the mousewheel, are all still capable of working.

Flair
Newbie
Posts: 10
Joined: Fri Dec 11, 2015 11:05 pm
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#7 Post by Flair »

block_rollback is for blocking rollback at certain point. to disable it entirely, use config.rollback_enabled = False
(It's written there in the documentation, you probably missed it :)
place it in init or within options.rpy along with other configuration variables..

Then again, you might want to consider putting block_rollback after every "decision" instead, so players who missed some part of the stort prior to a decision-making part may reread them. But it's just a suggestion.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#8 Post by xavimat »

Blocking rollback entirely is very user-unfriendly.
I think you could use "Fixed rollback", as explained in the doc:
Fixing Rollback
Fixing rollback provides for an intermediate choice between unconstrained rollback and blocking rollback entirely. Rollback is allowed, but the user is not allowed to make changes to their decisions. Fixing rollback is done with the renpy.fix_rollback() function, as shown in the following example:
https://www.renpy.org/doc/html/save_loa ... g-rollback
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Apa
Regular
Posts: 103
Joined: Fri Dec 23, 2016 2:26 am
Location: NYC
Contact:

Re: If I have an accumulating score, can rollback cheat it?

#9 Post by Apa »

xavimat wrote:Blocking rollback entirely is very user-unfriendly.
I think you could use "Fixed rollback"...
And "Fixed rollback" cruel... :cry:

Post Reply

Who is online

Users browsing this forum: No registered users