Difference between revisions of "UO.GetHP"

From OpenEUO
Jump to: navigation, search
(Created page with " UO.GetHP ⇒ Returns the hit points of the targetted id as a percentage. I.E.: 100% Cheffe's code: <math>function GetHP(n) local i,nID,nHP,_ = 0 repeat _,_,_,_...")
 
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
UO.GetHP
  
 
+
Returns the hit points of the targetted id as a percentage.  I.E.: 100%  
UO.GetHP
+
 
+
Returns the hit points of the targetted id as a percentage.  I.E.: 100%  
+
  
 
Cheffe's code:
 
Cheffe's code:
  
<math>function GetHP(n)  
+
function GetHP(n)  
  local i,nID,nHP,_ = 0  
+
  local i,nID,nHP,_ = 0  
  repeat  
+
  repeat  
 
     _,_,_,_,_,_,nID,_,nHP = UO.GetCont(i)  
 
     _,_,_,_,_,_,nID,_,nHP = UO.GetCont(i)  
 
     i = i + 1  
 
     i = i + 1  
  until nID==n or nID==nil  
+
  until nID==n or nID==nil  
  return nHP  
+
  return nHP  
end  
+
end  
 
+
----------------------------------------
+
function Main()  
 
+
  UO.TargCurs = true  
function Main()  
+
  while UO.TargCurs do  
  UO.TargCurs = true  
+
    wait(1)  
  while UO.TargCurs do  
+
  end  
    wait(1)  
+
  local hp = GetHP(UO.LTargetID)  
  end  
+
  if not hp then  
 
+
    UO.StatBar(UO.LTargetID)  
  local hp = GetHP(UO.LTargetID)  
+
    wait(300)  
  if not hp then  
+
    hp = GetHP(UO.LTargetID)  
    UO.StatBar(UO.LTargetID)  
+
  end  
    wait(300)  
+
  if hp then  
    hp = GetHP(UO.LTargetID)  
+
    print("Target HP = "..hp.."%")  
  end  
+
  end  
 
+
end  
  if hp then  
+
 
    print("Target HP = "..hp.."%")  
+
Main()
  end  
+
end  
+
 
+
----------------------------------------
+
 
+
Main()</math>
+

Latest revision as of 17:29, 8 November 2010

UO.GetHP

Returns the hit points of the targetted id as a percentage. I.E.: 100%

Cheffe's code:

function GetHP(n) 
  local i,nID,nHP,_ = 0 
  repeat 
   _,_,_,_,_,_,nID,_,nHP = UO.GetCont(i) 
   i = i + 1 
  until nID==n or nID==nil 
  return nHP 
end 

function Main() 
  UO.TargCurs = true 
  while UO.TargCurs do 
    wait(1) 
  end    
  local hp = GetHP(UO.LTargetID) 
  if not hp then 
    UO.StatBar(UO.LTargetID) 
    wait(300) 
    hp = GetHP(UO.LTargetID) 
  end 
  if hp then 
    print("Target HP = "..hp.."%") 
  end 
end 
 
Main()