- 注册时间
- 2007-12-19
- 最后登录
- 2010-10-4
⑧专业
= =|||
- 积分
- 419003
|
楼主 |
发表于 2008-3-30 15:27:40
|
显示全部楼层
这里是MMF储存插件的英文帮助 如哪位大人能帮忙翻译 也谢谢了~~
Usage
Setting the object up
The setup dialog has 3 important fields. You have to decide what parts of an object you want to save. You can save the object's position, alterable values and flags and animation data.
Important! Please note that only Active Objects are recommended to save, but other objects might work if you only save co-ordinates. Saving other things than co-ordinates can result in crashes and/or strange results. The extension tries to safeguard against this mis-use, and it will often refuse to save at all if it doesn't recognize the object it is given.
Saving an object
To save an object's data to memory, use the action Save object to memory and select the desired object. The object type parameter of this action is the identifier number of the object. Remember to use different numbers for different types of objects.
Event conditions are considered by the save action so you can save objects that are inside a zone.
Saving data to disk
Use the action Save memory to disk. It saves all data the extension currently stores about the objects and the values and strings set. The action lets you specify a file path. If you want to save to the current directory of your application, use this expression: Appdrive$ + Appdir$ + "yourfilename", where yourfilename is a file name of your choice.
If the save was successful, this action will trigger the On save file successful condition, otherwise, it will trigger On save file failed.
The files saved with Save Game may seem encrypted, but they are not, therefore they are quite hackable for someone with a little experience. If you are saving important information, you might want to look at other objects for encryption, such as Binary object and the Encryption Object.
When you save, the object's memory will be cleared if auto-clear is on. This option can also be pre-set in the setup box, so you don't have to set it at start of frame.
Loading data from disk
You do this with the action Load file into memory. It lets you specify a file path, just like the Save memory to disk action.
If the load was successful, this action will trigger the On load file successful condition, otherwise, it will trigger On load file failed.
You do not have to clear the memory before you load a file, loading a file automatically clears all data.
Clearing memory
To clear all data in Save Game, use the action Clear memory. It clears all saved objects, all values and all strings.
Important! It is not recommended to use any of the object’s functions with object parameters (i.e. Setup existing object from memory). This is due to how functions with object parameters work. MMF will call the function one time with the first of that object, then call the function again with the other object at the end of the event. This means that if you are, for an example, setting up existing objects from memory, and then clearing memory, it will only setup the first object, since the other objects’ data will be erased.
Loading objects
There are two ways of loading objects, you have to choose which one you will use, depending on what your application is like.
Firstly, if you haven't destroyed the objects you saved before, you can load them in with Setup existing object from memory. This is very simple - you just pick the object you saved before and the extension will do the setting up. It checks if the fixed value it has got stored is the same as the object's fixed value, so this method might not be practical all the time, as you have to be sure that the object you're saving is going to exist and have the same fixed value.
The other loading method might be slightly harder, but it might be more practical in many situations.
Any time when you have object data saved to memory (doesn't matter whether it was loaded to memory from a file or saved to memory earlier) you can run the action Create and load objects from memory. This will trigger the On create and load object conditions. I recommend the one with the type parameter (On create and load object (type)). The On create and load object condition must always be the first (top) condition in your on load event. Type is the object type you specified earlier - if you saved Active1 as object type 1, you probably want to load it as object type 1.
Now, in your on load event, you must first create the object that should be loaded. If you are saving co-ordinates, I recommend creating the object outside the frame so it doesn't show up at the wrong place for 1/50th of a second. After you have created the object, use the action On create and load object: Setup created object and select the object you just created. This will do all the placing and value setting for you (depending, of course, on what settings you used in the set up).
You can also compare the fixed value of the object you're about to load with On load object: Get fixed value (of original object) if you know that the object is still in the frame. Doing this is basically the same as using Setup existing object from memory, but this method might be slightly more customizable.
When you load and create the objects from memory, the object's memory will be cleared if auto-clear is on, but it will not be cleared if you load with the Setup existing object from memory since you may have to use it several times.
Important! It is not a good idea to create the object after you set it up. If you are experiencing a placement problem, this might be the cause. Check the order of actions.
What if I want to save something else in the save game file?
This is where Set value and Set string come in. These functions let you specify a name (label) of your value or string and the value/string itself. For an example, you can set the value "Health" to 50 and save it, and you can set the string "Name" to "Olle". If the given name does not exist yet, the extension will automaticly create a new slot for it.
To access a value or string, use the Get string and Get value expressions. Those let you specify a parameter, which is the name of the value/string. The names are case sensitive, "A" is not equal to "a". If the given name does not exist, it will return 0.
Note there are different arrays for strings and values. If you set the string "Hello" to "10", the value "Hello" will not be 10. It will be 0 (because there is no "Hello" value).
If you find these value and string functions limited or slow, you should try the Associative Array object.
Disclaimer
The extension written by myself, the author, is provided on an "as is" basis. I do not guarantee fitness for any purpose. In no event will I be liable for any direct, indirect, incidental, punitive or consequential damages of any kind whatsoever with respect to this extension and its usage. This includes corruption and/or loss of data.
(In short: you use this at your own risk. I am not responsible for anything that happens when using Save Game Object.)
That's all! Good luck using the object!
Fodo |
|