Announcement

Collapse

IMPORTANT TWR ANNOUNCEMENT

**~~ANNOUNCEMENT!~~** All The Writers' Room members please check the TWR forums for an important new thread! Your feedback is wanted for this exciting announcement & thanks for being part of the team! - JB
See more
See less

Ifs, elses, gains, labels, gotos and the points system

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ifs, elses, gains, labels, gotos and the points system



    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 😊
    Last edited by TaraStar_314; 06-24-2017, 05:44 AM.

  • #2
    This post was really helpful and I finally understand the points system! Thank you for taking your time to teach others!

    Comment


    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      No problem - I know that these particular features like the points system are hard to get your head around, hence I thought I'd try and explain how to use them! I'm glad this was useful for you, and don't forget, these are just a few examples of the advanced coding things you can create! Have fun experimenting and adapting the coding for your own story - and feel free to contact me if you need any help :-)

  • #3
    Hey TaraStar_314 , seems like your section on gains got cut off! Might need to edit that Other than that, this is so helpful!!

    Comment


    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      Hi there :-) thanks for letting me know, I've just updated the gains bit (I was writing this half asleep on holiday!) and I'm also happy that you're finding this helpful. Feel free to contact me should you need more help with anything!

  • #4
    Hi I am struggling with my story because of labels. I am trying to do outfit choices but apparently, dressinggame_1 does not exist as a label. If anyone has any suggestions I would really appreciate it. Thank you.

    Comment


    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      Hi there :-) so I would recommend going on to the Script writer, and clicking "Script templates" then insert the dressing game script template. Assign it to the character who's outfit you want the reader to choose, then go through the coding and look for the pink lines of code. These pink lines that say e.g. outfit_one you need to replace with the names of your outfits, and if you need to you can edit the name of the outfit that appears on the screen by changing the coded text in speech marks e.g. "Comfortable" to e.g. "Option One." Then, you need to test the dressing game and check it works.

      The error that the label doesn't exist might be because you've misspelt it or referred to it incorrectly. What you need to do is check at the start of the dressing game you've written "label dressinggame_1" (but not with the speech marks!) then after the outfit choice where you've given the option for the reader to try on a different outfit make sure you've written "goto dressinggame_1" (again without the speech marks!). Hopefully this should fix it, if not check out Joseph Evans' tutorials or feel free to contact me :-)

    • Cupcake Lover
      Cupcake Lover commented
      Editing a comment
      TaraStar_314 Thank you so much! This really helped. :-)

    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      No problem, glad I could help :-)

  • #5
    Thanks for this! It was very helpful.

    Comment


    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      Glad to hear it! Let me know if you need help with any coding in the future :-)

  • #6
    Thanks this was very helpful! Is there a way to create different "meters" in a manner of speaking...so for example....

    My MC could gain points for different types of things....Love Meter, Charisma Meter, Luck Meter....within one story.? Hopefully this makes sense. It's similar to the game-books where you gain stats as you go in different things and different parts of the story/game change based on those different areas.

    Comment


    • AdventureGirl
      AdventureGirl commented
      Editing a comment
      Hey Dara...I thought of something else...

      Is there a way for us to check points? Like I know you can't put a meter supposedly...but is there a way to occasionally pop in with these are your points or something like that?

      Thanks as always!
      D

    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      Hi there! As far as I know, I'm afraid there's no way to create different meters. The only solution would possible be to use gains, but that would no doubt get rather complicated! As for checking points, the only way to do this is the long winded way, where you have to use if and elses (I wouldn't recommend doing this, though, as it would take a while!). Sorry I couldn't be more helpful :-)

    • AdventureGirl
      AdventureGirl commented
      Editing a comment
      Thanks! Yeah that's what I thought too. It would be nice if they could offer us an alternative!

  • #7
    For the points system, if you're adding a point in the same line as a character speaking, for me
    it only works if the point goes between the name and the animation. EX:

    CHARACTER +1 (animation)
    I gained a point.

    Comment


    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      That's interesting - I've never tried that. There's nothing in detail on the guides - they just say to use

      CHARACTER +1
      Hi there

      So your coding is probably accurate if you want your character to be animated whilst talking (which makes sense, really!)

  • #8
    What if you want to make a personality quiz? (Point system.)

    Comment


    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      Ah! So, if we take the example that there are two possible personalities or characters you could be like, then what I would do is make one character who would stand in a zone where you couldn't see them. E.g.

      INT. BLACK - DAY
      @YOU stands screen center in zone 1 AND BRAVE stands screen right in zone 3

      In that example, the two final outcomes would be brave or shy (those would be the possible personalities). Then, do normal choices and depending on the answer add a point or subtract a point. E.g.

      NARRATOR
      What would you do on a day off?

      choice
      "Skydive!"{
      @BRAVE +1

      }"Stay at home..."{
      @BRAVE -1

      }


      Then finally, if you have e.g. 5 questions in total then you can use if and else so that if brave > 3 or if brave = 3 then the reader would have the brave personality, else they would have the shy personality. You could then develop this if you wanted to have e.g. 3 possible outcomes instead of 2, but then you always need to think about if the reader is a bit like all of them and if e.g. for 3 questions each time they were like a different personality then who would you say they are most like? Coding could quickly become tricky...!

    • Aloha Dee
      Aloha Dee commented
      Editing a comment
      Thanks.

    • TaraStar_314
      TaraStar_314 commented
      Editing a comment
      No problem! Glad I could help :-)
Working...
X