You'll have to be more precise in what you effectively want to do. But basically speaking:I'm new in renpy and i already searching in youtube etc, and i still confused how to increase and decrease money if i toake the money from roaming screen
$ money += 10
, and decrease it with $ money -= 10
. While from a screen, it's respectively SetVariable( "money", money + 10)
and SetVariable( "money", money - 10)
that you've to put in the
thanks i'll tryYou'll have to be more precise in what you effectively want to do. But basically speaking:
From a label you increase the money with$ money += 10
, and decrease it with$ money -= 10
. While from a screen, it's respectivelySetVariable( "money", money + 10)
andSetVariable( "money", money - 10)
that you've to put in theYou must be registered to see the linkschain of your button ; whatever if it's anYou must be registered to see the linksor aYou must be registered to see the links.
I'm new in renpy and i already searching in youtube etc, and i still confused how to increase and decrease money if i toake the money from roaming screen
can someone help me ti give the code for money system?
mymoney
and start it at zero. To create a variable, you want to use a default
statement. default
statements can go anywhere in the code, but it's standard practice to include them near (or at) the top of your code.default mymoney = 0
$
). Python has a shorthand way of adding and subtracting... +=
or -=
. $ mymoney += 50
$ mymoney -= 25
default mymoney = 0
default bought_cell_phone = False
label start:
scene black with fade
menu:
"Go to work":
"You went to work and were paid $50."
$ mymoney += 50
"Sleep in bed all day":
"You spend all day in bed."
if bought_cell_phone == True:
"Your cell phone bill was paid today. $25."
$ mymoney -= 25
"Today, I have $[mymoney]."
"*** THE END ***"
return
bought_cell_phone
to ever be True
. But it's just an example and so don't worry about it.I already create the .png image for the money
Today, I have $[mymoney]."
would show as Today, I have $50."
, for example."Today, I have {color=#33CC00}$[mymoney]{/color}."
screen
language even more.default mymoney = 0
default bought_cell_phone = False
screen money_box():
fixed:
text "${}".format(mymoney):
xalign 1.0 yalign 0.0
text_align 1.0
color "#33CC00"
label start:
scene black with fade
show screen money_box()
menu:
"Go to work":
"You went to work and were paid $50."
$ mymoney += 50
"Sleep in bed all day":
"You spend all day in bed."
if bought_cell_phone == True:
"Your cell phone bill was paid today. $25."
$ mymoney -= 25
"*** THE END ***"
return
text "${}".format(mymoney):
is required because screen code has to use python formatting instead of text tags, with {}
being replaced by the value of .format(mymoney)
, which is
thank you bro you're so kind... thanks i'll learn thatIt's a really open ended question, and honestly may mean you don't understand the basics yet.
I'd suggest reading theYou must be registered to see the links, followed byYou must be registered to see the links.
So... "money" is usually stored as a variable. Variables can be different types. In this case, you probably want an integer variable (which is just any number without any decimal places). For more information on variables, see my post here.
The other common types in RenPy games are boolean (Yes/No, True/False) and string (text).
So let's call the variablemymoney
and start it at zero. To create a variable, you want to use adefault
statement.default
statements can go anywhere in the code, but it's standard practice to include them near (or at) the top of your code.
Python:default mymoney = 0
Next... you want to alter the value of the variable. The very simplest way is to add or subtract another number from the variable. You do this by asking RenPy to run a python command (using$
). Python has a shorthand way of adding and subtracting...+=
or-=
.
So to add 50 to the variable, then subtract 25... you'd expect to see code like:
Python:$ mymoney += 50 $ mymoney -= 25
Now, you wouldn't do that in isolation. It would usually be dependant upon something else. Either a player choice or based on the value of another variable. The combination and complexity of how these variables are changed and how that is implemented within a game is just a matter of your experience and logical thinking.
So you might see something like:
Python:default mymoney = 0 default bought_cell_phone = False label start: scene black with fade menu: "Go to work": "You went to work and were paid $50." $ mymoney += 50 "Sleep in bed all day": "You spend all day in bed." if bought_cell_phone == True: "Your cell phone bill was paid today. $25." $ mymoney -= 25 "Today, I have $[mymoney]." "*** THE END ***" return
In this example, there's no way for the boolean variablebought_cell_phone
to ever beTrue
. But it's just an example and so don't worry about it.
Yeah. Well. I'm really not sure what you are getting at here.
Your 3 images seem to have the dollar sign slightly further to the left each time. So maybe 2 = 2 digit numbers, 3=3 digit numbers and 4=4 digit numbers?
Except why would anyone do it like that?
In dialogue, as I've included above, you need only put the name of a variable within square brackets to include the value in text dialogue spoken by a character or shown in a similar way.
Today, I have $[mymoney]."
would show asToday, I have $50."
, for example.
If you want things to be green (as the images are), you need only addYou must be registered to see the linkstags (or maybe evenYou must be registered to see the linkstags).
"Today, I have {color=#33CC00}$[mymoney]{/color}."
However, this "feels" like something you want to show on screen. Perhaps permanently on screen on some sort of gui toolbar. And for that, you are going to needYou must be registered to see the links.
Now, screen language is relatively straight forward - but not easy to get to grips with. If you are already struggling with variables, you are going to struggle withscreen
language even more.
But let's answer your question and expand our example to include a screen which shows the amount of money the player has in the top right corner of the screen all the time.
Python:default mymoney = 0 default bought_cell_phone = False screen money_box(): fixed: text "${}".format(mymoney): xalign 1.0 yalign 0.0 text_align 1.0 color "#33CC00" label start: scene black with fade show screen money_box() menu: "Go to work": "You went to work and were paid $50." $ mymoney += 50 "Sleep in bed all day": "You spend all day in bed." if bought_cell_phone == True: "Your cell phone bill was paid today. $25." $ mymoney -= 25 "*** THE END ***" return
Obviously, there's a lot going on there and lots of new stuff and concepts. But you don't need an image of a dollar sign to put a dollar sign in the right place. The rest of it... alignments are a sliding scale of 0.0 (left/top) to 1.0 (right/bottom), with 0.5 being the center. color should be self explanatory. Thetext "${}".format(mymoney):
is required because screen code has to use python formatting instead of text tags, with{}
being replaced by the value of.format(mymoney)
, which isYou must be registered to see the links.
you're so good with renpy dude, can I send you a DM when I need help with coding and stuff?It's a really open ended question, and honestly may mean you don't understand the basics yet.
I'd suggest reading theYou must be registered to see the links, followed byYou must be registered to see the links.
So... "money" is usually stored as a variable. Variables can be different types. In this case, you probably want an integer variable (which is just any number without any decimal places). For more information on variables, see my post here.
The other common types in RenPy games are boolean (Yes/No, True/False) and string (text).
So let's call the variablemymoney
and start it at zero. To create a variable, you want to use adefault
statement.default
statements can go anywhere in the code, but it's standard practice to include them near (or at) the top of your code.
Python:default mymoney = 0
Next... you want to alter the value of the variable. The very simplest way is to add or subtract another number from the variable. You do this by asking RenPy to run a python command (using$
). Python has a shorthand way of adding and subtracting...+=
or-=
.
So to add 50 to the variable, then subtract 25... you'd expect to see code like:
Python:$ mymoney += 50 $ mymoney -= 25
Now, you wouldn't do that in isolation. It would usually be dependant upon something else. Either a player choice or based on the value of another variable. The combination and complexity of how these variables are changed and how that is implemented within a game is just a matter of your experience and logical thinking.
So you might see something like:
Python:default mymoney = 0 default bought_cell_phone = False label start: scene black with fade menu: "Go to work": "You went to work and were paid $50." $ mymoney += 50 "Sleep in bed all day": "You spend all day in bed." if bought_cell_phone == True: "Your cell phone bill was paid today. $25." $ mymoney -= 25 "Today, I have $[mymoney]." "*** THE END ***" return
In this example, there's no way for the boolean variablebought_cell_phone
to ever beTrue
. But it's just an example and so don't worry about it.
Yeah. Well. I'm really not sure what you are getting at here.
Your 3 images seem to have the dollar sign slightly further to the left each time. So maybe 2 = 2 digit numbers, 3=3 digit numbers and 4=4 digit numbers?
Except why would anyone do it like that?
In dialogue, as I've included above, you need only put the name of a variable within square brackets to include the value in text dialogue spoken by a character or shown in a similar way.
Today, I have $[mymoney]."
would show asToday, I have $50."
, for example.
If you want things to be green (as the images are), you need only addYou must be registered to see the linkstags (or maybe evenYou must be registered to see the linkstags).
"Today, I have {color=#33CC00}$[mymoney]{/color}."
However, this "feels" like something you want to show on screen. Perhaps permanently on screen on some sort of gui toolbar. And for that, you are going to needYou must be registered to see the links.
Now, screen language is relatively straight forward - but not easy to get to grips with. If you are already struggling with variables, you are going to struggle withscreen
language even more.
But let's answer your question and expand our example to include a screen which shows the amount of money the player has in the top right corner of the screen all the time.
Python:default mymoney = 0 default bought_cell_phone = False screen money_box(): fixed: text "${}".format(mymoney): xalign 1.0 yalign 0.0 text_align 1.0 color "#33CC00" label start: scene black with fade show screen money_box() menu: "Go to work": "You went to work and were paid $50." $ mymoney += 50 "Sleep in bed all day": "You spend all day in bed." if bought_cell_phone == True: "Your cell phone bill was paid today. $25." $ mymoney -= 25 "*** THE END ***" return
Obviously, there's a lot going on there and lots of new stuff and concepts. But you don't need an image of a dollar sign to put a dollar sign in the right place. The rest of it... alignments are a sliding scale of 0.0 (left/top) to 1.0 (right/bottom), with 0.5 being the center. color should be self explanatory. Thetext "${}".format(mymoney):
is required because screen code has to use python formatting instead of text tags, with{}
being replaced by the value of.format(mymoney)
, which isYou must be registered to see the links.
Not to be harsh, or minimize 79flavors knowledge, but honestly what he said is the basis. Therefore if you think he's "so good with renpy" (what he is, but isn't shown this time), you should really start by taking the time to patiently and carefully read the documentation he pointed to.you're so good with renpy dude, can I send you a DM when I need help with coding and stuff?
Yes and I'm trying to understand this and the basis and try with experiment project before apply to the real project.Not to be harsh, or minimize 79flavors knowledge, but honestly what he said is the basis. Therefore if you think he's "so good with renpy" (what he is, but isn't shown this time), you should really start by taking the time to patiently and carefully read the documentation he pointed to.
You'll not go far without this mandatory initial step, this whatever how much help you could get.
Of course, you can start a thread here and ask for help. You would get an answer, perhaps even a working script. But what's important is to understand this answer/script, in order to effectively adapt it to you unique case and, more important, be able to fix the errors that will come from this adaptation.
You aren't alone on your journey, but you are alone face to your game. Therefore the very first step should be to reach independence in regard of the basic tasks. And this can only be achieved through the reading of the documentation and some personal experimentation.
[...] can I send you a DM when I need help with coding and stuff?
okay no problem dude thanks for your helpI'd rather not do 1-to-1 support, if I'm honest. I'm not always available or in the mood to answer.
Public messages mean anyone from the community can reply.
My suggestion is to start smaller. Try a small kinetic novel first (no decisions, no variables). Either write or find a short story and re-recreate it in RenPy for 20-30 minutes of gameplay. It'll teach you the basics and give you a feel for the effort required for creating the images too.