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 ➜ Tips and tricks ➜ Programmatically editing macros

Programmatically editing macros

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


Posted by Krenath   USA  (76 posts)  Bio
Date Tue 18 Jun 2002 03:10 PM (UTC)
Message
Just now I found myself needing to write some code that added/edited/deleted macros from within a script, but I was surprised to discover that there are no World.AddMacro and World.DeleteMacro commands. Nor do the GetInfo and GetOption functions seem to provide an interface to interacting with macros.

Does a method of editing macros exist?

I've noticed that plugins don't allow for macros (probably due to the limited number of available macro keys and the high probablility of collisions), so I'd planned on writing a plugin that would dynamically configure the macro keys in order to not only create them, but to manage what they accomplish as conditions and locations in the game change.

Oh, does the <macro> XML tag support the script parameter? I think I'll go test for that...

- Krenath from
bDv TrekMUSH
ATS TrekMUSH
TNG TrekMUSE
TOS TrekMUSE
Top

Posted by Krenath   USA  (76 posts)  Bio
Date Reply #1 on Tue 18 Jun 2002 03:26 PM (UTC)
Message
Bah.

(1) Even if macros are set up within the world file to call scripts (by setting the send text to start with a /), they cannot access plugin scripts directly.

(2) Macros, in the XML file don't support the script tag

Eventually, I'd like to see macros expanded to the point where:
a. they're fully editable from scripts
b. they natively support scripting as triggers, timers, and aliases do.
c. they're supported by plugins
d. any key combination at all can become a macro, not just the F-keys and numeric keypad
e. MUSHclient features can be assigned to macros,overriding default menu hotkeys, allowing the user to customize the keypresses he uses to access MUSHclient menu items

I use HomeSite 5.0 for development at work, and it's spoiled me with its scriptability and customizability. :) The above list of features is, basically, taken from what HomeSite can do.

- Krenath from
bDv TrekMUSH
ATS TrekMUSH
TNG TrekMUSE
TOS TrekMUSE
Top

Posted by Krenath   USA  (76 posts)  Bio
Date Reply #2 on Tue 18 Jun 2002 04:02 PM (UTC)
Message
I'm creating a workaround. Yay

Basically, I'll write a script for the world that intercepts macro keypresses, then checks each loaded plugin to see if it has a routine for handling that macro keypress and, if so, calls it with World.CallPlugin.

This would handle macro 'collisions' by the confusing but simple method of calling the macro script for all plugins that support it

- Krenath from
bDv TrekMUSH
ATS TrekMUSH
TNG TrekMUSE
TOS TrekMUSE
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 20 Jun 2002 04:44 AM (UTC)
Message
Quote:

Does a method of editing macros exist?


No yet. The macro handling is intended to be replaced by a more generic "keyboard mapping" feature, yet to be implemented. Then, perhaps, programmatic access could be added.

- Nick Gammon

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

Posted by PJ   USA  (48 posts)  Bio
Date Reply #4 on Wed 08 Jan 2003 04:56 AM (UTC)

Amended on Tue 21 Jan 2003 02:23 AM (UTC) by PJ

Message
Krenath-
-I can easily set my macros to different things indirectly by using aliases..


Steps:

    1. Have F9 send something like "Macro_F9+++"
    2. Have and alias match "Macro_F9+++" and send whatever you want, in the label section, type "MacroF9" or something
    3. Have another alias to change F9, like "CF9 *", in the label part type "ChangeF9" and in the script part "ChanAliF9"
    4. Add the following to the end of your script..



sub ChanAliF9 (sName, sLine)
  world.deletealias "MacroF9"
  world.addalias "MacroF9", "Macro_F9+++"
end sub





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.


17,539 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.