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
➜ Suggestions
➜ macro scripting
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Wuliao
(14 posts) Bio
|
| Date
| Mon 20 Aug 2001 07:22 PM (UTC) |
| Message
| I am not sure this is a valid suggestion. But ...
I just hope the macro definition can call functions in the scripts.
For example,
define F2 Key to call a function test
....
function test()
{
world.note ("test");
world.send ("test");
}
.... | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 20 Aug 2001 10:02 PM (UTC) |
| Message
| You can do this in two steps ...
- Make a macro (eg F2) that sends a word (eg. "foobar")
- Make an alias that matches on that word ("foobar") - the alias then calls the script.
Because the alias "catches" the word it does not actually get sent to the MUD. You could extend this to have lots of macros that call different scripts. You should probably make up a nonsense word that you would never need to actually send, otherwise the alias would match it, and you could not send that word to the MUD. eg. "ljhlkasj8734587".
The same technique can be used to match on what you press on the numeric keypad. There was a post about that a while ago. For example, if you press "6" on the keypad to go east, the alias could pick that word up and remember which way you last walked.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Mon 20 Aug 2001 10:04 PM (UTC) |
| Message
| However be aware that aliases call functions with three arguments, so the script would actually look like this:
Sub Test (thename, theoutput, thewildcards)
world.note ("test");
world.send ("test");
End Sub
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Wuliao
(14 posts) Bio
|
| Date
| Reply #3 on Mon 20 Aug 2001 10:41 PM (UTC) |
| Message
| I tried the method. It seems to me the mushClient will not accept the character replaced by the macros as alias.
I mean if I have a function
function doQuest()
{
// which processes complicated task
}
I have an alias defined as
qd for doQuest()
and defined F2 as qd
If I press F2, it will send qd to the world, instead of running the alias. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Tue 21 Aug 2001 12:58 AM (UTC) |
| Message
| You make the alias like this - (it works because I tested it) ...
Alias: qd
Send: (nothing)
Label: Quest
Script: doQuest
Then in the script file you have:
function doQuest(strAliasName, strOutput, wildcardsVB)
{
// which processes complicated task
}
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Wuliao
(14 posts) Bio
|
| Date
| Reply #5 on Tue 21 Aug 2001 03:45 AM (UTC) |
| Message
| It works! I guess I forgot something before.
Thanks | | 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.
20,884 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top