This is basically a timer, which i didn't know Livecode had "built in" ones until well into my project. Regardless, gStart comes from the openCard script. This code is in a button called "time2". The problem is that each time "button time2" is pushed the time is subtracted from the gStart. The first time is correct, but after that the time should be subtracted from the line above it, not gStart. it's probably some simple math that i'm horrible at, but i've tried many, many different ways to fix this and can't find the answer. Any help is appreciated.
Code: Select all
repeat with x = 1 to the number of lines in fld "pick2"
if the hilitedline of fld "pick2" is x then
if item 2 of line x in fld "pick2" is empty then
put the time into tTime
put tTime into item 2 of line x of fld "pick2"
convert tTime to seconds
put tTime - gStart into sDiff
add sDiff to fld "daysRun2" --
put formatTime(sDiff) into item 3 of line x of fld "pick2"
put 1 into item 4 of line x of fld "pick2"
end if
end if
end repeat
Larry