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
➜ Lua
➜ Problem with creating an addxml trigger inside an alias.
|
Problem with creating an addxml trigger inside an alias.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Umbram
(2 posts) Bio
|
| Date
| Mon 18 Jun 2007 03:18 AM (UTC) Amended on Mon 18 Jun 2007 03:26 AM (UTC) by Umbram
|
| Message
| I'm wondering if there is any way around this problem, other than changing my coding structure:
This is just sample code of what I'm trying to do. I'm trying to make an alias that creates a trigger. The unexpected problem I've run into is that the %0 inside the trigger returns the match for the alias (in this case "test", not the internal trigger (in this case whatever line the mud sends). This code is obviously useless, but it demonstrates my problem - how can I get %0 int the internal addxml.trigger to refer to the matched text of the trigger and not the alias? I apologize if this has been addressed elsewhere.
addxml.alias {
name = 'my_alias',
match = "test",
enabled = true,
ignore_case = true,
regexp = false,
send_to = 12,
send = [=[
addxml.trigger {
match = ".*",
name = "my_trigger",
enabled = true,
regexp = true,
send_to = 12,
send = [[
Note("%0")
]]
}
]=]
} | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 18 Jun 2007 03:36 AM (UTC) |
| Message
| In the alias, double the % to %%, like this:
Note("%%0")
In processing the alias, the doubled %% becomes a single % inside the script, and then the script works properly.
Or, rather than doing "send to script", call a function in your script file (if you have one). Functions in the script file do not attach any special meaning to %. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Umbram
(2 posts) Bio
|
| Date
| Reply #2 on Mon 18 Jun 2007 03:53 AM (UTC) |
| Message
| | Wow, thanks! Hours of fruitless debugging and that was all it took. Thanks! | | 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.
12,438 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top