Gold display on screen problem [Solved]

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
dosa0733
Newbie
Posts: 5
Joined: Mon Sep 14, 2015 7:06 am
Contact:

Gold display on screen problem [Solved]

#1 Post by dosa0733 »

Hey all I'm trying to display gold on the screen but theirs a problem I create the gold amount first with "$ coins = 0" inside my label then I just want to add to the pile of gold "$ coins += 1" and i get an error that says gold is not defined I also have this part as my display window

Code: Select all

$ a = 0
$ b = 0
        
screen simple_example_inventory:   
    frame xalign 0.5 ypos 0.1:
        vbox:
                    $ a = "[coins]" # amount of coins 
                    $ b = "coins" # just the text coins
                    text "[b]: [a]"
Last edited by dosa0733 on Sun Nov 15, 2015 6:50 pm, edited 1 time in total.

User avatar
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

Re: Gold display on screen problem

#2 Post by Jae »

I don't get it.

Why don't you just keep the text "coins" as just "coins?" Why does it need to be a variable? Are you planning on altering the text throughout the game?

Also, why don't you just use "$ a += 1" to increase the number? Why do you need to redefine it elsewhere?

dosa0733
Newbie
Posts: 5
Joined: Mon Sep 14, 2015 7:06 am
Contact:

Re: Gold display on screen problem

#3 Post by dosa0733 »

I solved the problem whit it . As for the reason of writing like that i will add more currency types dependig on the region where the player is playing in the game

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Gold display on screen problem [Solved]

#4 Post by xela »

Code: Select all

default currency = "EUR"
default amount = 100
       
screen simple_example_inventory():   
    frame xalign 0.5 ypos 0.1:
        text "[currency]: [amount]"
You can convert on the fly when moving through labels and switching locations.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: No registered users