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
➜ what am i doing wrong here..
what am i doing wrong here..
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Guest1
USA (256 posts) |
Date
| Wed 21 Aug 2002 03:41 PM (UTC) |
Message
| this is further to this thread:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=1661
the script there worked, but not always correctly because it could fire at the wrong time depending on when the spell was cast initially (when cast right before a tick caused the message to fire just after the spell had fallen), so I have done a new one that is far more accurate, however I'm getting 2 script errors that say:
Wrong number of arguements for script subroutine "aegis_warn" when processing timer "aegistimerB"
We expected your subroutine to have 1 arguement
and
Wrong number of arguements for script subroutine "aegis_counter" when processing timer "aegistimerA"
We expected your subroutine to have 1 arguement
I know it's something really basic I've messed up in the syntax, but here is what I have..
I have 2 variables named:
aegis
aegislength
the aegislength variable is a constant as I know the aegis spell lasts a maximum of 5 ticks (or if you cast it right at the end of a tick, then it lasts 4 ticks plus a few seconds, which caused the problem with the original script)
when I cast the spell, a trigger is fired called aegis_activated:
sub aegis_activated (thename, theoutput, thewildcards)
dim aegisval
aegisval = World.GetVariable ("aegislength")
World.SetVariable "aegis", aegisval
end sub
..that's works fine. (The reason for aegislength being variable is that sometimes in a group I will have someone else casting aegis spells on me, and their aegis length may be up to 7 ticks long). Next I have 2 timers named aegistimerA and aegistimerB.
The aegistimerA fires on every tick with no offset, and calls a script named aegis_counter.
The aegistimerB fires on every tick with an offset of 25 seconds, and call a script named aegis_warn.
These are the scripts (subroutines) that are being called:
sub aegis_counter (thename, theoutput, thewildcards)
dim aegis
dim aegisnew
aegis = World.GetVariable ("aegis")
aegisnew = aegis - 1
if aegis > 0 then
World.SetVariable "aegis", aegisnew
end if
end sub
Effectively, this is counting down the ticks left on the spell until it gets to 0. Here's the other subroutine:
sub aegis_warn (thename, theoutput, thewildcards)
dim aegisvalue
aegisvalue = World.GetVariable ("aegis")
if aegisvalue = 1 then
World.send "grouptell aegis falling on tick"
end if
end sub
All this one is doing is 25 seconds before a tick is due, it looks at the variable 'aegis' and warns me that the spell is about to drop if the value of 'aegis' is 1 (1 tick left)..
This all seems fairly logical to me, and I'm guessing the errors thrown are something to do with the syntax used.. can you point me in the right direction?
Oh, if it makes any difference, both timers are reset periodically by MUD messages that appear on ticks, so they dont get out of synch.
As an afterthought, I vaguely remember something about vbs not recognising 0 as a value.. would that be it?
Look forward to your reply. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #1 on Wed 21 Aug 2002 06:53 PM (UTC) |
Message
| hmm.. ok, figured out what the syntax error was..
(thename, theoutput, thewildcards)
should just be
(the name)
fixed that, but the timers being reset periodically by MUD messages that appear on some ticks seem to make them miss subtracting a tick just for that particular timer reset.. so I've changed it so that when the spell actually falls (and the MUD generates a message saying it fell), I'm using that message as a trigger to reset the 2 timers aegistimerA and aegistimerB.. hopefully this will stop anything interfereing with them while they are actually counting down..
tested it, and ok it's giving the warning (grouptell) that the spell is about to fall about 25 seconds before it actually does fall which is exactly what I wanted, BUT it's giving the warning message again AFTER it falls on the following tick as well.. why? I'm confused. ..ahh.. it's because the 'spell down' message resets the timer and it misses counting down to 0 and stays at 1 for one more tick..
hmm.. I'll try the using MUD generated 'spell fallen' message to also set the 'aegis' variable to 0 as well.. that should fix it..
testing..
woohoo! ok.. well maybe these spam helps someone :) | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 28 Aug 2002 12:30 AM (UTC) |
Message
|
Quote:
BUT it's giving the warning message again AFTER it falls on the following tick as well.. why? I'm confused.
Maybe you need a one-shot timer? |
- 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.
10,873 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top