Document , plugin and sample capx included.
Reference - Lz string compression
Does it improve performance if we use big characters for CPU cycle?
What's difference bewteen Base32k and Lz string?
Joannesalfa
It's just save the space of data saved in webstorage.
Update
Add "Action:Set local value" and "Expression:LocalValue" to save compressed string to webstorage / load decompressed string from webstorage.
Develop games in your browser. Powerful, performant & highly capable.
rexrainbow - firstly I wish to thank you for making this plugin - it's really useful.
-rest deleted - not a bug! -
Hi Rex, I have a possible bug to report - when importing data string into NWjs the decompression fails with the following message:
preview_prelude.js:30 Assertion failure: Calling expvalue.set_string without string type Stack trace: Error at Error (native) at assert2 (http://localhost:50000/preview_prelude.js:16:10) at ExpValue.set_string (http://localhost:50000/expressions.js:906:3) at Exps.Decompress (http://localhost:50000/Rex_Lzstring_plugin.js:123:10) at ExpNode.eval_object_exp (http://localhost:50000/expressions.js:347:27) at Parameter.get_exp_str (http://localhost:50000/eveng.js:2068:19) at Action.run_object (http://localhost:50000/eveng.js:1817:32) at EventBlock.run_actions_and_subevents (http://localhost:50000/eveng.js:931:38) at EventBlock.run (http://localhost:50000/eveng.js:888:9) at Runtime.executeSingleTrigger (http://localhost:50000/preview.js:4945:10)[/code:1agwpokt] Here is a [url=https://dl.dropboxusercontent.com/u/184657779/c2%20demo/LzString_v_NWjs_import_error.capx]capx[/url] to reproduce. Run the layout with group 1 enabled to save a .txt data file, then run the layout with group 1 disabled and group 2 enabled, to import the same file (this saves and imports a compressed dictionary.json string). Hope this helps and is an easy fix. Cheers.
Colludium
It is an interested bug.
I found that official Ajax plugin will cut some characters which represent windows style line endings. It is a sweet design for users.
But... lz-string will use that kind of character to store data, they are not meaningless. Therefor the decompression is failed.
Try the new "Encoding" feature, and set "Encoding" to "UTF16" (or "URI", "Base64").
It is not perfect for your case, just a workaround solution.
rexrainbow - that is excellent! I bow down to your mastery of c2 plugin creation. Thank you so much!!
anyone have a construct 3 version of this plugin?
Hello Rex, I need to save some JSON strings and avoid that any user can alter them, if I compress the string, it serves to make it safer ?.
**Ok I think it will help if I use the coding.