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 ➜ Setting Variables Instantly on Triggers

Setting Variables Instantly on Triggers

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


Posted by Parham   (2 posts)  Bio
Date Wed 16 Dec 2009 06:23 AM (UTC)
Message
Hello there,
I am a new user on this forum, and from Iran. Hail! :-)

I am blind, and usually gag my prompt, of course. However, since most of the muds do not have an hp/ep/mp/whatever command to show you your stats, I usually, in other clients, create an alias which would be something like this:
match "hp"
send "/speech.say @hp, 0"

and so forth. However, with such a prompt:
*h, *m, *e
... is there a way to assign the wildcards to variables instantly? In another client, I could use this, which I give you as an example of what I want:
&{hp}h, &{mp}m, &{ep}e

Hopefully I have been able to get my point across.

Thanks for such a great client!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 16 Dec 2009 07:15 PM (UTC)
Message
You can make a trigger that matches the prompt, and inside the send box put 3 lines of script to set the three variables. The "send to" box needs to be "script".

Here is an example:


<triggers>
  <trigger
   enabled="y"
   match="*h, *m, *e"
   send_to="12"
   sequence="100"
  >
  <send>

require "var"

var.hp = %1
var.mp = %2
var.ep = %3

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


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


Now make a few aliases to report your hp, mp, and ep as appropriate. There have been posts about screen readers if you need help on that.

Template:faq=13 Please read the MUSHclient FAQ - point 13.


- Nick Gammon

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

Posted by Parham   (2 posts)  Bio
Date Reply #2 on Thu 17 Dec 2009 05:04 AM (UTC)
Message
Greetings,
Thanks a lot! I have two questions, though.

Why send_to="12"?
And, why did you require "var", and then set var.hp/etc, and not just do something like:
hp = %1

Thanks!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Thu 17 Dec 2009 05:19 AM (UTC)
Message
In the text version of a trigger, send to "12" means "send to script". If you click on the "send to" combo box, and select "script" that becomes 12 when the trigger is copied onto the clipboard.

So, basically, the trigger is a script trigger.

As for "require 'var'", that simplifies the setting of MUSHclient variables. A version without it would be:


SetVariable ("hp", "%1")
SetVariable ("mp", "%2")
SetVariable ("ep", "%3")


That's just a bit more typing. However you could do as you suggested and just use:


hp = %1
mp = %2
ep = %3


The distinction is that my original version set MUSHclient variables (which persist when the world is saved) compared to script variables.

However in your case, where you just want to save the current HP, which is ephemeral anyway, just using script variables is probably the better solution.

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


16,739 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.