Gammon Forum
Entire forum
MUSHclient
General
Triggers
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Fri 19 Nov 2004 03:06 PM (UTC) |
Message
| I'm working on some triggers that will match on a few different things
What I'm trying to match on is:
A baby rat wanders into view, nosing about for food.
And
A rat wanders into view, nosing about for food.
So far I have: ^A(* rat| rat) noses its $
Any ideas?
Hoss
| top |
|
Posted by
| Flannel
USA (1,230 posts) bio
|
Date
| Reply #1 on Fri 19 Nov 2004 06:18 PM (UTC) |
Message
| You're mixing Regexp with normal triggers, * isnt a wildcard, its a quantifier (in regexp).
^A (baby )?rat wanders into view\, nosing about for food\.$
Should do you (thats a Regexp).
Why were you trying to match on 'noses its'? that isn't in the line you gave. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | top |
|
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Reply #2 on Fri 19 Nov 2004 08:26 PM (UTC) |
Message
| No I wasn't trying to that was just human error :( Otherwise Thanks | top |
|
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Reply #3 on Fri 19 Nov 2004 08:30 PM (UTC) |
Message
| Is it also possible to put a wildcard so it'll match on baby rat and even old rat? | top |
|
Posted by
| Flannel
USA (1,230 posts) bio
|
Date
| Reply #4 on Fri 19 Nov 2004 08:46 PM (UTC) |
Message
| ^An? (baby |old )?rat wanders into view\, nosing about for food\.$
will match on baby, or old (which will be An old rat)
If you want to match on ANY kind of rat...
^An? (.*)?rat wanders into view\, nosing about for food\.$
will work for you.
|
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | top |
|
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Reply #5 on Fri 19 Nov 2004 09:28 PM (UTC) |
Message
| while we are at it is there anyway to take a variable and subtract something from it? But using triggers? for example something like:
variable=variable-1
Hoss | top |
|
Posted by
| Flannel
USA (1,230 posts) bio
|
Date
| Reply #6 on Fri 19 Nov 2004 09:35 PM (UTC) |
Message
| Thats exactly right, well, if you had the variable in the trigger already.
If youre just manipulating a variable you need to get the variable, and then set it again.
Setvariable "variable", Cint(getvariable("variable")) - 1
the Cint is to make sure the script engine knows its a number. It really isnt required for most things. But can cause some interesting problems.
And that gets sent to script (send to: script) |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | top |
|
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Reply #7 on Fri 19 Nov 2004 09:54 PM (UTC) |
Message
| WOW I was using what you send, and heres what the trigger looks like
<triggers>
<trigger
enabled="y"
group="ratter"
ignore_case="y"
match="^Your eyes are drawn to (a|an) (baby rat|rat|old rat|black rat|young rat) that darts suddenly into view\.$"
regexp="y"
send_to="12"
sequence="100"
>
<send>world.send "p"
world.SetVariable "ratcount", Cint(getvariable("ratcount")) +1
</send>
</trigger>
</triggers>
But it went off some 30 times any ideas why? | top |
|
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Reply #8 on Sat 20 Nov 2004 03:44 AM (UTC) |
Message
| Nevermind about the problem in the before reply I figured out what was wrong I had merly forgotten to assign a value to the variable before hand so it didn't work but I have another question I wanted to run a sort if than statement, and I was wondering if I could run that off a trigger or if I would need to do some scripting for it?
| top |
|
Posted by
| Somegirl
(33 posts) bio
|
Date
| Reply #9 on Sat 20 Nov 2004 05:06 AM (UTC) |
Message
| It's technically scripting, but you can put an if/then routine directly in your trigger's send field. You just need to make sure that you have the trigger set to 'send to script' and have your scripting enabled. | top |
|
Posted by
| Flannel
USA (1,230 posts) bio
|
Date
| Reply #10 on Sat 20 Nov 2004 07:18 AM (UTC) |
Message
| What you were doing before (with the send, and setvariable) was already scripting. That chunk of code gets sent to the script engine, and then it gets treated as a normal script.
So you can code whatever (anything in the script language) and stick it in the send box.
So if you dont know how to do that in VBScript, download the help file (its on the same page that you can download VBScript from) and look it up. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | top |
|
Posted by
| Hoss
USA (48 posts) bio
|
Date
| Reply #11 on Sat 20 Nov 2004 08:27 PM (UTC) |
Message
| Thank you!
Hoss | 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.
22,043 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.