Limb Tracker

Post Reply
Kyle
Posts: 30
Joined: Fri May 14, 2010 5:39 am

Limb Tracker

Post by Kyle »

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.

Yetzederixx
Posts: 186
Joined: Sun Nov 14, 2010 5:57 am

Re: Limb Tracker

Post by Yetzederixx »

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.

Riluo
Posts: 12
Joined: Sun Oct 24, 2010 5:30 am

Re: Limb Tracker

Post by Riluo »

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

Parnakra
Posts: 35
Joined: Tue Apr 21, 2009 10:48 am

Re: Limb Tracker

Post by Parnakra »

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
This should work (although it could use some error checking). You should escape the period in your regex trigger, though - that's just good practice.

I'm also confused why you concatenate the value of left_arm and matches[3] in the declaration of your table.

Riluo
Posts: 12
Joined: Sun Oct 24, 2010 5:30 am

Re: Limb Tracker

Post by Riluo »

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.

Post Reply