[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Targets

Targets

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


Pages: 1 2  

Posted by Penguin   (46 posts)  [Biography] bio
Date Sun 12 May 2002 02:46 AM (UTC)
Message
I read through Nat's post about targets and manage to set the script needed.. however I was wondering if there is a way to "kill *" and "target *". It doesnt work when I set my alias to kill %1 then target %1
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 12 May 2002 03:09 AM (UTC)
Message
Can you post the exact alias you used? Kill %1 should work.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #2 on Sun 12 May 2002 07:19 AM (UTC)

Amended on Sun 12 May 2002 07:27 AM (UTC) by Magnum

Message
I get the feeling what you are trying to do is this:

kill %1
call alias "target" with %1 as the argument.

That's not possible. You can not call an alias from another alias. As you no doubt will see, MUSHclient simply sends "target " and the value in %1 to the MUD, without checking to see if "target" was an alias.

In a case like this, you can use scripting, and have the script perform everything that you want:

Sub Combat_Set_Target_and_Attack (aliasname, aliasline, arrWildcards)
  World.SetVariable "target", arrWildcards(1)
  World.Send "kill " & arrWildcards(1)
End Sub

Alernatively, if you already have a script to set target as a variable, you could call that same script, and in the SEND box, just put "kill %1". The alias will BOTH send what's in the box, and call the script.

There are other ways to handle this situation as well... I'll let someone else explain. :)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Penguin   (46 posts)  [Biography] bio
Date Reply #3 on Sun 12 May 2002 08:17 AM (UTC)
Message
I'm sorry to trouble you guys.. but I'm new with scripts and all that.. and I am a little confused with what to do.

I have an alias named: target *
Under label, it is: Alias_Set_Target
And the script is: Set_Target

Dim Target

Sub Set_Target (AliasName, TriggerLine, arrWildcards)
World.SetVariable "Target", arrWildcards(1)
World.Note "Target: " & World.GetVariable("Target")
End Sub

That is what is in my script..
'Alernatively, if you already have a script to set target as a variable, you could call that same script, and in the SEND box, just put "kill %1". The alias will BOTH send what's in the box, and call the script.' -Magnum

If I create an alias named: 5
Under send I should put: kill %1
And what do I have to put under label and script? And do I have to edit my original script?
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #4 on Sun 12 May 2002 09:13 AM (UTC)
Message

  Alias: 5
Enabled: Checked.
  Label: Alias_Kill '(Anything unique here is fine)
 Script: Set_Target
   Send: kill %1

That alias will BOTH call the script, AND send what is entered in the "Send" box.

The label name must be unique, the script name does not have to be unique. You can call the same script routine from multiple aliases or triggers.

By the way, the "Dim Target" line is not doing what you think. You do not need to declare MUSHclient variables, they are initialized the first time you set one. What you are actually doing with that DIM statement is declaring a global variable in the scripting language (VBS). There is a difference between script variables and MUSHclient variables.

I made the same mistake when i started scripting. :)

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Penguin   (46 posts)  [Biography] bio
Date Reply #5 on Sun 12 May 2002 10:05 AM (UTC)
Message
*smile* Thanks for the detailed explanation:)
But something seems to be wrong.. Here is what I copied and pasted from the screen

5 servant
What?
HP:140 EP:139

the '5 servant' is my input.. 'What?' appeared because the MUD did not recognize the command

then I just typed '5' alone and got this

Target:
kill
Kill what?
HP:140 EP:140

I'm not sure what seems to be the problem..
[Go to top] top

Posted by Vaejor   (120 posts)  [Biography] bio
Date Reply #6 on Sun 12 May 2002 02:49 PM (UTC)
Message
From Magnum:
Quote:

Alias: 5
Enabled: Checked.
Label: Alias_Kill '(Anything unique here is fine)
Script: Set_Target
Send: kill %1


If I understand the primary use of this, try the following alteration:

Alias: 5 *


Now, this will only work with input of "5 <anything>", and will no longer work for only "5" or even "5 ".
It will also store whatever you type in after the original "5 " into %1 and arrWildCards(1) as you wish.

Let us know how it goes. :)
[Go to top] top

Posted by Penguin   (46 posts)  [Biography] bio
Date Reply #7 on Sun 12 May 2002 02:53 PM (UTC)
Message
Sweet:) Works perfectly now. Thanks to all those who replied.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #8 on Mon 13 May 2002 03:22 AM (UTC)
Message
Sorry for the error, which Vaejor kindly pointed out. I forgot the wildcard. "*".

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Penguin   (46 posts)  [Biography] bio
Date Reply #9 on Tue 21 May 2002 02:06 AM (UTC)
Message
Hmm.. I've managed to set targets and all that. And I was just wondering.. is there a way to trigger when your "Target falls to the ground." to send "kill @Target" as in, trigger specifically to kill the previously set target who falls.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #10 on Tue 21 May 2002 03:56 AM (UTC)
Message
Yes. Put:

kill @Target

...in the SEND box of your trigger, and make sure the "Expand Variables" checkbox is checked.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #11 on Tue 21 May 2002 04:01 AM (UTC)
Message
Oops, you probably want the variable name in the trigger line as well. Previously, that was not supported, but is a new feature in MUSHclient. Personally, I haven't used that feature yet, so I am unsure of the syntax. It might be:

@Target falls to the ground.

I'm sure Nick or someone will correct me if I am wrong. (If that doesn't work, try clicking "Real Expressions" and see if it works then).

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Penguin   (46 posts)  [Biography] bio
Date Reply #12 on Tue 21 May 2002 04:02 AM (UTC)
Message
hmm but is it possible to trigger only when my target falls to the ground? instead of just "* falls to the ground."
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Tue 21 May 2002 04:45 AM (UTC)

Amended on Tue 21 May 2002 04:46 AM (UTC) by Nick Gammon

Message
Yes, with expand variables.

I am now going to have the fun of pasting in an XML trigger. Hopefully it is self-explanatory if you are using earlier versions of MUSHclient, and version 3.21 onwards lets you take the code below, copy it to the clipboard, and paste into MUSHclient (in the Triggers configuration screen).



<triggers>

  <trigger
   enabled="y"
   expand_variables="y"
   match="@target falls to the ground."
   sequence="100"
  >
  <send>kill @target</send>
  </trigger>
</triggers>





In the process of researching this reply, it turns out there is a bug in the trigger matching code if you have variables in the "match" text, so this example will not in fact work until you get version 3.23. Sorry.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #14 on Tue 21 May 2002 06:36 AM (UTC)
Message
Speaking of which, Nick:

I've noticed you can select a trigger/alias, and select "copy" to copy the XML code to the clipboard. It would be nice if you could select multiple trigger/aliases in this manner. (Using "shift" or "CTRL").

If multiple trigger/aliases are selected, gray out the options that do not apply.

I know... in the meantime, one can just load the XML file directly and C&P from there. :)

(BTW, doing it via interface is easier, since you could sort triggers by their LABEL ... although, strangely, there is NO "label" column in the Alias or Timer Windows).

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] 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.


39,064 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]