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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  Programming
. -> [Folder]  General
. . -> [Subject]  multi line trigger to open doors in Aardwolf

multi line trigger to open doors in Aardwolf

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


Posted by Kenneth   (18 posts)  [Biography] bio
Date Thu 13 Mar 2008 05:08 AM (UTC)
Message
Hello, I need some assistance making a trigger to open doors in the mud "Aardwolf".

Please be advised that I am new to MUDs and to MUSHclient and have no knowledge of programming or anything of that sort.

When I type west to go to a door in the west, for example, the MUD says:

west <---on the first line, and
The door is closed. <---on the second line

It's displaying west on the first line because I typed "west" and "The door is closed." on the second line to tell me the that the door is closed. I'll likely need to set a trigger to open a door in the directions: up, down, north, east, south, and west. If anyone can help me, please be as specific as possible in your instructions. I really don't know what i'm doing and this is all very confusing. Thanks for any help that anyone is able to give me.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 13 Mar 2008 09:20 AM (UTC)

Amended on Thu 13 Mar 2008 09:21 AM (UTC) by Nick Gammon

Message
Can you clarify?

Does the MUD really say "west" on the first line? Or is this something you typed?

This might seem like a minor point, but triggers match on what the MUD sends, not on what you type. There are ways of dealing with that, but I wanted to be sure.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kenneth   (18 posts)  [Biography] bio
Date Reply #2 on Thu 13 Mar 2008 12:46 PM (UTC)
Message
No, west only appears because i type it. BUT, I'm assuming I'll need it to tell the trigger in which direction to use the open command, such as: "open n" for north "open e" for east, etc. Unless there's some way for MUSHclient to guess the direction of the door. Thanks, and I'll be checking this forum again tomorrow, as I have to go to bed for work tonite (third-shift).
[Go to top] top

Posted by StuDraKi   Germany  (17 posts)  [Biography] bio
Date Reply #3 on Thu 13 Mar 2008 06:40 PM (UTC)

Amended on Thu 13 Mar 2008 06:46 PM (UTC) by StuDraKi

Message
There is a way to display your input: menu "file->World preferences" then choose "input->Commands" and at the top there is "Echo my Input in (colour)" If it's ticked and a colour selected you may distinguish mud messages from your input lines.

Apart from that I see a way to avoid multiline triggers (Well, true, I don't like multi line triggers ;-)
You can define an alias to catch your direction into a variable and you trigger only the error message line and deal with it.

Here is the alias: (send_to 9 is variable)
<alias
   match="^(n|ne|e|se|s|sw|w|nw|up|down)$"
   enabled="y"
   variable="LAST_DIRECTION"
   regexp="y"
   send_to="9"
   sequence="100"
  >
  <send>%1</send>
</alias>

And here is the trigger: (send_to 8 is world speedwalk delay)
<trigger
   enabled="y"
   expand_variables="y"
   match="The door is closed."
   send_to="8"
   sequence="100"
  >
  <send>open @LAST_DIRECTION
  </send>
</trigger>


[EDIT] Ah, I didn't test this, maybe the alias needs to send something also to the world, but I don't know how to do that without a script, maybe someone else can take over?
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 13 Mar 2008 08:32 PM (UTC)
Message
Yes, it is easier to remember your last direction with an alias, and StuDraKi is right - you also need to send that direction to the MUD or it will remember it, but not actually go there, like this:


<aliases>
  <alias
   match="^(n|ne|e|se|s|sw|w|nw|up|down)$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetVariable ("last_direction", "%1")
Send ("%1")
</send>
  </alias>
</aliases>


That small piece of script in the alias remembers the direction in the variable "last_direction" and also goes there.

Now in the trigger you could open the door *and* try to go through it:


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="The door is closed."
   send_to="8"
   sequence="100"
  >
  <send>open @last_direction
@last_direction
  </send>
  </trigger>
</triggers>



This idea won't work however if you use speedwalks, as the alias is matching a single direction, not what a speedwalk evaluates to. It can be done, but we would need to make a plugin and detect what is actually being sent to the MUD. The simple approach above will work if you don't use speedwalks much.

Another problem with speedwalks would probably be that it might have sent all the directions before the "door is closed" message arrives.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kenneth   (18 posts)  [Biography] bio
Date Reply #5 on Fri 14 Mar 2008 03:45 PM (UTC)
Message
Ok, i'll give all this a shot. Thanks, i'll keep you all informed.
[Go to top] top

Posted by Kenneth   (18 posts)  [Biography] bio
Date Reply #6 on Fri 14 Mar 2008 04:09 PM (UTC)
Message
I'm sorry, but I can't figure out what to do with all that stuff. I hate to ask, but... could you give me step-by-step instructions on what to do to get this to work? Sorry, I'm such a noob..
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Fri 14 Mar 2008 08:14 PM (UTC)
Message
We have suggested one alias and one trigger. You need to copy them individually into the client. See http://www.mushclient.com/pasting for how to do this.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Kenneth   (18 posts)  [Biography] bio
Date Reply #8 on Sat 15 Mar 2008 03:36 PM (UTC)
Message
Yes, it worked! Thank you all, so much!
[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,728 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]