[Plugin] instance bank2

Post your completed addons to share with the community

Post » Sat Jan 19, 2013 9:06 am

Document, plugin and sample capx are included.
Save/Load instances. It will save/load instances through part of official save/load system.

Compare with official save/load system
Official save/load system will save/load all instances. This plugin only save/load the specifics instances by type, unsaved instances will not be affected.



plugin: Grid freezer
Load saved instances part by part.
Last edited by rexrainbow on Sat Jan 23, 2016 5:59 am, edited 6 times in total.
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Sat Jan 19, 2013 11:14 am

To think that 3 weeks ago i build my app using this principle with lots of events.
And to find this plugin doing the same thing with mega speed and just a few events.

Your rock!
Now i just have to replace my events with your plugin.
The result will be worth it!
So thank u rexrainbow
Im going to use this massivley.

Kind Regards.
Savvy001
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Mon Jan 21, 2013 4:29 pm

Hi @rexrainbow

Thanks for this new plugin, but I am having an error message when unziping it.

B
90
S
5
G
8
Posts: 165
Reputation: 7,648

Post » Mon Jan 21, 2013 11:18 pm

@NRABrazil

Humm... it's my fail. You could rename *.txt to *.7z, then unzip it. I will try to fix this problem (all my zip files become *.txt) when I have time.
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Tue Jan 22, 2013 6:43 am

Hi, i used your plugin for the saving of my sprites into webstorage and load it when i reopen the game.

It runs perfectly on preview mode, but when i try to run it after being exported, i get this error.

Uncaught TypeError: Cannot call method 'getCurrentSol' of undefined c2runtime.js:11294
InstBankKlassProto.CreateInstance c2runtime.js:11294
InstBankKlassProto._load_all_instances_handler c2runtime.js:11324
InstBankKlassProto.LoadAllInstances c2runtime.js:11330
Acts.LoadInstances c2runtime.js:11055
Action.run_object c2runtime.js:5968
EventBlock.run_actions_and_subevents c2runtime.js:5570
EventBlock.run c2runtime.js:5548
EventSheet.run c2runtime.js:5208
EventInclude.run c2runtime.js:6270
EventSheet.run c2runtime.js:5208
Runtime.logic c2runtime.js:2892
Runtime.tick c2runtime.js:2750
extra



I have tried clearing cache, re-exporting in various options. Nothing works.

----------------------------------------------------------------------------------

This is what i did, i created some instances of the sprites(Bricks) and (Connector). Then, i saved all the instances of the 2 sprite into the Instance Bank. Once saved, i use BankToString to store everything into WebStorage.

When I open the browser again, i used

Load Bank from JSON string WebStorage.LocalValue("InitialBricks")


Once all that is done, I used

Load all saved instances


-----------------------------------------------------------------------------------

I used this in preview mode, it works.

But after i exported it, it gave me an error and stop working. Please help. Thanks
DaveSX2013-01-22 09:25:02
B
6
S
1
G
1
Posts: 13
Reputation: 778

Post » Tue Jan 22, 2013 2:56 pm

@DaveSX

I'm not sure. Test ok when I save instance bank into WebStorage, then load it immediately.
You might provide a very simple test capx.
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Wed Jan 23, 2013 2:15 am

here is the link to the sample capx.

It works fine in preview mode, but once exported it gave the error.

https://docs.google.com/file/d/0B7VK2vJr4XSKNXJxN2lTdlZlUTQ/editDaveSX2013-01-23 02:16:18
B
6
S
1
G
1
Posts: 13
Reputation: 778

Post » Wed Jan 23, 2013 2:52 am

@DaveSX

It seems you saved instance bank to JSON string (at default.json) at previous mode. Then use this saved data at exported mode.
The C2 engine will rename all types, so that instance bank could not get the saved data by type name.
You could create the default.json after exported to use the same type name.rexrainbow2013-01-23 02:53:55
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Wed Jan 23, 2013 8:00 am

Ahh... Got it to work. Thanks a lot.
B
6
S
1
G
1
Posts: 13
Reputation: 778

Post » Sun Feb 24, 2013 3:13 pm

Hi Rex!

I have been doing a bit of digging into the demos you posted for InstanceBank. After adding in some debug output to print out the UID's for Main and Sub on "instbank_savedUID" as well as adding in a "onanykey" event to reload at will, I found that the original instances are not getting destroyed leading to duplication of the objects. This can be see most clearly with "instbank_savedUID" with the changes since it has movement and the new object show up looking like a fan blade.

Here is a link to the modified capx file:


https://www.dropbox.com/s/9pzrhs54u9v1mjn/instbank_savedUID-modified.capx

(let me know if you can't get to it.)

Thank you for making these plugins! It's so nice to see a community giving back to one another.


B
5
S
1
G
1
Posts: 9
Reputation: 908

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 0 guests