How do I save global variable values?

Get help using Construct 2

Post » Sat May 09, 2015 11:57 am

miketolsa wrote:
LittleStain wrote:Using local storage is the easiest way and should work something like this:

local storage set Item key = "PlayerCoins" value = (the name of your GlobalVariable)

on start of layout - local storage get Item "Playercoins"

on item get "Playercoins" - set GlobalVariable = int(localstorage.itemvalue)


Thanks for quick refrence that helped me a lot .....

so is playercoin a variable or integer or key ? as you want to set the global variable score to it am i right ?

So if possible could you just report the same code using the table reference if possible as it would help me to understand much easily .

also I think this two statement should be called in start of the layout .....

local storage set Item key = "PlayerCoins" value = (the name of your GlobalVariable)

local storage get Item "Playercoins"

so is it necessary to call them randomly or just in a order to get the value of globalvariable to key playercoin ?


I made an example here. Just download it from my dropbox account ;)
https://www.dropbox.com/s/iz8cvjw86vfh8mm/local_storage_playercoins.capx?dl=0

This should answer your questions
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Post » Sat May 09, 2015 12:30 pm

I made a tutorial for LocalStorage ;)

https://www.scirra.com/tutorials/1461/h ... age-plugin
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Post » Sat May 09, 2015 12:31 pm

Thanks that really help me to sort out my problem & confusion tooo !!!
Image
B
36
S
13
G
1
Posts: 99
Reputation: 3,051

Post » Sat May 09, 2015 12:36 pm

miketolsa wrote:Thanks that really help me to sort out my problem & confusion tooo !!!

Glad to hear that :) You're welcome!
Image Image iTunes: Match3 | Google Play: Match3
B
98
S
33
G
30
Posts: 1,117
Reputation: 27,791

Previous

Return to How do I....?

Who is online

Users browsing this forum: marcinkowski, plinkie, zenox98 and 19 guests