Difference between revisions of "UO.GetHP"

From OpenEUO
Jump to: navigation, search
 
(2 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%  
 
Returns the hit points of the targetted id as a percentage.  I.E.: 100%  
  
Cheffe's code:()
+
Cheffe's code:
  
 
  function GetHP(n)  
 
  function GetHP(n)  
Line 11: Line 13:
 
   return nHP  
 
   return nHP  
 
  end  
 
  end  
 
+
 
  function Main()  
 
  function Main()  
 
   UO.TargCurs = true  
 
   UO.TargCurs = true  
 
   while UO.TargCurs do  
 
   while UO.TargCurs do  
 
     wait(1)  
 
     wait(1)  
   end  
+
   end  
+
 
   local hp = GetHP(UO.LTargetID)  
 
   local hp = GetHP(UO.LTargetID)  
 
   if not hp then  
 
   if not hp then  
Line 24: Line 25:
 
     hp = GetHP(UO.LTargetID)  
 
     hp = GetHP(UO.LTargetID)  
 
   end  
 
   end  
 
+
  if hp then  
  if hp then  
+
    print("Target HP = "..hp.."%")  
    print("Target HP = "..hp.."%")  
+
  end  
  end  
+
end  
end  
+
 
+
Main()
Main()
+

Latest revision as of 16: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()