Stencyl 3.4.0 is now out. Get it now!

Attribute Saving [Extension]

GeorgeN

  • Posts: 858
This is a custom saving extension. It works the same as the save/load blocks from Stencyl but it won't save/load all the game attributes. You can save/load manually whatever game attributes/normal attributes you like.

Save Block
Save some data(number,text,list,etc) with a given name.

INPUT:
-data name (a string)
-value (a number, a string, a list,etc)
-file name (is the SharedObject filename)
RETURN:
-nothing

LoadBlocks
Retrieve some data(number, text, list, etc) with a given name.

INPUT:
-data name (a string)
-file name (is the SharedObject filename)
RETURN:
-data value
-false (if the data dosen't exist)

Print Block
Prints out data value to the console.

INPUT:
-data name (a string)
-file name (is the SharedObject filename)
RETURN:
-nothing


EXAMPLE:

Result(Flash SharedObject):

Tested on Flash, Windows, iOS and Android.

Saving location for Windows
%APPDATA%\Roaming\Stencyl\GAMENAME

Saving location for Flash
%APPDATA%\Macromedia\Flash Player\#SharedObjects\

If you use it I would really love to hear that from you so feedback is appreciated!

UPDATE LOG:
13.10.2015
-A fix for maps in flash made by yoplalala (version 1.3)

06.02.2015
-Fix for Stencyl 3.3 openFL

« Last Edit: October 13, 2015, 09:04:41 am by GeorgeN »

GeorgeN

  • Posts: 858
Update:
-"load data block" renamed in "load data as anything".
-3 new blocks: "load data as number", "load data as text", "load data as list".

I needed to assign loaded data to a list and with the old load data block I couldn't so I've created a block that returns a list rather than anything.

FortySe7en

  • Posts: 304
Damn, yet another extension I find out too late about :).
Keep up the great work George. I need to check the extention section of stencyl forums way more often.

GeorgeN

  • Posts: 858
Thank you! This is the most used extension for my projects and it will be the first that I will upgrade to OpenFL.

BTW you don't have to keep an eye on the whole extensions section. Check this out: http://community.stencyl.com/index.php/topic,25982.0.html

FortySe7en

  • Posts: 304
Yeah, I saw that page today and found about many extensions I didn't know existed (like google analytics for example, wish it was still supported as it seems unfinished/unattended).

GeorgeN

  • Posts: 858
Working fine on Android/Flash latest OpenFL build.

Photon

  • Posts: 2697
Is this a temporary save or can you save objects and have them persist between game sessions like normal game attributes?

Also, is this capable of touching game attributes or is it all custom attributes?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

GeorgeN

  • Posts: 858
Is this a temporary save or can you save objects and have them persist between game sessions like normal game attributes?

Also, is this capable of touching game attributes or is it all custom attributes?

Its a persistent save exactly like save/load blocks from stencyl the only difference is that you have control of what entries you make and also over the name of the file.

I don't understood very well the second questions. You can save whatever data you want. game attributes,normal attributes,manually inserted values like numbers, strings,lists. I use it to save game progress and highscores.

Photon

  • Posts: 2697
Oh, I think I understand now. I thought at first what you meant is that it can save the actual game attributes themselves, but what you meant is that you can put the values of the game attributes into the custom values and save them that way, right?
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

GeorgeN

  • Posts: 858
Oh, I think I understand now. I thought at first what you meant is that it can save the actual game attributes themselves, but what you meant is that you can put the values of the game attributes into the custom values and save them that way, right?

Yeah. It's just a way to manually pick and save whatever you want. The saving code is the same in Stencyl load/save blocks because I ripped from there. On stencyl was a loop that saved all the game attributes name+value and I've made some functions that gets name+value+filename.

How I check at the game start if there are entries in the save file if not I create some:



How I update an entry:

« Last Edit: February 09, 2014, 06:23:17 am by GeorgeN »

Photon

  • Posts: 2697
Cool. This seems like something I could really use. 8)
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!


Photon

  • Posts: 2697
Recently used this to make an easy inventory extension for my current game project. This works so well because I don't have to arbitrarily go in and make game attributes for every single item.

I'm planning to drop this in for handling some other custom datasets as well, like for an achievement system.
Do NOT PM me your questions, because I likely will not respond. If I have replied to your question on the forum, keep using that topic. Thanks!

GeorgeN

  • Posts: 858
Recently used this to make an easy inventory extension for my current game project. This works so well because I don't have to arbitrarily go in and make game attributes for every single item.

I'm planning to drop this in for handling some other custom datasets as well, like for an achievement system.
Thanks Photon for using this. I use it also in all my games and I found it very very useful.

Blogscol

  • Posts: 47
Great Extension,  you saved my life  Stencyl 3.1 no  load data must be a Bug, but your extension works