Alright, I gave up on the task not too long ago of having an alias/targetting system. But recently, after intense annoyance, I find myself crawling back.
I've been looking into trying to make an alias for summon (Syntax being: co 'summon' [person]), but using summ as an alias for that. When I was toying around with something I found on the site, it led me to look at this: ^(kick|punch|stab) and then send at %1 @target. I thought that might help with figuring out how my alias system could work, but when I typed in kick through Mush, it gave me the message "Variable 'target' not defined". So, if anyone would like to share the solution to my dilemma...
Want: 'summ' to be used as alias for [co 'summon'] and then be able to insert a target using the tar [person] command.
"variable 'target' not defined" simply means that a variable named literally "target" does not exist.
You use that when you send %1 @target. The @target is the contents of the variable target (assuming you have expand variables checked).
You just have to create a variable "target" and set it to something (which could be done via an alias).
To set it, you'd have your 'tar *' alias, which you 'send to' variable, fill the "variable" box in with "target" and then type "%1" (no quotes) in the 'send' box.
Or if you needed to do anything else with that alias, you could 'send to': script, and then enter 'setvariable "target", "%1"' (no single quotes) into the send box (assuming you were using VB).
You have two aliases, the first should set up target, the second use it. The first one doesn't need to expand variables as it is setting one, not using one.
Once you have typed "tar blah" you should check the variables configuration window to make sure that the variable "target" contains "blah". If not, then you have a problem with your first alias.
This stuff does work, you know. It's just a case of doing it correctly.
The second alias needs a wildcard to match on. Right now you're trying to use %1 without ever having a wildcard.
Either that, or you need to remove %1 from your send (which you'd want to do if you only had weak in the alias).
So, if you want to use ^(kick|punch|stab)$ type of thing, then do so. Make sure regexp is checked, and I suggest ignore case as well.
And you'll want to remove the 'weak' in your send text as well. And if you need quotes around the action, you'll want to add those (co '%1' @target).
This alias is fine, at least it works fine for me.. probably what you need is to define that variable:)
So what you should do is go to configure variables (shift+ctrl+7), add a new variable, name it target, and give it any value. Afterwards, all should work fine..
That shouldn't matter. Send to: variable (or setvariable for that matter) will create the variable if it isn't there.
But yes, adding that variable will solve your problem. Although you may not be able to change it via that alias if you currently can't create it. So we still have some sort of problem.
That alias worked for me. You don't need 'expand variables' checked in the "tar *" alias, as I said before.
Try it on its own. Type "tar blah" and then check if the variable is defined. The only reason I can think of is that there is *another* alias that is acting first.
Turn "Trace" on from the Game menu and then try the alias. You should see something like this:
So, as a final question - is there a way to turn it off easily without having to go to aliases and disabling them all? Perhaps a way to just make it clear out the target name so it goes from 'tar [name]' so it casts co 'blind' [name], to co 'blind'. The latter would be useful for when I'm blinded and can't target.
If you have "keep evaluating" checked on your aliases, you wont have the conflicts, as they will all be able to match.
As for casting with or without an argument, you could do something as simple as just setting your target to "", which would make you cast "co 'blind' ". There is a space at the end, but depending on your server, it may or may not care.