[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Triggers

Triggers

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Hoss   USA  (48 posts)  [Biography] 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
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Hoss   USA  (48 posts)  [Biography] 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
[Go to top] top

Posted by Hoss   USA  (48 posts)  [Biography] 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?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Hoss   USA  (48 posts)  [Biography] 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
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Hoss   USA  (48 posts)  [Biography] 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 &quot;p&quot;
world.SetVariable &quot;ratcount&quot;, Cint(getvariable(&quot;ratcount&quot;)) +1

</send>
</trigger>
</triggers>

But it went off some 30 times any ideas why?
[Go to top] top

Posted by Hoss   USA  (48 posts)  [Biography] 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?
[Go to top] top

Posted by Somegirl   (33 posts)  [Biography] 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.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Hoss   USA  (48 posts)  [Biography] bio
Date Reply #11 on Sat 20 Nov 2004 08:27 PM (UTC)
Message
Thank you!

Hoss
[Go to top] 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,185 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] 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.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]