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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Configuring numeric keypad to do alternative actions when required

Configuring numeric keypad to do alternative actions when required

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


Posted by Erendil   (3 posts)  Bio
Date Tue 07 May 2002 01:55 PM (UTC)
Message
I have problem with making a script. I want to change, by pressing "grey *" on Numpad, work of the numeric keys. When press first time "grey *" it means: 1=sw, 2=s, 3=se, 4=w etc. then when I will press again "grey *" then those numeric keys change meanings to for example: 1=sneak sw, 2=sneak s, 3=sneak se, etc...

Help me, please...

Erendil
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 08 May 2002 03:24 AM (UTC)
Message

  1. Edit the "keypad" configuration, and change each direction to have "keypad_" in front of it, eg.

    
      keypad_north
      keypad_south
      keypad_east 
    


    and so on.

    Also change the keypad entry for the "*" to be:


    toggle_sneak


  2. Add the following script to your script file ...

    
    sub ToggleSneak (sName, sLine, aryWildcards)
     
      if world.GetVariable ("sneak") = "" then
        world.SetVariable "sneak", "sneak "
        world.note "Sneaking enabled"
      else
        world.SetVariable "sneak", ""
        world.note "Sneaking DISABLED"
      end if
    
    end sub
    


    What that does is, every time it is called, change a variable called "sneak" from empty to having the word "sneak " in it (note the trailing space).

  3. Make an alias to catch the keypad commands ...


    Alias: keypad_*
    Send: @sneak%1
    Expand variables: checked


    What that will do is convert (say) "keypad_north" to "@sneak north". If the variable "sneak" is empty then it just becomes "north" but if "sneak" contains the word "sneak" then it becomes "sneak north".

  4. Make an alias to catch the "toggle_sneak" command from the keypad ...


    Alias: toggle_sneak
    Label: togglesneak
    Script: togglesneak


    This means that when you hit the "*" button, it will generate the word "toggle_sneak". The above alias captures that and calls the "togglesneak" script. The script changes the value of the "sneak" variable. Then the other keypad keys behave appropriately. Have fun.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


11,999 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.