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 ➜ Use of variables in targetting

Use of variables in targetting

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


Posted by Tamkul   (6 posts)  Bio
Date Thu 20 Mar 2008 12:41 AM (UTC)
Message
Hey everyone, I'm new to using the MUSHclient, and recently, I've been experiencing a lot of trouble trying to set up an alias which will allow me to 'target' things. For instance, I want the alias to set a variable(The thing I'm targetting), then have another alias be able to do something with that variable.

For instance, I'd use 't' to 'set variable "target"', then I'd make another alias to do 'kt' to 'kick "target"'. Any help(If you made sense of my babbling)?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 20 Mar 2008 05:48 AM (UTC)
Message
See http://mushclient.com/faq points 21 and 22.

- Nick Gammon

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

Posted by Tamkul   (6 posts)  Bio
Date Reply #2 on Thu 20 Mar 2008 10:32 PM (UTC)

Amended on Thu 20 Mar 2008 10:33 PM (UTC) by Tamkul

Message
I've tried using that, but when I type in "target rat" or something, it doesn't do anything at all, and the variable is never set. What's the problem?

EDIT: Also, my alias is set to pt, which does "punch @target". Is that right?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 20 Mar 2008 11:18 PM (UTC)
Message
Can you copy both of your aliases and paste them here please? See http://www.mushclient.com/copying

Your "pt" is correct *if* you have checked "expand variables".

- Nick Gammon

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

Posted by Tamkul   (6 posts)  Bio
Date Reply #4 on Thu 20 Mar 2008 11:34 PM (UTC)
Message
<aliases>
<alias
match="pt"
enabled="y"
sequence="100"
>
<send>punch @target</send>
</alias>
</aliases>





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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 21 Mar 2008 12:05 AM (UTC)
Message
Quote:

when I type in "target rat" or something, it doesn't do anything at all ...


When I tried your alias it set the variable "target" to be "rat". Check the "variables" tab in the world configuration.

As for your "pt" alias, I said you need to check "expand variables" which you didn't do. Try this:

<aliases>
  <alias
   match="pt"
   enabled="y"
   expand_variables="y"
   sequence="100"
  >
  <send>punch @target</send>
  </alias>
</aliases>


That worked for me, I typed "pt" and it sent "punch rat".

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Fri 21 Mar 2008 12:09 AM (UTC)
Message
For your target alias, you can make it echo the new target like this (if you have your scripting language set to Lua):


<aliases>
  <alias
   match="target *"
   enabled="y"
   echo_alias="y"
   send_to="12"
   sequence="100"
  >
  <send>
SetVariable ("target", "%1")
ColourNote ("white", "blue", "Target is now '%1'")
</send>
  </alias>
</aliases>


Of course, to save typing you can make it match on "t *" rather than "target *".

- Nick Gammon

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

Posted by Tamkul   (6 posts)  Bio
Date Reply #7 on Fri 21 Mar 2008 12:15 AM (UTC)
Message
Thanks! Though, is there any way you could do the expand variable thing with just the window instead of copy pasting all the time?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #8 on Fri 21 Mar 2008 12:33 AM (UTC)
Message
Check the "expand variables" checkbox in the dialog box.

- Nick Gammon

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

Posted by Tamkul   (6 posts)  Bio
Date Reply #9 on Fri 21 Mar 2008 12:43 AM (UTC)
Message
Cool. Thanks a lot!
Top

Posted by Tamkul   (6 posts)  Bio
Date Reply #10 on Fri 21 Mar 2008 01:12 AM (UTC)
Message
And one more question... How would you make a macro change a variable? Like, I have a variable, defined as "arrow", and I want the macro to be able to change that when I hit the macro. How would I go about doing that?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #11 on Fri 21 Mar 2008 02:30 AM (UTC)
Message
Basically as described in http://mushclient.com/faq point 17.

Make an alias that does what you want it to do (eg. change a variable) and then put that alias match as a macro.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


36,888 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.