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 ➜ MUSHclient Triggers that Include Variables

MUSHclient Triggers that Include Variables

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


Posted by RashinLord   Canada  (29 posts)  Bio
Date Tue 13 Dec 2005 06:19 AM (UTC)
Message
what would one put in the trigger line of a trigger to represent a variable?

for example, in wintin/tintin, it would look as such:

#variable {attack} {kick}
#variable {target} {Nick}
#acton {$target has arrived.}{$attack $target}
Top

Posted by RashinLord   Canada  (29 posts)  Bio
Date Reply #1 on Tue 13 Dec 2005 07:13 AM (UTC)
Message
Would it be @target? Searching around the site, that's what I see but then my question would be, "Are script globals defined in plugins avaiable to other plugins, or do I have to use MUSHclient variables?
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #2 on Tue 13 Dec 2005 07:39 AM (UTC)
Message
The equivalent in MUSHclient would be (this is Lua, but other languages are very similar):

/SetVariable ("attack", "kick")
/SetVariable ("target", "Nick")

(These were typed into the command window, hence the slash). You could make an alias "target" to do the above, this has been covered quite a few times in the forum.

The trigger, copied from the trigger list:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   expand_variables="y"
   match="@target has arrived."
   sequence="100"
  >
  <send>@attack @target</send>
  </trigger>
</triggers>


You are right, it is @target and @attack, with "expand_variable" checked.

Quote:

Are script globals defined in plugins avaiable to other plugins ...


No, each plugin has its own script space, which is separate again from the main script space (the one used by the command window, and "main" triggers etc.)

This is for 2 main reason:


  • Each plugin author is entitled to know s/he has their own set of variables, and that if another plugin happens to use (say) "counter" it won't adversely affect their plugin.

  • Plugins can be in different languages, so that things like Lua threads or tables would not have a ready representation in (say) VBscript.


However you can use MUSHclient variables, to an extent, to communicate between plugins. For example, GetPluginVariable will get the variables from another plugin. However you cannot change another plugin's variables for much the same reason they share different script spaces - to make each plugin self-contained.

You can *ask* another plugin to change its variables in various ways, one being the BroadcastPlugin script call, or CallPlugin. Another way is simply to make a "dummy" command that is sent to be executed (using the Execute script function), that another plugin can trap by using an alias.

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


11,625 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.