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


Register forum user name Search FAQ

Gammon Forum

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

MUSHclient scripting

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


Posted by AEthan   (5 posts)  [Biography] bio
Date Tue 01 Sep 2009 06:23 PM (UTC)
Message
Hi I'm pretty new to this program and I would love to get into scripting but I have no clue how. Can anyone help me? I have a specific question right off the bat. Is it possible to create a varriable in one trigger that can be used in another trigger. I.E. I'm trying to make "chase trigger".
[Go to top] top

Posted by WillFa   USA  (525 posts)  [Biography] bio
Date Reply #1 on Tue 01 Sep 2009 07:43 PM (UTC)
Message
http://www.mushclient.com/scripting has a decent walkthrough (with old screen shots, but the content is still applicable) that can show you the basics.

http://www.gammon.com.au/forum/?id=9626 has a more current version Nick did on Youtube if you'd rather have a video walkthrough.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Tue 01 Sep 2009 09:16 PM (UTC)
Message
Also a YouTube video for a targetting alias, which is similar to what you want:

Template:post=9616 Please see the forum thread: http://gammon.com.au/forum/?id=9616.

- Nick Gammon

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

Posted by AEthan   (5 posts)  [Biography] bio
Date Reply #3 on Wed 02 Sep 2009 01:38 AM (UTC)
Message
Ok now i've set up this targeting alias and everything is set now I want to follow the target and imediatly backstab the target if it flees. I just need to know if this is right. So I set up a trigger that in the "Trigger:" field it says @target walks *. then under send I have

%1
backstab @target

Will this work? I just don't know if the target variable will work with other things or just the allias. and what is the wildcard? Is it %1 or %2 since I already have a variable made?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Wed 02 Sep 2009 01:43 AM (UTC)
Message
I prefer to see the whole trigger rather than a free-format description of it.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


However to answer your question about %1, each asterisk becomes a wildcard, thus "@target walks *." will make the direction %1. The variable @target is not a wildcard.

If this still doesn't work please post the whole thing (as per the link above). Stuff like whether various options are checked are relevant to the answer.

- Nick Gammon

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

Posted by AEthan   (5 posts)  [Biography] bio
Date Reply #5 on Wed 02 Sep 2009 02:04 AM (UTC)
Message
The trigger actually works but now I have a different question. Instead of using t * for the allias I have used kill * but I want to add to the script that sends the command kill @target. How do I do that?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Wed 02 Sep 2009 02:22 AM (UTC)
Message
Not sure I understand that question. Please post your existing alias, so I can see what you currently have.

- Nick Gammon

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

Posted by AEthan   (5 posts)  [Biography] bio
Date Reply #7 on Wed 02 Sep 2009 02:55 AM (UTC)
Message
<aliases>
<alias
match="tar *"
enabled="y"
expand_variables="y"
send_to="12"
ignore_case="y"
sequence="100"
>
<send>SetVariable ("target", "%1")

ColourNote ("white", "black", "Target is now: %1")

SetStatus ("Target: %1")
</send>
</alias>
</aliases>

Ok instead of match="tar *" I want to put match="kill *" and then because that replaces the kill command I would like to after the SetVariable, ColourNote, and SetStatus have completed I wish to send the command "kill" to the world. How may I do that?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Wed 02 Sep 2009 03:13 AM (UTC)
Message
You don't need "expand variables" now because there aren't any variables in the alias. Anyway, to send something you use Send, so the amended script part would be:


SetVariable ("target", "%1")
ColourNote ("white", "black", "Target is now: %1")
SetStatus ("Target: %1")
Send ("kill %1")


- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Wed 02 Sep 2009 03:14 AM (UTC)
Message
And the whole thing would look like:


<aliases>
  <alias
   match="kill *"
   enabled="y"
   send_to="12"
   ignore_case="y"
   sequence="100"
  >
  <send>

SetVariable ("target", "%1")
ColourNote ("white", "black", "Target is now: %1")
SetStatus ("Target: %1")
Send ("kill %1")

</send>
  </alias>
</aliases>


Template:pasting For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


- Nick Gammon

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

Posted by AEthan   (5 posts)  [Biography] bio
Date Reply #10 on Wed 02 Sep 2009 04:02 AM (UTC)
Message
Thank you very much.
[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.


27,294 views.

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]