Variables and scripting

Posted by Matthias on Wed 06 Aug 2003 10:07 PM — 12 posts, 41,335 views.

#0
Okay, here goes the stupid questions (don't worry I have more, I just forgot for the moment):
How do you change/use variables in a trigger?
How does scripting work?(if you can explain it, please do it like you would to a total novice. I'm not one though, I'm even worse)
Oh yes, is there a general script for health and how would I stick it in MUSHclient?(again, the explaining thing)
Amended on Wed 06 Aug 2003 10:10 PM by Matthias
Australia Forum Administrator #1
To set a variable, one way is to send the appropriate wildcard to the variable. eg.

Match: * attacks you!
Send: %1
Send to: variable
Variable name: target

%1 represents wildcard 1 (the first and only asterisk).


To use a variable, put a @ in front of the name and check "expand variables". eg.

Match: something
Send: kick @target
Expand variables: checked


Scripting lets you make decisions or use commands provided in the MUSHclient script interface. For a more detailed explanation, see:

http://www.gammon.com.au/scripts/doc.php?general=scripting

There are various ways of doing health. See the plugins page:

http://www.gammon.com.au/mushclient/plugins/

There is a "health bar" plugin that shows the general idea (and inside it you can see some scripting examples). However it may need customising for your exact prompt.
#2
Ok, I'm an idiot. How/What do I change the health bar plugin to work for another MUD/MUSH/whatever you want to call them?
Australia Forum Administrator #3
Basically you would change the trigger that matches the prompt that gives your health.

If you want more details, better supply an example prompt or two.
#4
Well, basically, in the MUD I'm playing, it doesn't show maxhp or mana. Its sorta like this:
2820h, 2773m
I'm not really sure how I'd change the trigger to fit that.
#5
I'm gonna use this topic for all my questions instead of filling this board...
What would you put in a trigger/alias to increase a variable?
When you want to put a variable in the info bar, do you just stick the varibale in as @varibalehere?
Oh, is there an easier way of transfering a mass of triggers from Fireclient to MUSHclient?
Amended on Thu 07 Aug 2003 05:38 PM by Matthias
Australia Forum Administrator #6
Quote:

Well, basically, in the MUD I'm playing, it doesn't show maxhp or mana. Its sorta like this:
2820h, 2773m


Sorta? Well, you would need to change right near the start to make the "trigger_match" match your prompt, something like this. You need to get it exact, or it probably won't match.

<!ENTITY trigger_match "(\d+)h, (\d+)m" >

Then later on where it does the gauges, you might put in the actual maxima that you know (eg. whatever your maximum health and movement are). Here is one way:


  DoGauge "  HP: ", wildcards (1), 600, "darkgreen", "maroon"
  DoGauge "  Mana: ", wildcards (2), 100, "mediumblue", "mediumblue"


This example assumes your maximum health is 600 and your maximum movement is 100.

I presume these might change, so you might put them into variables and pull the values out of them, like this:


  DoGauge "  HP: ", wildcards (1), GetVariable ("maxhp"), "darkgreen", "maroon"
  DoGauge "  Mana: ", wildcards (2), GetVariable ("maxmove"), "mediumblue", "mediumblue"



Australia Forum Administrator #7
Increase a variable? Here is one way ...


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="Total exp for kill is *."
   send_to="12"
   sequence="100"
  >
  <send>SetVariable "experience", CLng (GetVariable ("experience")) + %1</send>
  </trigger>
</triggers>


This gets the value of the "experience" variable, converts it to a "long" (otherwise it would be considered a string), adds the new value to it, and saves the result back into the same variable.
Australia Forum Administrator #8
Quote:

When you want to put a variable in the info bar, do you just stick the varibale in as @varibalehere?


Sort of. Here is an example trigger that matches something. It sends to script two commands - one to clear the existing info bar, and one to set it to the contents of my_variable.


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="You see * with *"
   send_to="12"
   sequence="100"
  >
  <send>InfoClear
Info "@my_variable"</send>
  </trigger>
</triggers>

Amended on Sat 09 Aug 2003 01:18 AM by Nick Gammon
#9
Woohoo! The healthbar thing works now! Thanks.
USA #10
I downloaded the Health_bar plugging. I got it installed all right, I'm just not sure what to mak my trigger as.

This is my prompt:

<100%/100HP|100%/100Mana|100%/100Move> <F>
<56%XTL>(STL: Light footed)(Night)


Had a hell of a time figuring out exactly what to put as my prompt, They only show %'s which should make this far more easy to do. But not sure what to do from here.
Australia Forum Administrator #11
The percentage is out of 100, so you could make the dogauge be:

DoGauge " HP: ", wildcards (1), 100, "darkgreen", "maroon"
DoGauge " Mana: ", wildcards (2), 100, "mediumblue", "mediumblue"