Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
I have a question , I noticed that when I use a variable to count the score of clicks of different objects . The value of the score that uses variable whether it was a global or a local variable maintain its value of the score that has reached and continues to count from that point even when I close and re-open the app and I reset the variable value to 0 with code (put 0 into _gScorePlayer ) for example when a user reaches score 15 and closes the app , next time the score continues from 15 and so on
I am a beginner in livecode
Thanks fro your continues help and support guys
A variable should clear its value when you QUIT LiveCode; if you only CLOSE the stack
the variable may remain in the computer's memory: and, if you REOPEN the stack
before QUITTING LiveCode what you describe may happen.
richmond62 wrote: Tue May 12, 2020 9:14 pm
A variable should clear its value when you QUIT LiveCode; if you only CLOSE the stack
the variable may remain in the computer's memory: and, if you REOPEN the stack
before QUITTING LiveCode what you describe may happen.
Ok thank you
I will make sure that I close/exit the entire livecode program then re-open my app again
Read about the "closeStack" message, which you can use here. That message is sent regardless of whether you close the stack or quit LiveCode entirely. Create a handler that resets the counter (pseudo):
Read about the "closeStack" message, which you can use here. That message is sent regardless of whether you close the stack or quit LiveCode entirely. Create a handler that resets the counter (pseudo):
Not sure to understand, but in case what you called your app
is a stack you're executing in the IDE, then you have nothing to do except
uncheck "Variable Preservation" in the IDE Preferences:
HTH,
Thierry
! SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!
Another way is to set the destroystack of the stack to true. You can do that in the property inspector. Then when you close the stack, everything is removed from memory including all variable values (except global variables, which is why I don't use them.) You don't need any code with this method.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
The stack script is the place for such things. But here is homework for you.
Would it also work in the card script? What if your stack had more than one card? Why do I ask these sorts of things?
Craig
Thank you for your help
I think with my very little experience , it would work but not if I had more than just one card as you mentioned
And you are telling me this you to help me think more about it , maybe
I think with my very little experience , it would work but not if I had more than just one card as you mentioned
And you are telling me this you to help me think more about it , maybe
I was wondering if you were the type of person who would make a test stack with a few small handlers and try it.
I find doing such things indispensable, whether for small gadgets like the one you brought up, or tests within a large project to prove or disprove one idea or another. I make these sorts of things all day. I do it for fun.