Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ Timer problems with variables
Timer problems with variables
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Neverwhere
USA (40 posts) Bio
|
Date
| Mon 18 Nov 2002 03:43 PM (UTC) |
Message
| 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 |
ChaosMUD: chaosmud.org:23
Always looking for new players/coders. Willing to train if your willing to lear. Contact Neverwhere or just mention that I sent you. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 18 Nov 2002 10:29 PM (UTC) |
Message
| I don't understand this line:
Elapsed = DateDiff("s", AuraTime, CurrentTime)
What is AuraTime? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Neverwhere
USA (40 posts) Bio
|
Date
| Reply #2 on Tue 19 Nov 2002 12:42 PM (UTC) Amended on Tue 19 Nov 2002 01:23 PM (UTC) by Neverwhere
|
Message
| 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 |
ChaosMUD: chaosmud.org:23
Always looking for new players/coders. Willing to train if your willing to lear. Contact Neverwhere or just mention that I sent you. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #3 on Tue 19 Nov 2002 02:14 PM (UTC) |
Message
| dunno about the rest of that stuff, but yes,
world.ResetTimer "timername"
is the correct syntax. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #4 on Wed 20 Nov 2002 07:57 AM (UTC) |
Message
| 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
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
15,705 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top