Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Automatically opening doors

Automatically opening doors

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


Posted by Nick Gammon   Australia  (23,121 posts)  Bio   Forum Administrator
Date Mon 05 Feb 2001 06:43 PM (UTC)

Amended on Sun 04 Mar 2001 04:13 PM (UTC) by Nick Gammon

Message
In some MUDs you may find that as you go north, south or whatever, you find a closed door, that you need to open. You can make MUSHclient automatically open these doors for you, with a little work with aliases, triggers, and a small script...


Step 1

First we need to know which direction we are walking. Let us assume that we are using the numeric keypad to navigate (ie. press "8" to go north, "2" to go south, and so on).

We need to have an alias fire as we walk, so we know which way we were heading, so using Configuration -> Keypad (Shift+Ctrl+1), change each of the directions to have "keypad-" in front of them, like this:

8: keypad-north
2: keypad-south
4: keypad-west
6: keypad-east

... and so on, doing the same for ne, nw, se, sw, up and down.


Step 2

Make an alias that will match on these new commands.

Press Shift+Ctrl+9 to see the alias list, and press "Add".

Type the following details into the new alias:


Match on: keypad-*
Send: %1
Label: keypad_navigation
Script: OnKeypadDirection


Sending %1 will send the actual direction to the MUD, so if it matches on "keypad-north" it will send "north" to the MUD.


Step 3

Add a script subroutine to your script file, to set a variable which remembers which way you last walked ...

VBscript


Sub OnKeypadDirection (strAliasName, strOutput, arrWildCards)
  world.setvariable "direction", arrWildcards (1)
End Sub



JScript


function OnKeypadDirection (strAliasName, strOutput, wildcardsVB)
{
  wildcards = VBArray(wildcardsVB).toArray();        
  world.setvariable("direction", wildcards [0] );
}



Step 4

Make a trigger that detects if the door is closed.

Press Shift+Ctrl+8 to see the trigger list, and press "Add".

Type the following details into the new trigger:


Match on: The door is closed.
Send: open @direction
Expand variables: checked



Step 5

If desired, make another trigger for locked doors.

Add another trigger, and type the following details into the new trigger:



Match on: The door is locked.
Send: unlock @direction
Expand variables: checked



Step 6

If desired, make another trigger for doors that you don't have a key for.

Add another trigger, and type the following details into the new trigger:


Match on: You don't have the correct key.
Send: pick @direction
Expand variables: checked



All done!

You are now ready to wander around without worrying about locked or closed doors! :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Thaeldan   Norway  (7 posts)  Bio
Date Reply #1 on Mon 05 Feb 2001 06:44 PM (UTC)
Message
If you would like to implement doortypes as well for Nick's keypad-navigation example, simply make a script function as show below:

Trigger is:

*The * seems to be closed.*


Script is:


function onDoorClosed(aliasname, aliasline, wildcardsVB) {
wildcards = new VBArray(wildcardsVB).toArray();
world.SetVariable("doortype", wildcards[2]);
}



So basically when you hit a closed door you can open it automatically without any typing!

Trigger on:

The gate seems to be closed


Action would be:

open @doortype @direction


This would e.g. open the eastern gate

Also, to unlock doors aswell make a trigger as follows:

Trigger is:

It seems to be locked.


Action:

unlock @doortype @direction


Completing this with a pick door trigger which will able you to travel swiftly within areas with closed/locked doors without having to stop.

Trigger:

You don't seem to have the correct key.


Action:

pick @doortype @direction


Remember to enable "Expand Variables" for the examples above!
Top

Posted by Morlock   (12 posts)  Bio
Date Reply #2 on Sun 11 Mar 2012 08:45 AM (UTC)
Message
Hi

so i decided to try making the doors automatically open for me so i used steps 1-4 for step 3 i copied what was on it for the jscript script

then i skipped down to thaeldans post and did his script and triggers for opening doors of different names

all of this worked just fine

the problem im having is when i close mush or even change to a different script the OnKeypadDirection script stops working and the client acts weird

like when i try to log into the mud im doing this for and i type in my name it adds extra characters in front of the name
heres a copy of that:

By what name shall we know thee?
quilue
There is no registry entry for player '" }" ]quilue'.

now to fix this i can just click on the script button and load the OnKeypadDirection again and everything works fine again

thaeldans script i never have to load again

so any ideas how i can fix this?
i use windows 7 and mushclient version 4.61

thanks for your time
Top

Posted by Morlock   (12 posts)  Bio
Date Reply #3 on Sun 11 Mar 2012 10:03 PM (UTC)
Message
bleh sorry i guess the problem was a gmcp plugin i had installed before making this

again sorry about this it was late and i havent been feeling good when i took some time to think and tried removing that plug in these scripts work just fine now

thanks again for your time
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.


19,442 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.