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
➜ gah--why doesn't this SetVariable bit work?
gah--why doesn't this SetVariable bit work?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| SKYY
(28 posts) Bio
|
Date
| Wed 02 Apr 2008 04:41 PM (UTC) |
Message
| <triggers>
<trigger
enabled="y"
group="ReRoll"
match="^Str: (\d{1,2}) Int: (\d{1,2}) Wis: (\d{1,2}) Dex: (\d{1,2}) Con: (\d{1,2}) Cha: (\d{1,2}) Lck: (\d{1,2})$"
regexp="y"
send_to="10"
sequence="100"
>
<send>/SetVariable("stre",%1)
/SetVariable("inte",%2)
/SetVariable("wisd",%3)
/SetVariable("dext",%4)
/SetVariable("cons",%5)
/SetVariable("char",%6)
/SetVariable("luck",%7)</send>
</trigger>
</triggers>
It works GREAT when I only have one /SetVariable line--it copies the captured number to the appropriate variable. However, as soon as I add a second /SetVariable line, it stops working with an error.
I'm sure I'm doing something absolutely dumb here, so can someone tell me the one character I need to put in the right place to make this trigger work? :p | Top |
|
Posted by
| SKYY
(28 posts) Bio
|
Date
| Reply #1 on Wed 02 Apr 2008 04:59 PM (UTC) |
Message
| GAHH!!! I figured it out. You only need one / to make the execute happen for multiple lines in the 'Send' box.
This works:
<triggers>
<trigger
enabled="y"
group="ReRoll"
lines_to_match="2"
match="^Str: (\d{1,2}) Int: (\d{1,2}) Wis: (\d{1,2}) Dex: (\d{1,2}) Con: (\d{1,2}) Cha: (\d{1,2}) Lck: (\d{1,2})$"
regexp="y"
send_to="10"
sequence="100"
>
<send>/SetVariable("stre",%1)
SetVariable("inte",%2)
SetVariable("inte",%2)
SetVariable("wisd",%3)
SetVariable("dext",%4)
SetVariable("cons",%5)
SetVariable("char",%6)
SetVariable("luck",%7)</send>
</trigger>
</triggers>
| Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 02 Apr 2008 07:56 PM (UTC) |
Message
| Rather than "send to: execute" you are better off doing "send to: script" then you can omit the slash altogether.
Your method relies on the scripting prefix being a slash, and if you ever change it, the trigger will stop working. Using "send to script" will always work. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| SKYY
(28 posts) Bio
|
Date
| Reply #3 on Thu 03 Apr 2008 05:52 AM (UTC) |
Message
| In order to send to script, don't I have to have a script file somewhere? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Thu 03 Apr 2008 06:14 AM (UTC) |
Message
| No, it just sends the contents of the Send box to the script engine. The only prerequisite is that scripting be enabled (which it needed to be anyway for the way you did it).
The script file is only needed if you put a function name in the Script box - in which case it looks for a function by that name in the script file. |
- 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.
13,623 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top