Timer problems with variables

Posted by Neverwhere on Mon 18 Nov 2002 03:43 PM — 5 posts, 21,018 views.

USA #0
ok... when i execute an alias called "doprots" it calls the script OnDoProts which looks like this:

Sub OnDoProts(strAliasName, strOutput, arrWildCards)
Dim CurrentTime, Elapsed
CurrentTime = Now()
Elapsed = DateDiff("s", AuraTime, CurrentTime)
aura = Elapsed
Elapsed = DateDiff("s", GrapTime, CurrentTime)
graptime = Elapsed
greater = world.getvariable ("greater")
World.Send "ps IW [on] for " & aura & "s, Greater ["&greater&"] for "&graptime&"s"
End Sub

When that is done, the last timer that was checked (if one of them is NOT active) automatically adds 3246777681 to the current value of it. Is there a way to make it so that it doesnt add the value to it or am I just doing something wrong?

Neverwhere
Australia Forum Administrator #1
I don't understand this line:

Elapsed = DateDiff("s", AuraTime, CurrentTime)

What is AuraTime?
USA #2
Well, AuraTime is a global defined variable name. Its called when a subscript is run via a trigger call. Im just wondering howto set the variables to 0 when they havent been called. Does one simply put AuraTime = 0 at the beginning of the script? Or must we use something similar to Sub Form_Load?

Also, whats the command to reset a certain timer? i.e. World.ResetTimer "XXX"

Neverwhere
Amended on Tue 19 Nov 2002 01:23 PM by Neverwhere
USA #3
dunno about the rest of that stuff, but yes,
world.ResetTimer "timername"
is the correct syntax.
Australia Forum Administrator #4
You can put global commands outside any function and they will be executed when the script loads. eg.

dim myvariable

myvariable = 0

sub blah (a, b, c)

' blah blah

end sub