I have a few questions about choicescript


#1

Hello, I created this account to ask a few questions about choicescript.

My first question is: Do variables transfer from the initial file onto the other ones? Their stats and what not.

My second is: Is it possible to have *if and *else outside of a *choice?
For example:
*label uno
*if (respect = 10)
You’re respected!
*else
You aren’t respected!

I can clarify more if that didn’t make sense.
My final question is can you display a variable inside a variable?
For example:
If I set fire “the fire is ${temp}” would that work?

If that isn’t very clear, I can elaborate more. Thanks everyone!


#2

Once you set your stats up in startup they work throughout the whole game unless you’re using temps.

You can use *if as you asked.


#3

First question: Yes, the commands from the startup will be “transfered” to the other files.

Second question: Yes, you could use something like this:

*label uno
*if (respect > 9)
 You're respected!
*if (respect < 10)
 You aren't respected!

*Important Note: it is a basic requirement of ChoiceScript’s logic that any use of *elseif or *else commands in combination with *if must always end with either a *finish, *goto_scene, *goto, *goto_random_scene, *ending or gotoref command or it will generate an error, that is why I usually go with more than one if.

Third question: Yes, it would work.

Edit: lol, 3 replies in < 1m


#4

Yes, variables carry throughout the gamestory unless they are *temp variables.

Yes, that works and your code there is perfectly fine (as long as it is indented correctly).

*label uno
*if (respect = 10)
    You're respected!
*else
    You aren't respected!

Yes, as long as you had a variable named temp that would work.

Looks like you’re on the right track and learning fast! :grinning:

EDIT: Looks like I was beat by other members, which is awesome. That’s part of what makes this forum so great, most everyone is very helpful!


#5

Alright, thank you everyone! I appreciate it very much.