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 ➜ General ➜ GetVariable in a keypad function?

GetVariable in a keypad function?

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


Posted by Arnumor   (11 posts)  Bio
Date Wed 20 Apr 2011 01:20 AM (UTC)
Message
Allow me to explain the function I'm looking for, and hopefully someone will be able to help me out in putting it together. I get the feeling this will work by using the command syntaxes you'd put into the command bar, but I've forgotten how those go, so the assumption doesn't help me.

In the game I'm playing, there's a command called Circle, which circles behind your opponent to stab them. The problem is, you have to provide an argument, such as 'circle ghoul'.

Now, as I'm not always fighting ghouls, I'd like to be able to use a variable I set up on the fly with an alias I already have put together, so that I can provide the right circle target just by hitting my numpad key.

Would anyone be able to tell me what the string would be that I can assign to my keypad button that calls up a given variable?

For simplicity, let's assume the variable is simply called 'Circle'.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 20 Apr 2011 05:25 AM (UTC)
Message
Template:post=9616 Please see the forum thread: http://gammon.com.au/forum/?id=9616.


Then just make the keypad key (in world configuration) call the alias you set up.

- Nick Gammon

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

Posted by Eloge   (20 posts)  Bio
Date Reply #2 on Wed 20 Apr 2011 10:47 AM (UTC)
Message
Arnumor said:
Would anyone be able to tell me what the string would be that I can assign to my keypad button that calls up a given variable?


Online help on this subject could also be obtained in Aardwolf (the mud you are referring to?) by a player named Coss.

Regds.
++ Eloge
Top

Posted by Arnumor   (11 posts)  Bio
Date Reply #3 on Wed 20 Apr 2011 09:13 PM (UTC)

Amended on Wed 20 Apr 2011 09:22 PM (UTC) by Arnumor

Message
At first I posted that I'd figured out my issue with the help of the instructional video, but after trying my keypad function and looking at the command echo, it looks like I don't quite grasp the syntax I need to use in my keypad window to make a keypad button call on a variable.

I thought it was something like: kill @target

But this sent the exact thing I typed, namely 'kill @target', to the mud, which obviously won't work, since the mud doesn't know what @target is.

Apparently I'm in need of a tad more clarification, although the video did teach me some other tricks I'll be using.

I think what I need is the syntax I would use if I typed this line right into the command bar, since the keypad seems to act like a quick, one-touch send to world alias.

So, can someone give me some idea as to what that syntax is?

Also; I wasn't referring to Aardwolf, although I appreciate your willingness to help me out.
Top

Posted by Arnumor   (11 posts)  Bio
Date Reply #4 on Wed 20 Apr 2011 09:49 PM (UTC)

Amended on Wed 20 Apr 2011 09:54 PM (UTC) by Arnumor

Message
Eureka! Finally got it working.

I did a little rooting around, and it turns out the way you need to make this work is by having your keypad line send some word you won't use in normal gameplay, and then make a normal alias that matches that specific word, and sends the expanded command you wanted.

Here's simplified guide on how to do this:

1. Under World Properties -> Keypad, Assign the desired match word(Word you want your alias to catch and translate) to the numpad key you'll be using.

2. Under World Properties -> Aliases, create a new alias. In the editor for the new alias, click the '...' key on the top left, just under the 'Alias' input area where you'd normally put in what you type to activate your alias manually. This will open a small input window that will say "Edit alias 'match' text" on the top frame. In this window, put the exact same word you assigned to the keypad in step one. Now click the OK button to save the change. The alias name will show the word you just put in as the name of your alias. (Not sure if I did this a roundabout way, maybe you can just make that word the name of the alias the way you'd normally name an alias?)

3. In the body of the alias, put in the function you want to have happen when you press that key on your numpad. In my case, this was to call up a variable using @(variable name).

(Note: Remember, if you're using a command like 'kill @target', you need to have the 'Expand Variables' setting checked for it to translate the variable properly.)

Click 'OK' to save the changes to your new alias, and from now on, when you press that numpad key, your alias will intervene and send its contents instead of just sending a normal command to the mud, which lets you perform a wide variety of advanced functions.

I apologize for the lengthy posts, but I hope this thread can help other people.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Thu 21 Apr 2011 12:45 AM (UTC)
Message
Sounds like you got it right. :)

The "dummy word" can be anything, but clearly it doesn't want to be something you might happen to want to type into the MUD itself. (eg. "quit" would not be a good choice).

- 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.


23,764 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.