Hello, i have a code like this in one card:
on Temporizador
add 1 to tsec3
if tsec3 < 60 then
if tsec3 <= 9 then
put "0" & tsec3 into field "3sec"
else
put ":" && tsec3 into field "3sec"
end if
else
if tsec3 =60 then
put "00" into field "3sec"
end if
put "0" into tsec3
add 1 to tmin3
if tmin3 <=9 then
put "0" & tmin3 into field "3min"
else
put tmin3 into field "3min"
end if
end if
if gparat3 is 0 then
send "Timer1" to me in 1 second
end if
end Temporizador
if i moved to another card i got an error message and the timer stop to counting, do you know how to avoid it? well a solution was putting a the same field name in the othe card (but a thinks is not the way to do it)
thanks so much
Greg
avoid losing data
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 33
- Joined: Mon Apr 27, 2009 3:32 pm
- Contact:
Re: avoid losing data
Hi Greg,
As far as I can see, it is impossible to go to another card while your script runs (because it is a blocking script). From this, I conclude that you run the script while it shouldn't or the script contains an incorrect reference to objects. There are two solutions.
First of all, you can replace with a complete reference to that field. I don't know what this reference looks like exactly, but it should be something like
Another solution is to prevent the script from running if the short name of the card is incorrect:
Best regards,
Mark
P.S. Please, make sure to post any error messages next time.
As far as I can see, it is impossible to go to another card while your script runs (because it is a blocking script). From this, I conclude that you run the script while it shouldn't or the script contains an incorrect reference to objects. There are two solutions.
First of all, you can replace
Code: Select all
field "3sec"
Code: Select all
field "3sec" of cd "Correct Card" of stack "Your Stack"
Code: Select all
on Temporizador
if the short name of this cd is "Correct Card" then
-- remainder of your script here
end if
end Temporizador
Mark
P.S. Please, make sure to post any error messages next time.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: avoid losing data
Hi Greg,
Here’s a quick stack which might be in the right direction for you.
Regards,
Michael
Here’s a quick stack which might be in the right direction for you.
Regards,
Michael
- Attachments
-
- TimerTest.zip
- (2.59 KiB) Downloaded 279 times
-
- Posts: 33
- Joined: Mon Apr 27, 2009 3:32 pm
- Contact:
Re: avoid losing data
Mark I appreciate your kind answer, thanks so much, now is working property and i can understand how runrev is working little by little... best regards... Greg