So I’m a beginner when its come to coding I recently learned basics thanks to (Wiki and many many other tutorials, So the hard work, is very much appreciated)and decided to code the story I’ve been working on.
However, I’m having trouble with some coding that I didn’t understand even with tutorials, I really tried though.
The thing is, for example, let’s say I put choices (1),(2) and (3) in scene1 for the next scene [let’s call it scene2] I want to have different reactions to each choice at the beginning of scene2, however, the rest of scene2 is the same for all choices. I want to know how to code that.
Maybe something like that?
*set first_choice 1
*set first_choice 2
*set first_choice 3
*if first_choice = 1
*elseif first_choice = 2
something else happens.
another thing happens
here all the three come together.
Doesn’t this put “the reaction to the choice text” and the rest of the scene in two different pages?. I want them on one page
Oh no!I mean yes.Its worked just fine.Thank you💜
The program reads and display all the text jumping through *goto until it encounters a *page_break, *choice, *ending, *finish, *input_text command, and I think I’m not forgetting any of them .
You can easily test that with any of the programs available.
I didn’t know that then, let’s say this time the beginning of the page is a reaction to the choice, the middle is the same for all choices for all choice and at the end of the page is also a reaction to the choices. Which means the beginning and the end change only the middle text is stable, can that be coded?
Each time you want to differentiate a choice from another you have to note that difference in a variable, like on the example I gave I used *set first_choice # (# ←here you put something different for each choice, choice 1 = 1, 2 = 2, or a string, choice 1 = hard, choice 2 = soft, or whatever you want)
Then, each time you want to “react” different to that you ask the program to do something different → IF the variable is 1, 2 or hard, soft, or whatever.
You can ask IF inside another if, or inside a choice.
*if variable = 1
*if another_variable = 3
The guides are full of examples and explanations. I encourage you to get an example of the code and start to modify it yourself to see what does what and how things work or don’t.
I think I didn’t get the IF inside if point, and I am experimenting with the Code like you said it’s the best way to learn truly. I only asked when I really didn’t have any other choice😅
Just chiming in to say that you can also use *fake_choice! So the code would look a bit like this:
"So, what do you want to eat?" The generic waitress asks.
She grins. "Great choice! I love the pie. Coming right up."
She shrugs. "Sure thing. Kinda plain, but whatever."
#The duck entrail soup.
She makes a disgusted face. "... okay."
She disappears, and returns a moment later with your food. "Enjoy!"
It should save you the need of writing a lot of *goto and *ifs! The variables can still be set, however, in case you’d like to recall them for later choices.
I’m writing this on mobile, so the formatting might not be perfect… but give it a whirl!
Edit: just wanted to add that *fake_choices don’t neccessarily have to mean that the choices that don’t matter! You can set stats and variables with *fake_choice–as long as the scene leads to the same place, I think it’s potentially a much “cleaner” way to code, and is a great tool to use!
Whats the difference?,surely there’s or why would not everyone use it since its so much easier.just curious
That’s also something I’ve been wondering for a good time.
Well, it’s kind of in the name. *fake_choice functions as a way to continue the story in a single direction with or without flavor text. Meanwhile, *choice, since it can’t function without a *goto (assuming you don’t have implicit control turned on), seems to be intended only for branching. At least, those are their theoretical uses. In practice, ChoiceScript is flexible enough that if you really wanted to, you could just use *choice and *fake_choice completely interchangeably, you just wouldn’t want to.
And then there’s implicit_control which literally just makes *fake_choice entirely unnecessary by making *choice behave exactly like *fake_choice, but I digress.
No,that was educational and the information was useful So thank you.I guess I got the hung of it,maybe…
This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.