Help with a simple matching/printing

Posted by Deramius on Sun 27 Apr 2014 09:29 PM — 2 posts, 12,225 views.

#0
I am trying to get a handle on how the scripting features of MUSHclient work and need some help.

What I want to do is this: whenever I look around I want to capture the available exits via a trigger. I think want to enumerate through those triggers with a script and print each of them to my screen (but not to the world).

Here is what I have:

Trigger:
<triggers>
<trigger
enabled="y"
group="Exits"
match="(!?exits).*(north|south|east|west)"
match_text_colour="y"
name="test_trigger"
regexp="y"
script="print_exits"
send_to="12"
sequence="100"
text_colour="10"
>
<send>"%0"</send>
</trigger>
</triggers>

Script:
function print_exits(name, line, wildcards)
print("You can go %wildcards[1]")
end

I've tried tweaking this in several ways, and I always receive an error message similar to this:

Compile error
World: Discworld
Immediate execution
[string "Trigger: test_trigger"]:1: unexpected symbol near '"exits: west and north"'
You can move: %wildcards[0]

Can someone please help?
Australia Forum Administrator #1
Template:faq=32
Please read the MUSHclient FAQ - point 32.


This line in particular is wrong:


 print("You can go %wildcards[1]")


Maybe:



 print("You can go " .. wildcards[1])