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.



标签: , ,

0 条评论:

发表评论

订阅 博文评论 [Atom]

<< 主页