displaying a variable change for user to see?

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
VorrAkkagi
Newbie
Posts: 22
Joined: Tue Dec 11, 2018 5:41 am
Contact:

displaying a variable change for user to see?

#1 Post by VorrAkkagi »

hey all once again,

I'm trying to figure out the best way to 'print' the results of a 'stat' increase. Using Trooper6's code example below, one can choose to increase Strength or Wisdom. I'd like a message to pop up on the screen, on screen or in the text box, either one is fine, that would say "Strength = x". In this case, 11.

In basic, (yes, I'm that old) I'd just say 'print x' or whatever. Is there some sort of option to do the same? Print Strength or Print 'Strength increased to (strength)'?

Code: Select all

default wisdom = 10
default strength = 10

label start:
    "You may increate one of your two stats."
    menu:
        "Which do you increase?"
        "Strength":
            $ strength += 1
        "Wisdom":
            $ wisdom += 1
    "Thanks. Game over."
    return

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: displaying a variable change for user to see?

#2 Post by Per K Grok »

VorrAkkagi wrote: Sat Dec 22, 2018 8:54 am hey all once again,

I'm trying to figure out the best way to 'print' the results of a 'stat' increase. Using Trooper6's code example below, one can choose to increase Strength or Wisdom. I'd like a message to pop up on the screen, on screen or in the text box, either one is fine, that would say "Strength = x". In this case, 11.

In basic, (yes, I'm that old) I'd just say 'print x' or whatever. Is there some sort of option to do the same? Print Strength or Print 'Strength increased to (strength)'?

Code: Select all

default wisdom = 10
default strength = 10

label start:
    "You may increate one of your two stats."
    menu:
        "Which do you increase?"
        "Strength":
            $ strength += 1
        "Wisdom":
            $ wisdom += 1
    "Thanks. Game over."
    return
You could use notify like this

Code: Select all

        "Strength":
            $ strength += 1
            $ renpy.notify("Strength increased to " + str(strength))

VorrAkkagi
Newbie
Posts: 22
Joined: Tue Dec 11, 2018 5:41 am
Contact:

Re: displaying a variable change for user to see?

#3 Post by VorrAkkagi »

Thank you very much!! I'll give that a try =)

Post Reply

Who is online

Users browsing this forum: No registered users