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 ➜ "Variable 'target' not defined"

"Variable 'target' not defined"

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


Posted by Tatewaki2365   (34 posts)  Bio
Date Sun 09 Jan 2005 06:57 AM (UTC)
Message
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.

Have: An error...
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Sun 09 Jan 2005 08:01 AM (UTC)
Message
"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).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Tatewaki2365   (34 posts)  Bio
Date Reply #2 on Sun 09 Jan 2005 12:23 PM (UTC)
Message
I did what I could that you said, but ultimately came up with the same error.

Alias set for target: tar *
Send: %1
And I have expand variables, send to variable and the variable 'target' box filled with target.

Then, on an alias of my own, I have: weak
send: co 'weak' %1 @target
And expand variables checked again.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 09 Jan 2005 07:22 PM (UTC)
Message
Can you copy and paste the actual aliases, rather than reproducing them by hand? See here if you don't know how to do that:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4776

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.

- Nick Gammon

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

Posted by Tatewaki2365   (34 posts)  Bio
Date Reply #4 on Sun 09 Jan 2005 08:53 PM (UTC)
Message
<aliases>
<alias
match="tar *"
enabled="y"
expand_variables="y"
variable="target"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>


And this is WAY wrong, I'm sure


<aliases>
<alias
match="weak"
enabled="y"
expand_variables="y"
sequence="100"
>
<send>co 'weak' %1 @target</send>
</alias>
</aliases>
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #5 on Sun 09 Jan 2005 10:11 PM (UTC)

Amended on Sun 09 Jan 2005 10:15 PM (UTC) by Flannel

Message
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 is the former situation:

<aliases>
<alias
match="^weak$"
enabled="y"
expand_variables="y"
regexp="y"
ignore_case="y"
sequence="100"
>
<send>co 'weak' @target</send>
</alias>
</aliases>

This would be the latter:

<aliases>
<alias
match="^(weak)$"
enabled="y"
expand_variables="y"
regexp="y"
ignore_case="y"
sequence="100"
>
<send>co '%1' @target</send>
</alias>
</aliases>

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Tatewaki2365   (34 posts)  Bio
Date Reply #6 on Sun 09 Jan 2005 10:28 PM (UTC)
Message
Still... Getting... Same... Error. Blast.
Top

Posted by Tatewaki2365   (34 posts)  Bio
Date Reply #7 on Sun 09 Jan 2005 10:32 PM (UTC)
Message
Alright, I'm starting to think it might be something with my target alias - this is what I have;

<aliases>
<alias
match="tar *"
enabled="y"
expand_variables="y"
variable="target"
send_to="9"
sequence="100"
>
<send>%1</send>
</alias>
</aliases>
Top

Posted by Scypio   Poland  (50 posts)  Bio
Date Reply #8 on Sun 09 Jan 2005 10:41 PM (UTC)
Message
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..
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #9 on Sun 09 Jan 2005 11:39 PM (UTC)
Message
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.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #10 on Mon 10 Jan 2005 07:50 PM (UTC)
Message
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:


TRACE: Trace on
TRACE: Matched alias "tar *"

- Nick Gammon

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

Posted by Tatewaki2365   (34 posts)  Bio
Date Reply #11 on Mon 10 Jan 2005 08:48 PM (UTC)
Message
Yeah, there was a conflicting alias.

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

Posted by Tatewaki2365   (34 posts)  Bio
Date Reply #12 on Mon 10 Jan 2005 08:50 PM (UTC)
Message
I hate posting so much, so I'll stop here... But, it seems that when you do tar ' it places the target as the current person you're in battle with.

Thanks for the help!
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #13 on Mon 10 Jan 2005 08:55 PM (UTC)
Message
What are you asking? Turn what off?

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.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
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.


32,768 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.