[Plugin] instance bank2

Post your completed addons to share with the community

Post » Mon Mar 11, 2013 12:11 pm

[QUOTE=rexrainbow]This instance bank plugin is just a beginning. I plan to make another plugin to auto-save/load instance outside a range.[/QUOTE]

Wow that sounds fantastic.
B
134
S
65
G
16
Posts: 1,765
Reputation: 19,188

Post » Sun Mar 24, 2013 6:34 pm

Hello everyone,

This plugin seems to be very useful. However, I can't seem to figure out how to load back my sprites' instances from Webstorage. I'm certain that it is me (I am learning...slowly). :)

Would it be possible to have an example on both how to save and then how to retrieve the sprites instances from Webstorage?

ex:
On Touch "save icon" ---) X,
                     ---) y.
                     ---) Z.

On Touch "Load icon" ---) X.
                     ---) Y.
                     ---) Z.


p.s.: I have read all post and view all referenced capx (it just doesn't seem to "sink in").

Thank you very much!
B
25
S
8
G
1
Posts: 13
Reputation: 3,133

Post » Mon Mar 25, 2013 2:49 am

@Sobieski74

Save bank to webstorage / load bank from webstorage

User could get string by "expression: BankToString", then save this string into
- global variable
- dictionary
- webstorage
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Mon Mar 25, 2013 2:14 pm

Hello Rexrainbow,

Would you, or anyone else, be so kind as to review my capx example?
https://www.dropbox.com/s/f2s0jegexwnucqt/%21C2.capx

My events to save and load to/from Webstorage are as followed:

- KB: On S released --) IB: Clean bank to empty
                    --) IB: Save "chess" from all instances

- IB: on saving "chess ---) IB: set local key "SAVE" to instancebank.banktostring

- KB: On L released: WS: Set local storage from JSON string "SAVE"
                     IB: loadbank from JSON string to Webstorage.AsJSON

- IB on loading "chess" ---) IB load all saved instances


(KB = KEYBOARD, IB = INSTANCEBANK, WS = WEBSTORAGE)

Should my command to save and load be any different than what I have inserted in order to work?

Thank you very much! :)
B
25
S
8
G
1
Posts: 13
Reputation: 3,133

Post » Mon Mar 25, 2013 4:37 pm

@Sobieski74



Call "action:set local key "SAVE" to instancebank.banktostring" after "action:Save "chess" from all instances"
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Tue Mar 26, 2013 9:08 pm

Hello Rexrainbow,

Thank you for the advice on how to save, I am now able to save and load back the instances (but only if I destroy the instances before attempting to load them back).

https://www.dropbox.com/s/lywcvzegm9r6owu/Test2.capx

(note that I made one extra change with the webstorage, by changing "set" to "merge" so that saved instances could be overwritten).

I am only beginning with C2, but your plugins are of a great help!

ps: I can't wait to be able to post the capx and images within the message! :)

Thank you!
Sobieski742013-03-26 21:19:34
B
25
S
8
G
1
Posts: 13
Reputation: 3,133

Post » Wed Mar 27, 2013 12:23 am

@Sobieski74

Using chess bank to save/load chess on the board.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Wed Apr 03, 2013 1:25 am

r124 will support save/load system, cool!
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Wed Apr 03, 2013 6:32 am

The action of loading (official feature in r124) is interesting.

Engine will create instance which UID is the same as saved.
If the saved instance has existed when loading, it will be changed by loading info.
So that the UID of these instance will not be changed after loading.
B
97
S
22
G
176
Posts: 4,108
Reputation: 103,019

Post » Wed Apr 03, 2013 7:59 am

Yes, actually i use Instance Bank for memory managment, Save/Load system uses IndexDB which is not 100% supported to some platforms.
B
95
S
25
G
20
Posts: 3,052
Reputation: 22,613

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: antares330 and 2 guests