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
➜ Trigger problem
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Stormy
(1 post) Bio
|
Date
| Fri 30 Apr 2004 08:50 AM (UTC) |
Message
| Hi there,
Got a bit of a problem. I'm trying to make a trigger to show experience gain/loss in RetroMUD. the status bar ingame, which shows after each time you enter a command or simply hit enter, shows in the format:
Hp: 584/584 Sp: 1223/1223 Ep: 280/280 Gold: 212 Exp: 1166950 >
/world.debug "triggers" shows:
{{Hp: * Sp: * Ep: * Gold: * Exp: * >}}={{%5}} label=iworldexp script=expgained colour=1 send_to:variable seq:100
and the expgained script is:
sub expgained (thename, theoutput, thewildcards)
dim iNewexp
dim iOldexp
dim iDiff
iOldExp=world.GetVariable("ioldexp")
iNewExp=world.GetVariable("iworldexp")
if iNewexp > iOldexp then
iDiff=iNewexp-iOldexp
world.note "Exp gained : " & cstr (iDiff)
end if
if iNewexp < iOldexp then
iDiff=iOldexp-iNewexp
world.note "Exp lost : " & cstr (iDiff)
end if
if iNewexp=iOldexp then
world.note "No exp change"
end if
World.SetVariable "ioldexp", iNewexp
end sub
/world.debug "variables" :
iworldexp = 1166950
ioldexp = 1166950
Can anyone see what I'm missing? It just doesn't want to work :(
Thanks! | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Fri 30 Apr 2004 09:35 AM (UTC) Amended on Sat 01 May 2004 06:38 PM (UTC) by Flannel
|
Message
| Why are you sending to variable? You can just get it from the wildcards.
Anyway, you might be better off declaring outside of your sub, and then not storing the oldxp in an MC variable, just use a VBscript. Itll stay as long as you dont need to reset your script. And even then, itll only last for one promt, then itll get re-written. Itll save you a lot of time for your script, and since this happens a lot, it might make a difference.
<wrong>
For your if statement, you need to have a double equals sign (==) (since its logical). </wrong> (No, Its not, I was just being weird and staying in C (actually, I think it was TIBasic), pay no attention to the man behind the curtain)
This is assuming your trigger matches. Theres plenty of problems associated with matching a prompt, search the forums for a bunch of threads on it. You might be fine if you simply add a spot for other stuff at the end of your prompt (see other threads for more details). This MIGHT require you to convert your trigger to a regexp.
To see if your trigger is matching all the time, you can turn trace on. This way you can see if your problem is in the trigger, or the script, for any given time.
Also, for future reference, copy/paste your trigger/alias/whatever rather than doing the debug thing. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #2 on Sat 01 May 2004 12:41 PM (UTC) |
Message
| Actually, VBScript doesn't use the == operator, = is right. And yes, it would be better if instead of sending to a variable you used a scripting variable. If you need to save the script with its variables, you could try SetVariable to do it from within the script. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | 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.
11,935 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top