Reset global variables except one?

Discussion and feedback on Construct 2

Post » Sat Oct 10, 2015 12:11 am

Hi!

I want to conserve a global value when i reset all global variables, is possible?. I read that with Webstorage plugin i can save the value, but i dont know how to use.

I need exactly:

When i login in my game, i get id user in a global variable, but when is reset, this value is lose, then i want to save this value still resetting all global variables, to use after.

How can i do that

thanks
B
4
Posts: 50
Reputation: 290

Post » Sat Oct 10, 2015 12:19 am

Use a text object, create an instance variable to keep the user ID. You could also declare your text object global and use it in all your layouts.

Look at this post that talk about this technique: http://www.scirra.com/forum/viewtopic.php?f=146&t=150185
B
15
S
6
Posts: 105
Reputation: 1,356

Post » Sat Oct 10, 2015 12:30 am

You can store the global into a local variable, reset globals, then set it back again from the local variable.
ImageImageImage
B
71
S
22
G
258
Posts: 3,791
Reputation: 143,198

Post » Sat Oct 10, 2015 2:15 am

finally i used webstorage, and store the value here like aux value and works fine.
Thanks for your answers :)
B
4
Posts: 50
Reputation: 290

Post » Sat Oct 10, 2015 9:25 pm

crynof wrote:finally i used webstorage, and store the value here like aux value and works fine.
Thanks for your answers :)


You can use dictionary instead.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
93
S
30
G
22
Posts: 1,987
Reputation: 20,203


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests