..use webstore specifically

0 favourites
  • 15 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi there everyone,

    I found this tutorial scirra.com/tutorials/266/webstorage-how-to-save-ingame-information which shows the process is pretty simple, but it still assumes I know something apparently I don't..

    the tutorial shows the command and such, but there is a gap. I'm not sure where this should go.

    my intention is to track when something has been done like "first time played" as a true/false condition for future visits.

    my assumption is that I add a webstorage object.. i then go into the event page and do a tough event when touching the start button.. i would want to pass a value at that time.

    however i don't see a "set local key" option in the system page. then each time the game is loaded i'd want to immediately check the webstorage data to see if its true that the player has been here before.

    Thanks!

    Caleb

  • on the first default page

    On Layout start

    -sub condition: WB.keyexists("played")

    ->actions: initilize fist info

    -> WS.set local value

  • I posted this when helping someone else out, but I think it may help here also..

    dl.dropbox.com/u/666574/webstorage%20jump%20to%20level.capx

  • procrastinator and jayderyu thanks for that examples! very nice. but because what i'm doing isn't exactly the same i'm having trouble lining the two projects up..

    in your example "LevelReached" this is the key right? is this never declared anywhere in the project other than at that moment?

    i try to follow your example as close as possible, but it still doesn't seem to retrieve the data..

    here is a link the the file so far.. dropbox.com/s/y5169lh4ymoypqs/save%20values%20trouble.capx

    I have a text field in the first stage that shows 0 or 1 to help me know what the value is for "PlayedBeforeVar"

    probably missing one tiny thing, but for the life of me i can't see what is wrong.

    Thanks!

    Caleb

  • At first glance, you don't have it loading from the local storage on the first layout.

    Insert at the top -

    + If PlayedBeforeWebStorage.Local Key "PlayedBefore" exists (THE EVENT)

    • PlayedBeforeVar = PlayedBeforeWebStorage.LocalKey("PlayedBefore") (THE ACTION)

    Seems to work for me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put the check if the key exists as sub event of a "On start of layout".

    Also you should "gather" your action sin a single "Every tick" event, it's better for vision and allows you to "free" events if you're using the free version.

  • It's a battle of two , Procrastinator Starts by a shot on the head ! Part12studio gets a revenge , and procrastinator finishes him ! What a battle !

  • Kyatric is correct, you need to group events. I couldn't figure out why I found it hard to follow, but now I know why.

    part12studios, also, in your load layout, when the reset button is clicked, you should add...

    PlayedBeforeWebStorage set local key "PlayedBefore" to 0

    whiteclaws, haha that made me laugh ;p but the battle isn't over yet! Not until part12studios understands and implements and is successful! ;)

  • Ok we're going to get this thanks you your great help!

    So starting with your reply yesterday you mentioned to insert some stuff. how do i insert? I know i can drag added events from the bottom up top, but it seems to merge them with whatever they sit next too. Maybe this doesn't matter but it doesn't make sense that the two would be fused.. seems like it would matter if they are connected.

    I'm going to tackle this more tonight when i have some quiet time as this is taking some serious concentration to wrap my head around what is happening when..

    you all rock for helping me through this! :)

  • No worries. Glad you're getting there.

    Here's a fixed version of your capx. I've commented new additions.

    dl.dropbox.com/u/666574/save%20values%20trouble.capx

    Also, can't remember which layout it was - in game, or load - you had the Goto Layout before your code to reset the PlayedBeforeVar, so the reset was never going to work because it would jump to the new layout first.

  • As for merging... you mean the condition you drag, drags it into another condition box?

    Drag from the left of the condition (there's a small blank square before the condition text). This will allow you drag actual events. At least that's what your problem sounds like.

  • I'm back at it today and yea procrastinator i figured the merge/drag issue out.. it was subtle, but now i see how to drag without merging. Awesome!

    Now back to getting values to save.. so close!

  • OK! Got it. I see how to save and call data.. one thing that confused me (simply expecting it to be more user friendly) is when entering things like

    "set variable to yourVariable.LocalValue("PlayedAlready")

    why isn't there some intellisensing going on in this area? its smart enough to drop down when i reach .LocalValue am i missing something here? It would have just been easier to realize this area is in fact designed for strings of data.. not just a number (default is 0)

    thank you everyone for your help! i'm now able to do things like make a reset local data button to help test things.. my mind = wrapped around this =D

    Sincerely,

    Caleb

  • I wish it had intelligent auto-complete but there's always the expressions window that pops up when you're entering values. Double-click on your webstorage object and it shows all the available expressions.

    https://www.scirra.com/manual/59/expressions-panel

  • yea i was able to fix it in the latest version.. and able to reset the local data so i could blank it out.

    thanks for showing the fixed version of it! Great to compare approaches to this solution.

    I didn't realize i could do comments and groups either. Nice incidental lesson :)

    thanks!

    Caleb

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