2017年2月14日星期二

Script Guide_8 In-game-script

define a block of scripts often used

you can write some script and use them as a macro. The script blocks should be write in script.txt in scenario directory. You can remove the file if you do not want to use this.

[iscript] - defined an in game script

Goes with the name of the script. you can use a [script scriptname] to call this block in other scenario files.
An in game script starts with [iscript] and ends with [endiscript].

[iscript ScriptName]
ScriptName: the name of the script block
[endiscript ScriptName]

write some script and use them as a macro. The script blocks should be write in script.txt in scenario directory. You can remove the file if you do not want to use this.

[script] - use an in game script

This script goes with the name of the script , use this to call a script block in script.txt.
At the end of the script block, the game goes back to the last scenario file and read the next line of script automatically.

[script ScriptName]
ScriptName: the name of the script block which is defined in script.txt

An in game script is also supported in [btn] and [ask] as a labelname.
[btn ,100,100,script:ScriptName,readnote.png]

Example: use an in game script

 in script.txt
[iscript nameA]
[dialog bunny, I am in an in-game-script]
[dialog bunny, I can talk and show some pictures]
[dialog bunny, use a return to go back to your scenario]
[endiscript nameA]

[iscript nameB]
[dialog bunny, I am in script nameB]
[if @V <2]
[dialog bunny, I will go back]
[return]
[end if]
[if @V <2]
[dialog bunny, I will go back]
[goto labelA]
[end if]
[endiscript nameB]


in another scenario file
[label labelA]
[dialog human, I will use an in-game-script]
[script somename]
[dialog human, now I am back]

[ask try in-game-script|300|100|script:nameB|imgask3.png]
[waitclick]
[dialog human, now I am back]


In this example, the human talked and the bunny talk. After the [endiscript], it go back to the human again. then it shows how to use in-game-script in buttons.

Scripts supported in an in-game-script


➽the following are scripts same as in a scenario file

[showtip]
[showcg] [getcg]
[text] [dialog] [dialogadd]
[img] [background]
[clearimg]
[clr] [msghide] [msgshow]
[if] [end] [eval]
[sound] [bgm] [bgmstop]
[setdurtime]
[waitclick]
[initsavefile]
[load]
[call]

➽the following are scripts able to use but have some difference with that in a scenario file
[goto]
go to a label in the scenario file. You cannot jump to a label in in-game-script while the script [label] is unusable.
[return]
jump out of the in-game-script and go back to the last scenario file and read the next line.

➽there some script which is not supported in in-game-script
[ask] [btn] [askdialog] [removebtn]
buttons are not supported
[label] [save]
no labels and you cannot save in an in-game-script
[wait]
you cannot wait but you can still use the parameter Time in [img].
[enablesave] [disablesave]






Now it 's an end of the script guide of sakusaku engine. we will keep on with some example game the next time

标签: ,

0 条评论:

发表评论

订阅 博文评论 [Atom]

<< 主页