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: 21
Joined: Tue Dec 11, 2018 5:41 am
Contact:

displaying a variable change for user to see?

#1 Post by VorrAkkagi » 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

User avatar
Per K Grok
Miko-Class Veteran
Posts: 611
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
Projects: Defenders of Adacan Part 2
Deviantart: pekj
itch: per-k-grok
Location: Sverige
Contact:

Re: displaying a variable change for user to see?

#2 Post by Per K Grok » Sat Dec 22, 2018 9:10 am

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))
Image Visual Story Telling, DeviantArt Group for animations, comics, games and illustrations https://www.deviantart.com/acgi

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

Re: displaying a variable change for user to see?

#3 Post by VorrAkkagi » Sat Dec 22, 2018 10:21 am

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

Post Reply

Who is online

Users browsing this forum: gas, Majestic-12 [Bot]