2017年2月14日星期二

Script Guide_7 CG gallery,save and game initialize

CG garllery

[getcg] - collect a picture in gallery



Goes with the name of a picture as the one parameter, the name is defined in the cg.xml. This script will make one picture collected in gallery.
The state of the cg is updated in xml file ,and will not change when save and load.
Read the next line of script automatically.

[getcg CGname]
CGname: the name you defined in cg.xml.
[showcg]

[showcg] - show the gallery


Open the CG gallery.

Example:CG collection


in cg.xml
<CG1 name="A red picture" show="false" img="red.jpg"/>

in scenario file

[dialog bunny| show the CG gallery without a picture][getcg CG1][dialog bunny| the attribute show is true][dialog bunny| show the CG gallery][showcg]


When the gallery show the first time, you cannot open the picture CG1.After  [getcg] the picture is collected and you can open it in this example.



Save and Load

[enablesave] and [disablesave]-you can save here but cannot save there


These two script is used to set the statue of a game. When read the script [disablesave] , the save button in main menu will be gray and the game is unsaveable . Use [enablesave] to make it able to use.
IF you make a in-game menu, ask the player to choose New Game or Load a save file, you might not wish your play save here.

[enablesave]
[disablesave]

[autosave] - save point in game progress

Goes with no parameter, update the auto save file in document directory. this script would work when the game is unsaveable.
Read the next line of script automatically.

[load] - load a save file

The script [load] goes with one parameter, the path of a save file. After a load operation, the game will jump the point which stored in the save file. You will not be prompted after this script, it is different from use a load button in the main menu.
In this version ,you can use only two save file in one game.

[load Filename]
Filename: the filename of a save file. All the file can be found in the document directory.


Example: make a load menu

in init.xml
<imgsave  img="ui/btsave.png" x="65" y="15" file="save.xml"/>
<imgload  img="ui/btload.png" x="165" y="15" file="autosave.xml" txt="Do you  want to go &#xA; to the last checkpoint"/>

in a scenario file
[ask the save file|300|100|labelA|imgask3.png]
[ask the autosave file|300|200|labelB|imgask3.png]
[dialog bunny| Which file do you want?]

[label labelA]
[load save.xml]
[label labelB]
[load autosave.xml]




[initsavefile]-initialize all the save files and setting

This operation is dangerous that it will remove all your collection and setting in the game. The files in setting directory will copy to document directory and recover the cg.xml, staticvar.xml and the two save files. If the player want play a game at the very beginning, use [initsavefile].
You will not be prompted after this script, so write a confirm menu in the game before your players come to this script.
this script will read the next line of script, but not go to the first scenario  automatically.

Example: make a confirm menu before initialize


[label menu]
[ask New Game!|300|100|labelA|imgask3.png]
[ask Load|300|200|labelB|imgask3.png]
[ask Initialize|300|300|labelC|imgask3.png]
[waitclick]


[label labelC]
[ask Yes!|300|100|labelD|imgask3.png]
[ask I change my mind|300|200|menu|imgask3.png]
[dialog bunny| Do you really want to clean all your collection?]

[label labelD]
[initsavefile]
[dialog bunny| Now there is no picture in your gallery. ]

If a CG you defined in the cg.xml in setting directory is collected (show="true"), you can open it in the CG gallery of course.



标签: , ,

2017年2月13日星期一

Script Guide_6 the time in a game and write a warning tip

[wait] - pause the game for a second

The script [wait] goes with one parameter, the time you want the player to wait. The game will pause and wait for while, when the game is waiting, the play cannot click to read the next line.

[wait Time] 
Time: number in milliseconds. 

[waitclick] - click to continue

This script goes with no parameter, it only stops some script from reading the next line automatically.Most used at the end of an [ask] sequence. The game continues with a click.

[waiclick] 

Example: use wait to control a game


[img carrot.png|0|240|LayerA]
[wait 1000]
[img cabbage.png|0|240|LayerB]
[wait 1000]
[waitclick]
[dialog bunny| what should I eat for breakfast?]

This example shows the second picture after one second, and one second after the cabbage picture appears, players can click to read the dialog.




[setdurtime] - slow the menu down

It is a special script used to change the interval of time of the game setting. if the node <speed> exists in the staticvar.xml, this interval time of the game will be 
(the duration time in init)*(the speed in staticvar)/10

[setdurtime]

Example: change the fade in time


[dialog bunny|hi!]

[eval speed=1000]
[setdurtime]
[img ramen1.png|0|120|LayerA]
[dialog bunny|it takes 100 seconds to show a picture]

[eval speed=50]
[setdurtime]
[img ramen1.png|200|120|LayerB]
[dialog bunny|it takes 5 seconds to show a picture]


[eval speed=0]
[setdurtime]
[img ramen1.png|400|120|LayerC]
[dialog bunny|the picture shows directly]

Use a round number as the <speed>.
If the node <speed> does not exist, this script would not work. The [setdurtime] change global time so the speed of menu bar is slow down too.


[showtip] - show tips and warning

The script [showtip] shows some text on the left top of the game. It is usually used to show some tips when the game is played, also, it shows some information when the scenario has something wrong. The tips stay on the screen for a while and fade out, the time it stays is set in the init.xml.
  Goes with one parameter, the text you want show as a tip. Read the next line of script automatically.

[showtip Text]
Text: Some words you want to tell the players.

Example: write a Waring content

[showtip DO NOT COPY WHAT THE CHARACTERS DO IN YOUR REAL LIFE]


标签: , ,

Script Guide_5 make your scenario with several files

It will be a nightmare to write all the content in a single file when the story is long, split it into episodes in other files.


[call] -  jump to another file


The script [call] goes with one or two parameters, the scenario file and the label you want to go to. You can use many files and jump between them in a game.  Use this script to read another scenario file.

[goto Filename| Labelname]
Filename: the filename of the scenario, all the file can be found in the scenario directory.
Labelname: the name a label in current scenario file. You can use variables in Labelname. It will read the first line  without this parameter.

Example: read a new file

[call anotherfile.txt]
This will lead the game to another file and read the first line of script.
[call anotherfile.txt|somelabel]
This will read the other file and jump to the line of that label.




[return] - go back to the last file

when you use [call] to jump to another scenario file, you can use the script [return] to go back to the last file and start at the next line of [call]. you can use it only once after a [call] in this version.
the last file will store in the savefile after a script [call] runs correctly if you saved. So the [return] is usable after you load a savefile.

Example: jump and go back

In the mainfile.txt
[dialog bunny| hello! I am bunny.]
[call anotherfile.txt]
[dialog bunny| It is me again!]

In the anotherfile.txt
[dialog cabbage| Hi, I am a cabbage.]
[return]

The bunny says hello and a cabbage come to say hi, and then the game goes back to the first scenario file, shows the bunny again.


标签: , ,

Script Guide_4 variables and conditional statement

[if] - the conditional statement

The script [if] is used to check flag, point score or other variables you want to store, this script goes with some conditions (  logical IF statement).
Read the next line of script automatically if the result is true, or go to the next script [end if] line if the result is false.

[if (@variable Operator Value)]
[end if]
variable: the name of variable. Write the name after “@” and end with a space. You can also use some value here.
Operator: can use == as equality; != as  inequality ; > as greater than    ;    >= greater than or equal to;<    less than;<=  less than or equal to.
Value: the value you want to check can be a round number or string. You can also use variable here.

&&  logical AND  and    ||   logical OR   are supported in this script. Use a pair of bracket to split the statements.
[if (1>2)||(1<2)] obtains True
[if (1>2)&&(1<2)] obtains False
[if (1>2)||(1<2)||(1<3)] obtains True
You cannot use another [if] in a pair of [if] and [end if],use a [goto] instead.

Example: check a flag

[eval @food =carrot]
[eval @number =5]
[dialog bunny| what did I eat last night]
[if @food == carrot]
[dialog bunny|I had cabbage]
[goto labelC]
[end if]

[dialog bunny| the result is false if it is not carrot]
[goto somewhere]

[label labelC]
[if @number >3]
[dialog bunny| I ate too much]
[end if]

[label somewhere]

In this example, it will check the food type and the number. If the food type obtains false, the script will jump to another label and never check the number again.



[eval] -assignment statement

It usually need to store some value such flags and points in a game. The script [eval] is used to gave variables a value and store it. Read the next line of script automatically .

[eval @variable Operator Value]
variable: the name of variable. Write the name after “@” and end with a space.
Operator: can use + addition; - subtraction and = to evaluation.
Value:  can be a round number or string. You can also use variable here.

When you want to show a variable in dialog or some text, use a “@” and a space.

Example: evaluation a variable

[eval @food =carrots]
[eval @number =5]
[dialog bunny| I ate @number  @food  this morning. ]
[eval @number +1]
[dialog bunny| I ate @number  today. ]

the bunny will say “I ate 5 carrots this morning.” and”I ate 6 today.”
if you use [eval @number +another] after this, the result will be ”I ate 1another today.” Be careful to use number and string .A string does not support the subtraction operator.

All variables which defined in the init file will be stored in a save files. The variables in staticvar will write in file once their value are changed. If a variable has not been defined, you can still use it but it will not write in a save file.





标签: , ,

2017年2月9日星期四

Script Guide_2 Image and sound

A  visual novel is too pale without pictures and musics. It should have some background pictures, music and a picture of your character.

[img] - avatar of a character


The script [img] goes with four or five parameters, read the next line of script automatically.

[img Filename| posX| posY| Layer| Time] 

Filename: The filename of the imagine, all the file can be found in the role directory. IF the filename parameter is empty or an “unload”, the layer will be cleaned
posX: the position where the imagine display horizontal. Change the position to make the layer move.
posY: the position where the imagine display vertical . Change the position to make the layer move.

Layer: the name of the layer where the imagine placed on.
Time: if you want the imagine fade in/out or move in some time longer. Not a necessary parameter.

Example: A Simple imagine show

[img avatar.png|0|240|LayerC]
[dialog Bunny |Hello there!]
[img avata2.png|50|240|LayerC|1000]
[dialog Bunny |I have <font  color="#ff0000">Red</font> eyes]
[img unload|100|240|LayerC]
[clearimg]

➽ The script [img] supports some swf files; you can show small animations with this.


[clearimg]-remove all imagine

The script [clearimg] will clean all the imagines in all layers. It is a faster way to remove all the imagines on the screen instead of unloading them one by one. Read the next line of script automatically.


[background]-show background picture

The script [background] goes with one parameter, the path of the background imagines. The background stays at the bottom of all layers.
read the next line of script automatically.

[background Filename]

Filename: the filename of the imagine, all the file can be found in the ui directory. IF the filename parameter is “clear”, the layer will be cleaned


Example: show a background picture

[background clear]
[background white.jpg]

this example remove the old picture and show a new imagine file.


[sound]-sound effects

The script [sound] goes with one parameter, the path of the mp3 file. The sound clip will be played once.
Read the next line of script automatically.

[sound Filename]

Filename: the filename of the sound file, only mp3 file. All the file can be found in the sound directory.

Example: play a sound effect

[sound bgm4.mp3]


[bgm]-a background music

The script [bgm] goes with one parameter, the path of the mp3 file. The music will loop until it go to a script [bgmstop].
Read the next line of script automatically.

[bgm Filename]

Filename: the filename of the sound file, only mp3 file. All the file can be found in the sound directory.

Example: have a background music

[bgm bgm4.mp3][bgmstop]



标签: , ,

2017年2月6日星期一

Script Guide_1 dialog and aside

All the scenario files can be found in the scenario directory, saved as txt file.
the scenario files usually saved as .txt file, while you can also save them with any extension.
It is highly recommended to Encode them in unicode
no matter which extension they have, edit them with text editors.

😃 try editplus or notpad++

you can place comment after  “//”
blank lines will not be read.

---------------------------

[text]--Subtitle or aside 


the script [text] goes with one five or six parameters , you need click to read the next line of script, or use an automation parameter to read the next line automatically .

[text Type| posX| posY| Width| Text| Automation ]

Type:
new: all the text exist will be clean and the new text will be placed at the beginning
add: new text will add after the old ones
clear:  clean all the text
posX: the position where the text field display horizontal 
posY: the position where the text field display vertical 
Width: the width of the text field
Text: some text you want to show in the screen
Automation :  write an “auto” to make the next line of text show itself automatically. Not a necessary parameter.

Example: A Simple text Game

[text new|0|20|100|Hello!]
[text new|0|20|200|welcome to sakusaku engine!|auto]
[text add|0|20|100|It is a very simple text game]
[text add|0|20|100|after this line, all the text will be removed]
[text clear]



[dialog]--the words what your character say 

The script [dialog] goes with two or three parameters , you need click to read the next line of script, or use an automation parameter to read the next line automatically .

[dialog Name | Text | Automation ]

Name: The name of the character who is talking.
Text: Some words the character says.
Automation: write an “auto” to make the next line of text show itself automatically. Not a necessary parameter.

[dialogadd Text]
The script [dialogadd] goes only one parameter, the Text you want to add a new line after the last words the character said.

Example: A Simple dialog

[dialog Bunny |Hello there!]
[dialogadd I am a cute animal in this forest!]

➤➤➤➤➤➤➤➤➤➤➤➤➤➤➤
The script [dialog] and [text] support some HTML tags.
<u>under line</u><br>line break


 The last example look the same as this
[dialog Bunny |Hello there! <br> I am a cute animal in this forest!]

The script [dialog] and [text] also support color tags and a herf tag.

[dialog Bunny |I have <font  color="#ff0000">Red</font> eyes]
[dialog Bunny |Click <A HREF="http://somehere.com">Here</A> to see my photo]

while the HTML tags can be used ,you need to write the angle brackets with &lt; and &gt;
➤➤➤➤➤➤➤➤➤➤➤➤➤➤➤

[clr]--clean and hide the dialog

The script [clr] hides the dialog frame and remove all the dialog text
click to read the next line of script.

[msghide]/[msgshow]--hide but not clean them

Different with the script [clr], just hide or show the dialog frame while do not r remove the dialog textclick to read the next line of script.

[msghide]: hide the dialog frame
[msgshow] :show the dialog frame



[img]--give the dialog a picture

A visual novel is not only a novel.Show pictures when your characters talking. 
The script [img] goes with four or five parameters, read the next line of script automatically.


[img Filename| posX| posY| Layer| Time] 

Filename: The filename of the imagine, all the file can be found in the role directory. IF the filename parameter is empty or an “unload”, the layer will be cleaned
posX: the position where the imagine display horizontal. Change the position to make the layer move.
posY: the position where the imagine display vertical . Change the position to make the layer move.

Layer: the name of the layer where the imagine placed on.
Time: if you want the imagine fade in/out or move in some time longer. Not a necessary parameter.

Example: A Simple imagine show

[img avatar.png|0|240|LayerC]
[dialog Bunny |Hello there!]
[img avata2.png|50|240|LayerC|1000]
[dialog Bunny |I have <font  color="#ff0000">Red</font> eyes]
[img unload|100|240|LayerC]

The script [img] supports some swf files; you can show small animations with this.


[clearimg]--clean all the layer

The script [clearimg] will clean all the imagines in all layers. It is a faster way to remove all the imagines on the screen instead of unloading them one by one. Read the next line of script automatically.




标签: ,