Problem with creating an addxml trigger inside an alias.

Posted by Umbram on Mon 18 Jun 2007 03:18 AM — 3 posts, 12,682 views.

#0
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")
        ]]
    }
    ]=]
}
Amended on Mon 18 Jun 2007 03:26 AM by Umbram
Australia Forum Administrator #1
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 %.
#2
Wow, thanks! Hours of fruitless debugging and that was all it took. Thanks!