Loader image
Loader image
Back to Top
 
New Haven RPG > Mudlet: Aliases – Help Please!

New HavenForumsOtherMudlet: Aliases – Help Please!

Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts

  • Kaiser
    Participant

    What am I doing wrong here:

    Name: Neutralize Grenade
    Pattern: ^ng(.+)$

    Lua Code:
    local target = matches [2]
    send (“Neutralize” .. target)

    > Save Alias, Activate Alias


    Pingpongspiders
    Participant

    matches[2] shouldn’t have a space


    Kaiser
    Participant

    Unfortunately that wasn’t the issue, it wasn’t spaced in the actual lua code, just human error here on the forums.


    Stacy
    Participant

    The issue is that you’re trying to neutralize things. 🙂 (kidding)

    Try:
    Pattern: ^ng(.*)$

    Lua:
    local target = matches [2]
    send (“Neutralize” .. target)

    Notably, I think it was your pattern that was messed up. Using + in the code doesn’t work for matches[2]. It’s better to use * to take everything after the command.

    -Stacy


    Kaiser
    Participant

    That doesn’t register either, and when I drop the .. and target it asks me whom to ng, but doesn’t work in combat. So I don’t know what the hang up is.


    Stacy
    Participant

    Oh right! I tried to shorten it too much.

    Use the pattern I suggested (^ng(.*)$),

    but use this LUA instead:
    ———————————————————————————–
    local maincommand = “neutralize”
    if matches[2] then
    local maincommand = neutralize .. matches[2]
    end
    send(maincommand)
    ———————————————————————————-

    I tested this one and it works on my client. It should respond with needing a target if you type ng alone, and if you type ng <target> it’ll replace it.

    Hopefully this helps.

    – Stacy


    Stacy
    Participant

    (I apparently can’t edit the posts, but just delete the second local after if matches[2] and it’ll work. I manually typed it instead of copying it. Oops!

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.