Author: Tara Star (TaraStar on the Forums, tarastarofficial on Instagram)
Hi everyone! Me again today I’m going to go through some of the more advanced features of the Script Writer, and hopefully explain them clearly. Before reading on, I advise that you familiarise yourself with the advanced directing guide before hand, and you should at least have a knowledge of basic choices.
Labels and gotos
Before I talk about if/else systems, you need to be familiar with how to use labels and gotos. It’s a lot easier than it sounds. Essentially, a label is when you basically “name” part of the script and mark it out. Then, later on you can use a goto and this will allow you to return to the label you set up earlier, because the Script Writer then recognises that you “named” this part of the script earlier. It’s easier for me to show you what I mean. Let’s say we’re doing a choice scene.
choice
“Go to the park!”{
}”Go to the swimming pool!”{
}
That looks simple enough. But then, how would you be able to let the reader go to the scene of their choice? If it’s only a short scene, you could add the scene into the choice branch. But then, you can’t have labels and dressing games in a choice. So, you could use labels and gotos:
choice
“Go to the park!”{
goto park_play
}”Go to the swimming pool!”{
goto pool_play
}
After using the goto command, you would then underneath the choice have to have this:
label park_play
#your scene and dialogue here, however long you want the scene to be
goto end_play
label pool_play
#your scene and dialogue here, however long you want the scene to be
goto end_play
After using this code, you would then need to create a label end_play then underneath continue writing your story (this is where the two activities would merge to after the scene has been completed). It looks a bit confusing, but then if you follow the labels and gotos you should be able to make sense of what the reader will see if they select option A or option B. It’s a bit tricky to explain, but just try some experimenting!
If & else
In a different article, I’ve written about how you can let the reader choose their gender. However, for more complicated things like that, you need to be confident using if and elses. So, what are they? Well, it’s a system where you can either refer to previous choices or previous typed in choices and then depending on what the reader chose/entered you can cause different things to happen. Let’s take some examples.
Let’s say that in a story, you’re letting the reader choose a name, but you don’t want them to be able to call their character “Tara” because i.e. Tara is another pre-made character. How would you ensure they don’t enter that name, then? Well, first you would have the naming input code:
label first_name_input
input What’s Your First Name?|What’s Your First Name?|Done(NAMEF)
if (NAMEF is “”) {
AUTHOR (talk_think)
You do need a name.
goto first_name_input
} else {
continue
}
If you look at that which I’ve edited slightly from the Avatar script templates, you can see it already uses an if and else scenario to ensure that the Reader does enter a name. So now, you could just add in another line and then your code would look like this:
label first_name_input
input What’s Your First Name?|What’s Your First Name?|Done(NAMEF)
if (NAMEF is “”) {
AUTHOR (talk_think)
You do need a name.
goto first_name_input
}if (NAMEF is “Tara”) {
NARRATOR
The name Tara cannot be entered. Please choose a different name.
goto first_name_input
} else {
continue
}
Hopefully, if you follow the code you can see that if the reader entered Tara then an error message would come back and it would go back to the start of the label where they can then re-enter their name. If you want to see how to use if/elses from a non type-in choice, see my article on letting the reader choose their gender.
Gains
Okay. Let’s say you’re creating a mini game where the reader needs to find some magic dust. The easiest thing to do would be this: create a choice.
choice
“Search here!” {
goto search_here
}”Search left!”{
goto search_left
}”Search right!”{
goto search_right
}”I’ve found it!”{
goto done_search
}
The choice above, using gotos, would then require you to create three labels and then at the end of each you section you could do this:
label search_here
NARRATOR
Something happens in the mini game.
gain magic_dust
After creating these labels for each of the options, you would then have to create a final label for the “I’ve found it!” (or e.g. “Done” or “Finished”) for example:
label done_search
@YOU walks to screen center
if (magic_dust){
goto finished_search
} else {
NARRATOR
You haven’t found the item yet.
}
So, the above code would then allow the reader to go to a label called finished search (where you would continue the story) if they’ve found the item (in this case, magic dust) but if they haven’t found the item then you could use a goto and link it back to the start of the minigame.
If you haven’t come across gains before, this is probably a bit daunting to understand, so I suggest you read through this section again However, essentially gains are really useful as in a mini game they can be used in coding to show that the reader has collected something. Gains therefore can be used like in the example above so that the reader can’t continue until they’ve found something. In addition, in e.g. a mystery story you could use gain_photo and have different gains for pieces of evidence, then at the end you could use the if coding demonstrated above so that the reader only solves the mystery if they have collected e.g. two specific pieces of evidence. Alternatively though, if you were creating a mystery game and didn’t mind what the evidence was as long as the reader had found e.g. any 2 out of 5 pieces of evidence, you could then use the points system…
Points system
I won’t lie – using the points system takes a while to get the hang of. But, it can be really useful and save you so much time!
So, let’s say you’re making a minigame, where the reader has to answer 5 questions, and the pass mark is 3/5. You’re original thoughts might be to use gains – for example:
NARRATOR
What is Episode?
choice
“A TV program!”{
NARRATOR
Incorrect!
}”A place!”{
NARRATOR
Incorrect!
}”An app!”{
NARRATOR
Correct!
gain question_one
}
Then, you would use if/else to determine at the end whether the reader had scored more than 3. However, what if the reader got Q1, 4 & 5 correct? Or Q2, 3 & 4 correct? You would have to do an awful lot of coding! So, the better alternative: using points! You’d just do this for each question:
NARRATOR
What is Episode?
choice
“A TV program!”{
NARRATOR
Incorrect!
}”A place!”{
NARRATOR
Incorrect!
}”An app!”{
NARRATOR
Correct!
@YOU +1
}
Now, you may be thinking, how does this save time? How is it easier that using gains? Well, unlike if you use gains, rather than having to use a lot of if/else codes at the end of the minigame, you could instead just do:
if (YOU > 3){
NARRATOR
Well done! You passed the quiz!
}else{
NARRATOR
You didn’t pass the quiz…too bad!
}
So, hopefully this demonstrates how the points system can be really useful! If you need more help, as always feel free to contact me but there’s also some really good tips in the guides so check them out! I hope this helps you all