Limb Tracker
Limb Tracker
I'm looking for help with a simple script that would track each time I hit a person's limb. It' would be a limb counter for Achaea. I don't need anything fancy or complicated, just something that could keep track each time a successful hit goes off.
-
- Posts: 186
- Joined: Sun Nov 14, 2010 5:57 am
Re: Limb Tracker
I don't play IRE's, but you'd simply need a set of variables or a table for the limbs. I read a log from an IRE pvp fight once and it seems that you can/need to hit them multiple times.
You hit soandso's left arm
leftArmHit = leftArmHit +1
Soandso heals his left arm
leftArmHit = leftArmHit - 1
So on and so forth. A less complicated method would to use boolean values and names: isLeftArmHit = true or false which simplifies testing in other code.
limbTable {"la" = 0, "ra" = 0, "ll" = 0, "rl" = 0, "head" = 0}
Not sure if that's any easier than seperate variables honestly.
You hit soandso's left arm
leftArmHit = leftArmHit +1
Soandso heals his left arm
leftArmHit = leftArmHit - 1
So on and so forth. A less complicated method would to use boolean values and names: isLeftArmHit = true or false which simplifies testing in other code.
limbTable {"la" = 0, "ra" = 0, "ll" = 0, "rl" = 0, "head" = 0}
Not sure if that's any easier than seperate variables honestly.
Re: Limb Tracker
Using this script:
limbs = limbs or {head = 0, torso = 0, right_leg = 0, left_leg = 0, right_arm = 0, left_arm= 0 .. matches[3]}
Test Trigger:
A fatslub curl's (:?his|her) lips as they try to eat your (.+)."
local hitlimb = matches[3]
local hitlimb = hitlimb:gsub(" ", "_")
limbs[hitlimb] = limbs[hitlimb] + 1
if limbs[hitlimb] > 2 then
send("press jecis on " .. matches[3])
end
What would be the best way to set that limb back to 0 again. I have tried a few things like adding stuff after I send press jecis " ... Matches[3] etc. It applies perfectly on the third hit .... but it thinks it is still set to > 2 on that limb.
Tried things like using:
matches[3] = 0
AND
local hitlimb = matches[3]
local hitlimb = hitlimb:gsub(" ", "_")
limbs[hitlimb] = limbs[hitlimb] + 1
if limbs[hitlimb] > 2 then
send("press jecis on " .. matches[3])
local hitlimb = matches[3]
local hitlimb = hitlimb:gsub(" ", "_")
limbs[hitlimb] = limbs[hitlimb] - 2
end
I really suck at this.
limbs = limbs or {head = 0, torso = 0, right_leg = 0, left_leg = 0, right_arm = 0, left_arm= 0 .. matches[3]}
Test Trigger:
A fatslub curl's (:?his|her) lips as they try to eat your (.+)."
local hitlimb = matches[3]
local hitlimb = hitlimb:gsub(" ", "_")
limbs[hitlimb] = limbs[hitlimb] + 1
if limbs[hitlimb] > 2 then
send("press jecis on " .. matches[3])
end
What would be the best way to set that limb back to 0 again. I have tried a few things like adding stuff after I send press jecis " ... Matches[3] etc. It applies perfectly on the third hit .... but it thinks it is still set to > 2 on that limb.
Tried things like using:
matches[3] = 0
AND
local hitlimb = matches[3]
local hitlimb = hitlimb:gsub(" ", "_")
limbs[hitlimb] = limbs[hitlimb] + 1
if limbs[hitlimb] > 2 then
send("press jecis on " .. matches[3])
local hitlimb = matches[3]
local hitlimb = hitlimb:gsub(" ", "_")
limbs[hitlimb] = limbs[hitlimb] - 2
end
I really suck at this.
Re: Limb Tracker
Code: Select all
local hitlimb = matches[3]:gsub(" ","_")
limbs[hitlimb] = limbs[hitlimb] + 1
if limbs[hitlimb] > 2 then
send("press jecis on " .. matches[3])
limbs[hitlimb] = 0
end
I'm also confused why you concatenate the value of left_arm and matches[3] in the declaration of your table.
Re: Limb Tracker
Thank you for the help. As for why i did it this way.. well I got given some script by someone to learn from as i am a total newbie to this. And just added bits as to it as I went. If there is a better why of doing it, I would be only to happy to learn.
Again thank you.
Again thank you.