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


Register forum user name Search FAQ

Gammon Forum

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

Variables and scripting

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


Posted by Matthias   (28 posts)  [Biography] bio
Date Wed 06 Aug 2003 10:07 PM (UTC)

Amended on Wed 06 Aug 2003 10:10 PM (UTC) by Matthias

Message
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)

Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 06 Aug 2003 10:33 PM (UTC)
Message
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.

- Nick Gammon

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

Posted by Matthias   (28 posts)  [Biography] bio
Date Reply #2 on Wed 06 Aug 2003 11:26 PM (UTC)
Message
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?

Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 07 Aug 2003 04:55 AM (UTC)
Message
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.

- Nick Gammon

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

Posted by Matthias   (28 posts)  [Biography] bio
Date Reply #4 on Thu 07 Aug 2003 04:41 PM (UTC)
Message
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.

Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life.
[Go to top] top

Posted by Matthias   (28 posts)  [Biography] bio
Date Reply #5 on Thu 07 Aug 2003 05:00 PM (UTC)

Amended on Thu 07 Aug 2003 05:38 PM (UTC) by Matthias

Message
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?

Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sat 09 Aug 2003 01:10 AM (UTC)
Message
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"




- 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 #7 on Sat 09 Aug 2003 01:13 AM (UTC)
Message
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.

- 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 #8 on Sat 09 Aug 2003 01:17 AM (UTC)

Amended on Sat 09 Aug 2003 01:18 AM (UTC) by Nick Gammon

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


- Nick Gammon

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

Posted by Matthias   (28 posts)  [Biography] bio
Date Reply #9 on Sat 09 Aug 2003 02:58 AM (UTC)
Message
Woohoo! The healthbar thing works now! Thanks.

Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life.
[Go to top] top

Posted by David B   USA  (80 posts)  [Biography] bio
Date Reply #10 on Sat 09 Aug 2003 11:39 PM (UTC)
Message
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.

My code(with a LOT of Nicks help) to fame:

sub OnAutoCombo (TriggerName, TriggerLine, arrWildCards)
dim AutoCombo
AutoCombo = split (arrWildCards (1))
Dim i, attack
for i=lbound (AutoCombo ) to ubound (AutoCombo )
Select Case AutoCombo (i)
case "rp" attack = "punch right"
case "lp" attack = "punch left"
case "s" attack = "sweep"
case "r" attack = "roundhouse"
case else attack = "" ' unknown attack type
End Select
if i = ubound (AutoCombo ) then
world.send "throw " + world.getvariable ("attacker") + " down"
else
world.send attack + " " + world.GetVariable ("attacker")
end if
next
end sub
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Sun 10 Aug 2003 06:54 AM (UTC)
Message
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"


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


25,043 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]