Variables and desicions

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
jax63
Newbie
Posts: 2
Joined: Fri Feb 16, 2018 2:41 pm
Tumblr: jax63-polyporn
Deviantart: jax63
Contact:

Variables and desicions

#1 Post by jax63 »

Hello!

I#m new here, and with ren'py.

So i know how to make questions in ren'py. But i would want to know something more.

for example i make a question, and if the player decides for yes or know, two diffrent roots for the next possible event can happen, when either of this event is finished the story follows the same route.

So what i want to do is this.
a long time after the decision i want to have it some influnce what kind of event habens.

Can i give if you chose yes an variable event01=1 and with an no event01=0

And can i make a decision like
menu:
"Yes, I do.":
jump choice1_yes
"No, I don't.":
jump choice1_no
label choice1_yes:
event01=1
$ menu_flag = True
story
jump choice1_done
label choice1_no:
event01=0
$ menu_flag = False
story
jump choice1_done

label choice1_done:
# ... the game continues here.
story
story
story



if event=1

then
Story
Story
Story
jump goal

else
story
story
story
jump goal

label goal

Can you help me please with the coding?

and sorry for my bad english

User avatar
Andredron
Miko-Class Veteran
Posts: 718
Joined: Thu Dec 28, 2017 2:37 pm
Location: Russia
Contact:

Re: Variables and desicions

#2 Post by Andredron »

special for preschool children who do not know about Google:
1) variable-an empty plate, in which you can put the cutlets, you can call it and say that it is empty, it zero cutlets:

Code: Select all

$ kotletki = 0
2) the operator of assignment (sign"=") - we put the right amount of cutlets in a bowl, for example, just 2 pieces:

Code: Select all

$ kotletki = 2
3) operator increment (variable increase, the sign"+") - add to the plate the desired number of cutlets. for example, to two in a plate add another:

Code: Select all

$ kotletki = kotletki + 1
# total their in plate now 3!
4) decrement (subtraction), read the previous paragraph. eat one cutlet:

Code: Select all

$ kotletki = kotletki-1
5) condition - can be true or incorrect -

Code: Select all

"1==2"
- because 1 is not equal to 2, the result will be a lie.

Code: Select all

 "1 == 1"
- because 1 is 1, the result is true. if you have your plate 2 cakes, and you'll tell the teacher that ate everything, you lie.

Code: Select all

"2 == 0"
is a lie.

Code: Select all

 "kotletki == 0" 
is a lie, because we have two cutlets left after eating one of the three. comparison operators are different, not only "equal" -

Code: Select all

"=="
, but also "unequal" -

Code: Select all

"!="
, more, less, etc.
6) conditional statement - if is our educator who checks if you tell him the truth or lie. and accordingly reacts on your statements.
else: otherwise. the block after this statement is executed if the statement in the if statement is false. for kindergarten will be difficult. let me explain by example.
if you came to the teacher with an empty plate and said that it was empty (if really kotletki == 0), then you told the truth, all ate and generally well done! you can go play.
if you said that you ate "skazal == 0", and the cutlet is greater than 0 (kotletki > 0), i.e. you did not eat everything, then you have to put in a corner for lying, then the block" else: "(otherwise) works.
example:

Code: Select all

if kotletki == 0:
....jump igrushki
else:
....jump ugol
7) the choice whether to eat burgers

Code: Select all

$ kotletki = 1
# one left
menu:
...."no, not go":
........pass # do nothing, skip the selection unit
...."okay, finish and last":
........$ kotletki = kotletki-1
8) choosing what to say to the teacher after lunch

Code: Select all

menu:
...."I ate it all!":
........$ skazal = 0
........pass
...."One chicken left. Never at a loss already":
........$ skazal = 1
9) and now programmable reaction of a caregiver

Code: Select all

# if I said that everyone ate, we move on to the block where 0 is discussed cutlets
if skazal == 0:
....jump label 0
# otherwise, if there was no transition, the program will continue to run further
#f next we discuss 1 cutlet
if kotletki > 0:
...."boy, that is not lying. but the meatballs need to finish"
....jump start # starts all over again (instead of one of the endings)
else:
...."but you ate all the cutlets. why lie? boy, you moron? go to the doctor, check it out."
....jump doctor
# and here we discuss zero cutlets
label label0:
if kotletki == 0:
...."said he ate, really ate. muzhik! go ahead and play.":
....jump igrushki
else:
...."you said I ate, and then there are burgers! into a corner!"
....jump ugol
10) forks and variables, you can do all you want, and checks too. in short, sculpt so many endings, how many leftist heel pleases.
if after this you do not understand the basics of programming, then I highly recommend you go to the neighbor

Image

User avatar
jax63
Newbie
Posts: 2
Joined: Fri Feb 16, 2018 2:41 pm
Tumblr: jax63-polyporn
Deviantart: jax63
Contact:

Re: Variables and desicions

#3 Post by jax63 »

Thank you.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]