Converting your ChoiceScript game to Twine - Cheat sheet
Previous Twine related posts:
Switching to Twine - Sample code to get you quickly started
Twine/SugarCube ressources
Below is a transcript of the handwritten notes I took while converting Arcadie: Second-Born from ChoiceScript to Twine.
Note: I used Twine 2.4.0.0, and SugarCube 2.36.1. The notes below can only be useful if you have working knowledge of ChoiceScript, and some knowledge of both Twine and SugarCube. Terminology might be off; I'm not a programmer.
*create
You don't need to *create your variables in Twine, but it's good practice to do so, so that you don't lose track of them.
Create a StoryInit passage, and put all your variables there.
Boolean variable: <<set $var = true>> String variable: <<set $var = "Hello">> Numeric variable: <<set $var = 0>>
*comment
/* comment */
*set
You can set several variables at once:
<<set $var1 = 1, $var2 += 1, $var3 = "text">>
Below, operators in CS -> Twine equivalents:
CS->Twine + -> += - -> -= * -> *= / -> /= % -> %=
*hide_reuse
<<if not hasVisited("name of passage")>>[[Choice->NameOfPassage]]<</if>>
*if
<<if $var = true>> <</if>>
*elsif/else
<<if $var == 0>> <<set $var -= 5, $var2 = true>> Outcome1 <<elsif $var == 25>> Outcome2 <<else>> Outcome3 <</if>>
*temp
<<set _var = true>>
Will only exist for the current passage.
*rand
Generate random number
<<set $var to (random(x,y)>>
x,y = range; for example, 0 to 10
*page_break
<<button[[text|passagename]]>><</button>>
*choice
[[Choice text->PassageName]]
*Capitalize (!var)
<<print $var.toUpperFirst()>>
Inside a link: $var.toLocaleUpperCase()
or create a separate, capitalized variable
















