How do I Load A Boolean Variable Using WebStorage?

0 favourites
  • 6 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi everyone, i was wondering if anyone knew how to load a Boolean Variable Using Webstorage?

    I know how to Set keys and grab them /save and load Gloabal and Instance variables,but lack the knowledge to load an actual boolean.

    Is it possible to save the actual state of the boolean?

  • Does anyone know how to save and load a boolean variable? im not asking for a capX or anything i just need help.I couldnt find anything on this in the manual or on google.

  • A boolean is just a hidden way of storing 0 or 1. You can save it, but you can't read it back in anyway, as C2 wants to set a boolean explicitly through a drop-down. You can save it directly, but to load it back you need to compare it to 1 and set the boolean again with True 'Else' False.

  • blackhornet thank you, One thing that bothers me is im not quite sure how to set that up,there is no write up of this in the manual.I never knew we couldnt load them in the same way other variables are loaded.Do you think we will see an addon to construct adding a better way to load a boolean?

    I made an equipping system based on boolean and would of never went that route if i known this info beforehand.Thanks again for the feedback blackhornet you have helped me alot over the past months,this must of been scarce info being ive gotten over one hundred views with a single reply.

  • This is overkill, but shows the process.

    (Attachments are broken at the moment): http://blackhornettechnologies.com/cons ... leans.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • blackhornet thank you for this example,After seeing how you coded this up i realized its just alot less frustrating to make another instance variable and set everything to that,then check if its equal to 1 or 0.

    Im not sure if the way booleans are handle is ment to be set up that way but it would be pretty awesome to be able to save the state of a boolean through webstorage similar to instance variables.

    Thank you for showing me this,i wouldnt of found this out myself.

    hopefully this thread helps some others aswell.

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