How do I make a "Save Point using strings & slices"?
So you want to learn how to make a save point using only strings & slices? Well it is possible but it requieres more than one skill. This method is not recommended for absolute beginners as it involves menus string and slices.
Speaking of the devil, let's revise what are strings and slices.
Some revisions about strings and slices[edit]
A string is a piece of text which can be stored using the symbol dollar. $ Here is a example. Let's say that you're making an rpg in which the player can choose any name he/she wants for the members of the party. Let's imagine that this party member has a brother.
How can we sure that for each name the player can choose, the name of the character will be displayed correctly? Enter the strings! It's one of their main functions.
$1="My brother's name is " get hero name (2, hero:Lilian) 1 $+ 2 show string (1)
On the example above will show the string "My brother's name is <name>". Depending on the name you chose for your character the right name will appear on screen while playing! Here we use the storage capacity of the symbol $ to offer multiple choices.
To make appear a string online, you use the commands "show string at" or simply "show string" like in the example above. To make the string disappear you use the command clear string. Another important thing to know about is that they are in limited numbers : 99. Feel free to read the article above about fake textboxes for more details.
Slices are the perfect partners for strings. A slice is a piece of image such as defined
by custom.exe. It can be a portrait pic, a textbox, of an enemy picture set. Slice can
be put into collections and new menu has been added especially for that. Being all
to show in one time numerous slices. (One the link above refers to slice collections)
Slice are stored in local or global variables. Let's see an example
global variable (14, box) global variable (15, textsl) #--------------------------------------------- plotscript, brother dialogue, begin box := create rect (320, 35, 0) # Keep in mind the correct order. 1- we create a fake text box 2- we choose it's looks (color if it's translucent or not) 3- we add the portait 4- finally we add the dialogue set rect trans (box, true) wait (3) portrait:= load hero sprite (1, 1) #load attack num 1 with palette 1 put sprite (portrait, 10, 10) variable (textsl) textsl := create text textbox text (10, 73) set slice text (textsl, 10) put slice (textsl, 10, 10) #set slice width (textsl, 320 -- 20) wait (3) wait for key (key: space) # very important. allow fake text box to disappear "naturally" like the one of the text menu if (key is pressed (key: space)) then, begin wait (3) free sprite (portrait) free slice (box) #delete fake text box free slice (textsl) #delete fake text end #end of the if end #end for the script #-----------------------------------------------
In the example above, we took again the example of the brother's character, an NPC. But this time, we use a fake text box made from slices.
Like strings, there are different ways to put them on screen: put slice or set slice x (handle, X) or set slice y (handle, Y) but only one command to make them disappear : free slice.
Now that we have made all the necessary revisions, we can move on.
Making the save point[edit]
First things first, we need an NPC. Edit the walkabout graphics and check if there is a save point NPC or not. If there is none, there may it a simple one. Like an S on a rectangle. Make sure that the picture set is full and go back to the main menu. Edit your maps. Select the one on which there is the save point. Edit the local npcs and pic up a free one.
Then go back again. This time edit the menu. Pick up a free one. Name it choice menu or any other name that my help you to remember what you created the menu for. Create two items. One is called "yes" and the other "no". Edit the menu bitsets and hit the following ones
translucent box allow gameplay & scripts suspend player even if gameplay allows prevent main menu activation advance text box when menu close
You may wonder Why hitting the bitset advance text box when menu closes? We're using a fake text box. That's true. But you may want to re-use this menu later for other yes/no questions with real text boxes this time. So It is potentially useful to hit it for that.
The next thing to do is to pick a tag. So into the tag and pick up a free one. Name it save is activated or any other name that may help you to remember what the tag is for. Go into the script management menu and export the new names in your hsi file.
Then save your game. You can now open your hss file and add the following script
define script (14, save point, none) define script (25, menu choice yes script, none) define script (26, menu choice yes script, none) global variable (14, box) #--------------------------------------------------------- #save point only made of strings & slices plotscript, save point, begin suspend player suspend npcs box := create rect (320, 35, 0) # x 35, y 0 puts the text on the upper part of the screenplay set rect trans (box, true) #text box is with a transparent effect $1= "Would you like to save?" open menu (2) #call choice menu show string at (1, 18, 15) end #end of the plotscript here #--------------------------------------------------------- # script linked to menu 2 choice menu. Actions if yes is chosen plotscript, menu choice yes script, begin set tag (tag: save is activated, on) if (check tag (tag: save is activated)==on) then, begin set tag (tag: save is activated, off) free slice (box) #make disappear the slice used for the text box clear string(1) #make disappear the text created through string. end #end of the if check tag resume player resume npcs wait (2) save menu # can be replaced by the command use shop (1) when 1 refers to a shop turned into a save point # do not move this line of code above in the script, else, you may have problems when you launched a saved game end #end of the plotscript here #--------------------------------------------------------------------------- #script linked to menu 2 choice menu. Actions if no is chosen. plotscript, menu choice no script, begin if (check tag (tag: save is activated)==off) then, begin free slice (box) #make disappear the slice used for the text box clear string(1) #make disappear the text created through string. end #end of the if check tag resume player resume npcs end #end of the plotscript here #---------------------------------------------------------------------------
Go under custom.exe again and edit the menus. Choose "choice menu"
Go into reposition menu and place it on the upper part of the screenplay. Edit the menu items.
Choose yes the first one and make sure you see
type 4 run script subtype: menu choice yes script Edit the menu items bitsets and hit "close menu when activated"
Choose no the second one and make sure you see
type 4 run script subtype: menu choice no script Edit the menu items bitsets and hit "close menu when activated"
Go back to the main menu. Go back into the map menu. Edit the map when you're doing the testing. Edit the Npcs and make save point NPC activate the script "save point"
Go back to the main menu again. Save your game... and test it! You should be able to save your game. Feel to change and choice menu position according to your need.
As you can see this method relies heavily on plotscripting from the text creation, to the choices and of course for the saving process itself!
You may get similar results with easier method, but this one gives you the opportunity to understand how string and slices works together which may be useful later for your game design.
If the save point is a person, you can of course add a portrait. This method made you create a choice menu. Feel free to use it again for other yes/no question like have you seen x? Did you get item X? Thanks to the tags, you can reload the same script multiple time and get different results.
As always if you have troubles implementing this, feel free to ask for help in the discord server or on the forum of slime salad. Good luck!