[plugin] lz-string (string compression)

0 favourites
  • 11 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • 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.

  • 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 Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Update

    • Feature of saving/loading from webstroage directly had been deprecated (removed).
    • Add "Encoding" (None/Base64/UTF16/URI) to encode the compression result.

    Colludium

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)