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 ➜ how to use mixed "send_to"?

how to use mixed "send_to"?

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


Posted by Zero   (5 posts)  Bio
Date Wed 29 Jul 2009 08:27 PM (UTC)
Message
Hi, I want to use simple command, as below:

<triggers>
<trigger enabled="y" group="exercise" keep_evaluating="y" omit_from_output="y" regexp="n"
send_to="14"
sequence="100" match="something is wrong">
<send>look</send>
<send sen_to="12">SomethingWrong()</send>
</trigger><triggers>
<script>
sub SomethingWrong()
......

but it doesn't work. Why doesn't Mush support mixed command like this?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 29 Jul 2009 09:25 PM (UTC)

Amended on Wed 29 Jul 2009 09:26 PM (UTC) by Nick Gammon

Message
For a start, if it supported it, the GUI interface would need considerable change to allow for multiple "send" boxes, and multiple "send-to" types.

Anyway, it isn't necessary. By using send-to-script you can send to mixed places, for example:


<triggers>
  <trigger
   enabled="y"
   group="exercise"
   keep_evaluating="y"
   match="something is wrong"
   omit_from_output="y"
   send_to="14"
   sequence="100"
  >
  <send>

Send ("look)  -- send to MUD

ColourNote ("white", "red", "something is wrong") -- send to output

SomethingWrong() -- call script

</send>
  </trigger>
</triggers>


I wouldn't mix things around like this anyway - if you are calling a script function (SomethingWrong) why not just do everything in that?

In fact, if you are using send-to-script, then it is a bit confusing to have some scripting in the trigger, and some scripting somewhere else.

If you prefer to use a script file then do all your scripting in that, eg.


<triggers>
  <trigger
   enabled="y"
   group="exercise"
   keep_evaluating="y"
   match="something is wrong"
   omit_from_output="y"
   script="SomethingWrong"
   sequence="100"
  >
  </trigger>
</triggers>


Now by putting "SomethingWrong" in the Script box, the trigger itself doesn't need to send anything anywhere. Then in your script file, you can have this:


function SomethingWrong (name, line, wildcards, styles)

  Send ("look)  -- send to MUD

  ColourNote ("white", "red", "something is wrong") -- send to output

  -- other stuff  here

end -- function



See http://mushclient.com/scripting - that explains scripting in a fair bit of detail.

- Nick Gammon

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

Posted by Zero   (5 posts)  Bio
Date Reply #2 on Wed 29 Jul 2009 11:32 PM (UTC)
Message
Yes, the GUI interface will be complicated.

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.


14,521 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.