Save System with INI-plus
Author: | Jenswa
|
Submitted: | 21st March, 2003
|
Views: | 5831
| Rated: |
|
|
Guide to save system with ini-plus:
(for TGF, but might work in MMF too)
author: HoogHaar
date: 21 March 2003
target: Newbies
First of all, you need the ini plus object,
put it in your game.
Don't setup the path to the ini file in the level editor
but do that in the event editor by start of level:
Here follows a basic explaination of the functions/methods
of the ini-plus object, might be handy.
>set current file to appdrive$ + appdir$ + "savefile"
don't touch appdrive$ and appdir$, they are
the drive and directory of your game.
and change savefile into the name for your save file,
let's say hooghaar.save (leave the quotes in them).
You can also specify an absolute pathname,
but that's not so smart, when installing your game
on another (different) PC.
>set current group to "appname"
where appname is the name of your application/game.
(again leave the quotes in them).
>set current item to "slot 1"
for the value of the first save.
You can expand this by setting more items to "slot x"
where x represents a integer (real numbers like 2, 3, 4, etc..)
This way you will have all of your save values into one file.
>set value x
where x represents a integer (real numbers like 2, 3, 4, etc..)
set whatever value, you might need here,
but before setting this value, be sure that you have the
right item, in the right group, since you cannot enter such details here,
you need to set the group and item with set group and set item, to be sure
that you have the right item to be set.
example:
set group to "HoogHaar"
set item to "slot 1"
set value to 1
>set string "henk"
this will do the same, but then with a string
replace henk by whatever you like,
but leave the quotes.
The following functions are used to retrieve data from the
ini-object, the actual file which you can't set here,
but have to set in the beginning.
>get value
this returns the value of the current group and item.
>get string
does the same as 'get value' but then a string is returned
>get value from group
this returns a value from the group specified in the syntax
>get string from group
does the same as 'get value from group' but then a string is returned
>get value from item
this returns the value from the item specified in the syntax, from the current group.
>get string from item
does the same as 'get value from item' but then a string is returned
>get value from group and item
this returns a value, from the specified group and item
>get string from group and item
does the same as 'get value from group and item' but then a string is returned
The returned value can be shown in a counter/score object or put it somwhere else,
like value a of main character, whatever.
The returned string can be shown in a textbox or something similair like that object.
With quotes i mean the "" signs around a string.
They point out that it's a string and not a variable.
Now, to build a simple save system, especially for platformers
Build it:
make a save file, set a group and creating a number of slots (items)
in that group, two or three will most of the time be fine.
Showing the saves:
Take as many counter objects as slots (items) your save file has
and in each counter, put the number of an item (slot x)
Use arrow keys or mouse pointer to select a slot, be sure to copy
the slot number somewhere in a value, so you can use it during
your game.
Saving levels:
For each level reached, store a value in the current item (slot x)
the value represents the reached level.
Now use some imagination to 'decorate' it and
work it out in a game.
(directly copied from the txt-file of my HD)
|
|
JenswaPossibly Insane
Registered 26/08/2002
Points 2723
|