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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Small If statement help
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Sparafucile
(9 posts) Bio
|
Date
| Fri 09 Dec 2005 06:37 PM (UTC) |
Message
| Hey, small question. I want to make a trigger that reads a number off in my prompt and compares it to another number, and then performs a command accordingly. ie,
If "hp" < 1000 then
(do some command)
end if
I tried putting <*hp *mp *mv *Exp to Level> (my prompt) in the trigger box, and this in the send box:
If %1 < 1000 then
(some command)
End if.
Didn't work, evidently. Thanks in advance! | Top |
|
Posted by
| Zeno
USA (2,871 posts) Bio
|
Date
| Reply #1 on Fri 09 Dec 2005 06:57 PM (UTC) |
Message
| Make sure that the trigger is correct and is matching on the prompt. If it is, then using %1 should work. Unless HP is formatted with commas? |
Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Fri 09 Dec 2005 11:47 PM (UTC) |
Message
| That should work. Can you copy the actual trigger rather than retyping? End If does not have a period after it, for instance.
Can you give the error message? "Didn't work" doesn't tell us much. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Sparafucile
(9 posts) Bio
|
Date
| Reply #3 on Sat 10 Dec 2005 11:51 PM (UTC) |
Message
| Alright, basically, this is the trigger I did (copied and pasted as it appears in the trigger):
Trigger box: <*hp *mp *mv *Exp to Level>
Send box:
if %1 < 1000 then
tell sparafucile Your alt is dying!
End If
I basically coppied my prompt exactly as it appears in the mud, except I replaced the numbers with *. I tried checking the Regular Expression on and off, but neither worked. And there's no error message: it just does nothing.
I know its a pretty silly trigger, since it'll just keep spamming me with tells from myself, but I don't want the alt dying :P | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #4 on Sun 11 Dec 2005 12:53 AM (UTC) |
Message
| You need to change the "send to" dropdown menu to script.
and then your second line needs to be:
send "tell sparafucile Your alt is dying!"
You can also copy WHOLE triggers, from the triggers dialog (the one with the list of all triggers) highlight the trigger and click 'copy' then paste the text here. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Sparafucile
(9 posts) Bio
|
Date
| Reply #5 on Sun 11 Dec 2005 02:24 AM (UTC) Amended on Sun 11 Dec 2005 07:32 AM (UTC) by Nick Gammon
|
Message
| Oh cool. Ok, so I copied it and this is what I have now, after changing it to script and that jazz. Still didn't work.
<triggers>
<trigger
enabled="y"
match="<*hp *mp *mv *Exp to Level>"
send_to="12"
sequence="100"
>
<send>If %1 < 6000 then
send "tell sparafucile Urwendi is dying!"
End If</send>
</trigger>
</triggers>
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Sun 11 Dec 2005 07:19 AM (UTC) Amended on Sun 11 Dec 2005 07:33 AM (UTC) by Nick Gammon
|
Message
| OK, now can you post some example output? What the MUD sends you? I presume you have scripting turned on? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Sparafucile
(9 posts) Bio
|
Date
| Reply #7 on Sun 11 Dec 2005 09:23 PM (UTC) Amended on Sun 11 Dec 2005 09:35 PM (UTC) by Sparafucile
|
Message
| If you mean the enable script checkbox in the Scripting>Scripts window, then yes, it's checked on. The scripting language is set to VBscript, if that helps.
Here's a sample output:
[Obvious Exits: north east northeast (southwest)]
A Wooden Bench sits at the edge of the Plaza.
<5000hp 50mp 498mv 586Exp to Level>
Again, MUSH gives me no error messages or anything, it just keeps going as if the trigger did not exist. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #8 on Sun 11 Dec 2005 11:42 PM (UTC) |
Message
| That output works for me. Look carefully to make sure there isn't something after the > symbol, such as a space.
Triggers are rather literal, they have to match exactly.
You could try matching on:
<*hp *mp *mv *Exp to Level>*
That extra asterisk will catch any other stuff at the end of the line. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Sparafucile
(9 posts) Bio
|
Date
| Reply #9 on Mon 12 Dec 2005 04:26 PM (UTC) |
Message
| Haha, that's so strange. That did it. There was indeed a space at the end of the prompt. I also had to uncheck the regular expression box. Thanks everyone :) | 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.
27,438 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top