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
➜ percentage calculating
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Blackmamba
(4 posts) Bio
|
Date
| Sun 29 Apr 2018 05:46 PM (UTC) |
Message
| so i have
^(\w+)\'s mana stands at (\d+)\/(\d+)\.$
to send
if math.floor (%2/%3 * 100) < 50 then
Send("slap @target")
end
sending to the script with expand variables box checked and regular expression checked
However nothing is firing ...what is wrong with my code | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 29 Apr 2018 08:49 PM (UTC) |
Message
| First, please post the whole trigger, as described here:
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
Second, please copy and paste a line from the MUD that you think should fire the trigger.
Thanks. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Blackmamba
(4 posts) Bio
|
Date
| Reply #2 on Sun 29 Apr 2018 09:22 PM (UTC) Amended on Sun 29 Apr 2018 10:48 PM (UTC) by Nick Gammon
|
Message
|
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="bodyscan"
match="^(\w+)\'s mana stands at (\d+)\/(\d+)\.$"
name="crown_contemplate"
regexp="y"
send_to="12"
sequence="100"
>
<send>if math.floor (%2/%3 * 100) < 50 then
Send("slap @target")
end
</send>
</trigger>
</triggers>
command: contemplate Jack
output:
Jack's mana stands at 9250/9300. 99.462365591398
Jack is operating in normal time.
Jack is not insane.
I would like the trigger to fire off the first line (Jack's mana stands at 9250/9300.) | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 29 Apr 2018 10:52 PM (UTC) |
Message
| The line from the MUD is:
Jack's mana stands at 9250/9300. 99.462365591398
It ends in 99.462365591398 which you haven't allowed for in the trigger.
If you omit the final "$" it will match. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Blackmamba
(4 posts) Bio
|
Date
| Reply #4 on Sun 29 Apr 2018 11:50 PM (UTC) Amended on Mon 30 Apr 2018 01:15 AM (UTC) by Blackmamba
|
Message
|
Nick Gammon said:
The line from the MUD is:
Jack's mana stands at 9250/9300. 99.462365591398
It ends in 99.462365591398 which you haven't allowed for in the trigger.
If you omit the final "$" it will match.
The 99.462365591398 is an echo from the script, not from the game itself. Does that change anything?
And what boxes on the right should I be checking?
This might better explain the situation:https://pasteboard.co/HiW2j6n.png | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Mon 30 Apr 2018 05:20 AM (UTC) |
Message
|
Blackmamba said:
The 99.462365591398 is an echo from the script, not from the game itself. Does that change anything?
I need to see exactly what arrives from the MUD, to judge whether or not the trigger matches. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #6 on Mon 30 Apr 2018 05:36 AM (UTC) |
Message
|
Jack's mana stands at 9250/9300. 99.462365591398
In this particular case, of course, he doesn't have less than 50% mana. If you edit the trigger you can see how many times it has fired. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #7 on Mon 30 Apr 2018 06:21 AM (UTC) |
Message
|
Blackmamba said:
The 99.462365591398 is an echo from the script, not from the game itself. Does that change anything?
As a general rule, triggers don't match lines which are from a script. So your statement that it is an echo from a script (and your script doesn't echo anything) means there is more here than meets the eye. |
- 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.
17,629 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top