2017年2月10日星期五

Script Guide_3 make choice and jump to label

 Interactive novels alway have some branch of story, the script [goto] and [ask] can make this.

[goto] - jump to some other part


The script [goto] goes with one parameter, the label in current scenario file. Do nothing If cannot find the label. Jump to the line where the label was find, and Read the next line of script automatically.

[goto Labelname]
Labelname: the name a label in current scenario file.  The labels can be defined with the script [label].
You can use variables in Labelname.


[label]

The script [label] goes with one parameter, the name of this label. Read the next line of script automatically.
To ensure your game runs correctly, Each label should have its own name.

[label Labelname]
Labelname: The name this label in current scenario file. 
You cannot use variables here.

Example: jump to another section with goto and label


[goto Sec2]
[label Sec1]
[dialog Bunny| I like clover.]
[label Sec2]
[dialog Bunny| I like cabbage.]
you can also use in this example[eval somevariable= Sec2][goto @somevariable ]



[ask] - in game menu 


The script [ask] goes with 5 parameters, some text the players was asked,the position on of selection button, the label or some inscript and the gackground imagine of this button. Read the next line of script automatically till it comes to an [waitclick],[dialog],[text] or [askdialog] .
The game will stop when comes to a script [ask], the player should click one button to continue the game.
You can use a swf animation as the background imagine, but the action script will not work on IOS device.

[ask Text|posX|posY| Labelname|Filename]
Text: Some words the player was asked. (align center)
posX: the position where the imagine display horizontal.
posY: the position where the imagine display vertical .
Labelname: The name this label in current scenario file. You can use variables here. You can use a inscript as a label.
Filename: The filename of the imagine, all the file can be found in the ui directory.

Example: make some choice

[ask cabbige|300|100|labelA|imgask3.png]
[ask carrot|300|200|labelB|imgask3.png]
[ask nothing|300|300|labelC|imgask3.png]
[dialog bunny| what should I eat for breakfast?]

[label labelA]
[dialog Bunny| I like cabbage!]
[label labelB]
[dialog Bunny| Nahhhhh!]
[label labelC]
[dialog Bunny| all right.]


In this example, player should choose one of these selection to make the game continue.

[btn] - buttons in game 

Same as the script [ask], Read the next line of script automatically , but will not stop the game. You can use  [waitclick],[dialog] and [text] after a [btn]. The buttons will keep on the screen until the play click one of them.
When the player click a button All [btn] will be removed. Use a [removebtn] when you want to clean them up.

[btn Text|posX|posY| Labelname|Filename]

Example: make a button

[label labelA]
[btn STOP!!|300|70|labelB|imgask3.png]
[dialog bunny| what should I eat for breakfast?]
[dialog bunny| I like cabbage but I eat them last night]
[dialog bunny| I don't have any carrot. ]
[removebtn]
[dialog bunny| but I am hungry.]
[goto labelA]
[label labelC]
[dialog Bunny| I decide to have some cabbage!]

In this example, the bunny will ask itself again at [goto labelA], break the loop by clicking the button.

标签:

0 条评论:

发表评论

订阅 博文评论 [Atom]

<< 主页