Let's say I want to declare & use a variable only within a function, how would I do that?
Code: Select all
label genericFunction:
declare variableOnlyUsedInThisFunction = "hello world"
text variableOnlyUsedInThisFunction
Code: Select all
label genericFunction:
declare variableOnlyUsedInThisFunction = "hello world"
text variableOnlyUsedInThisFunction
Code: Select all
default color = “red”
label start:
“Today my shirt is [red]”
Why is using $ everywhere bad though?trooper6 wrote: ↑Mon Nov 05, 2018 11:20 am Yes it is bad.
Variables should be declared outside of any label using default if that variable will change (the most common situation) or define if the variable will not change.
Code: Select all
default color = “red” label start: “Today my shirt is [red]”
What do you mean by "use a variable only within a function"?
Code: Select all
default shirt_color = "red"
label start:
"My shirt is [shirt_color], but I want to change it."
menu:
"What should I change the color to?"
"Blue!":
$shirt_color = "blue"
"Green!":
$shirt_color = "green"
"My shirt is now [shirt_color]"
Code: Select all
default shirt_color = "red"
label start:
"My shirt is [shirt_color], but I want to change it."
menu:
"What should I change the color to?"
"Blue!":
python:
shirt_color = "blue"
"Green!":
python:
shirt_color = "green"
"My shirt is now [shirt_color]"
Code: Select all
label testA:
$ stats_test1 = 55
Users browsing this forum: Amazon [Bot]