Page 1 of 1

avoid losing data

Posted: Thu May 20, 2010 12:53 am
by greggarcia
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

Re: avoid losing data

Posted: Thu May 20, 2010 9:34 am
by Mark
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

Code: Select all

field "3sec"
with a complete reference to that field. I don't know what this reference looks like exactly, but it should be something like

Code: Select all

field "3sec" of cd "Correct Card" of stack "Your Stack"
Another solution is to prevent the script from running if the short name of the card is incorrect:

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
Best regards,

Mark

P.S. Please, make sure to post any error messages next time.

Re: avoid losing data

Posted: Thu May 20, 2010 6:20 pm
by Regulae
Hi Greg,

Here’s a quick stack which might be in the right direction for you.

Regards,

Michael

Re: avoid losing data

Posted: Mon May 24, 2010 11:44 pm
by greggarcia
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