Alias editing with aliases?

Posted by PJ on Sat 19 Oct 2002 05:10 PM — 9 posts, 37,512 views.

USA #0
I'd like to use an alias such as 6 to edit an alias that I have...

("Macro_F6+++" is an alias I have and it sends "Bash @Target", @Target comes from a script I have.)

I want to be able to edit the alias "Macro_F6+++" to change the word Bash to Bodyslam or anything else I want by using an alias where I type in "6 Bodyslam"

Simplifying that:
I want alias "6 *" to change the alias "Macro_F6+++" From "Bash @Target" to "* @Target"

Is that possible?
Canada #1

Sub ConfigureF6 (AliasName, AliasLine, arrWildcards)
   World.AddAlias "OnKeypressF6", "OnKeypressF6", arrWildcards(1) & " @Target", 1569, ""
End Sub

Create an alias, called "6 *", and configure it to call that subroutine. (In the box labelled "script", put "ConfigureF6").

Under General Configuration, Input, Macros ... configure the F6 key to send "OnKeypressF6".

When you press the key, it will call the alias also named "OnKeypressF6", which will send the line you want.

Hey! Trick question. I just looked, and you can not configure F6 for some reason. ...Well, you can change the macro key to what you want, and edit the stuff I said accordingly.
Amended on Sun 20 Oct 2002 07:27 AM by Magnum
USA #2
Sorry, i should have explained a little more, my macro F6 is set to output "Macro_F6+++" which in turn is an alias that sends Bash @Target. Target is a variable from a script which i got help on earlier to solve a PKing problem. So what i was wondering is if there was a way to change the word Bash to * by using another alias where i type 6 *.. Is this possible with or without adding more variables?

Sorry for any redundancy, couldnt see what i'd already said.
Australia Forum Administrator #3
I would make your "alias changing alias" delete the existing one and re-add it. Something like this:


sub ChangeAlias (sName, sLine, wildcards)
  world.deletealias "myalias"
  world.addalias "myalias", "Macro_F6+++", wildcards (1) + " @Target", 512 + 1, ""
end sub


I haven't tested it, but it is the general idea.

(The 512 above is "expand variables", the 1 is "enabled").
Amended on Sun 20 Oct 2002 01:55 AM by Nick Gammon
USA #4
I dont quite get what i'm supposed to do..
So I add that all to my script and have the macro call it?

I went ahead and tried that but it didnt work... Otherwise i'm lost
USA #5
err, alias, i meen...
Australia Forum Administrator #6
I would make an alias:

6 *

This alias calls that subroutine. If you aren't sure what is happening, put a world.note in the sub, eg.

world.note "alias called with wildcard " + wildcards (1)
Canada #7
Quote:

I would make your "alias changing alias" delete the existing one and re-add it. Something like this:

sub ChangeAlias (sName, sLine, wildcards)
  world.deletealias "myalias"
  world.addalias "myalias", "Macro_F6+++", wildcards (1) + " @Target", 512 + 1, ""
end sub


From: http://www.mushclient.com/scripts/function.php?name=AddAlias
Quote:

const eEnabled = 1 ' enable alias
const eIgnoreAliasCase = 32 ' ignore case when matching
const eOmitFromLogFile = 64 ' omit this alias from the log file
const eAliasRegularExpression = 128 ' alias is regular expressions
const eExpandVariables = 512 ' expand variables like @direction
const eReplace = 1024 ' replace existing alias of same name
const eAliasSpeedWalk = 2048 ' interpret send string as a speed walk string
const eAliasQueue = 4096 ' queue this alias for sending at the speedwalking delay interval
const eAliasMenu = 8192 ' this alias appears on the alias menu
const eTemporary = 16384 ' temporary - do not save to world file

I chose (From the bottom up):

Replace   :  1024
Expand    :   512
IgnoreCase:    32
Enabled   :     1
-----------------
Total     :  1569

Heh... Made a mistake in addition the first time, I put 1570. Doh!

Anyway, Nick, I thought the "replace" value would make the need to delete the old alias unnecessary.

Monkey:

After adding the subroutine, create an alias to call the new subroutine. You have indicated you want the new alias to be "6 *".

Alias Match: 6 *
Enabled    : Checked.
Label      : Configure_F6
Script     : ChangeAlias

Australia Forum Administrator #8
Quote:

Anyway, Nick, I thought the "replace" value would make the need to delete the old alias unnecessary.



Quite right, I was asleep when I wrote that. :O