Gammon Forum
Entire forum
MUSHclient
Lua
lua scripting help
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Shou
USA (30 posts) bio
|
Date
| Sun 19 Dec 2010 11:25 PM (UTC) |
Message
| ok, i need some help with some math in a trigger.
the actual line is
You glance over Kaem and see that his health is at 310(1) of a possible 310(2).
(added in there)
i'm trying to find out a way to make the trigger do... lets say "kick kaem" when (1) is at 50% of (2). Does anyone know how i would be able to do this? |
My computer once beat me at chess, but it was no match for me at kickboxing. | top |
|
Posted by
| Shou
USA (30 posts) bio
|
Date
| Reply #2 on Mon 20 Dec 2010 07:08 AM (UTC) |
Message
| ok, thats really good, i tried it out and realized i needed something else. is there a way to also make it trigger when it is below 50%, not just at 50%? |
My computer once beat me at chess, but it was no match for me at kickboxing. | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #3 on Mon 20 Dec 2010 10:02 AM (UTC) |
Message
| The one I gave above, once pasted using the instructions on the link, actually reads:
if health / max_health <= 0.5 then
Send ("kick " .. target)
end -- if
That is, less than, or equal to 0.5 (50%). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| This_Guy
(13 posts) bio
|
Date
| Reply #4 on Sat 25 Dec 2010 07:34 PM (UTC) |
Message
| I'm using this trigger: * condition stands at */* health and */* mana.
and the following script:
<triggers>
<trigger
enabled="y"
match="* condition stands at */* health and */* mana."
send_to="12"
sequence="100"
>
<send>
local target = "%1"
local health = %2
local max_health = %3
local mana = %4
local_mana = %5
if health / max_health <= 0.5 then
Send ("incinerate " .. target)
end -- if
</send>
</trigger>
</triggers>
And i keep on getting this:
Kalcova's condition stands at 361/361 health and 274/274 mana.
Compile error
World: Imperian
Immediate execution
[string "Trigger: "]:1: unexpected symbol near '<'
So what exactly do i need to fix? | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #5 on Sat 25 Dec 2010 10:06 PM (UTC) |
Message
| What are you doing exactly? Did you paste all that into the Send box?
Can you show exactly your trigger?
|
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
What you pasted isn't a "script" it is an entire trigger.
Let's put it like this, this is what should be in the "send" box:
local target = "%1"
local health = %2
local max_health = %3
local mana = %4
local_mana = %5
if health / max_health <= 0.5 then
Send ("incinerate " .. target)
end -- if
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| This_Guy
(13 posts) bio
|
Date
| Reply #6 on Sat 25 Dec 2010 11:57 PM (UTC) |
Message
| sorry I had excess BS in the trigger, thanks for clearing it up | 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.
17,137 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
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.