Sk1nyNerd
2013-05-30 02:22:25
So I'm making an AIO script therefore the colors, tolerances and ect and some other things arent present, theyre way up top. im using one function for all the foods :] but any ways thanks to Flight im getting a grasp on ATPA's and im curious as how i could sort it so it searches my inv row by row starting in the 1st slot looking for food rather than from the center out. Most people dont eat food that way :P. comments suggestions concerns?
(this is just a outline, i plan on using percents so it can be easily translated with the hp bar. and this is for 07)
thanks in advance
(this is just a outline, i plan on using percents so it can be easily translated with the hp bar. and this is for 07)
thanks in advance
function FindFood: Boolean;
var
FoodTPA, FoodTempTPA: TPointArray;
FoodATPA: Array of TPointArray;
x, y, i, CTS: Integer;
begin
Result := False;
CurrentHp := GetSkillInfo('hitpoints', True);
RandomHealth := randomrange(-3,3);
repeat
if(not GameTab(tab_Inv)) then
begin
GameTab(tab_Inv);
end;
if(TimeFromMark(FindTime) > 15000) then
begin
writeln('The time to find your food has expired!');
LogOut;
TerminateScript;
end;
CTS := GetToleranceSpeed;
ColorToleranceSpeed(2);
for i:=0 to High(FoodColors) do
begin
SetToleranceSpeed2Modifiers(FoodHueMods[i],FoodSatMods[i]);
FindColorsTolerance(FoodTempTPA, FoodColors[i], MIX1, MIY1, MIX2, MIY2, FoodTolerances[i]);
AppendTPA(FoodTPA,FoodTempTPA);
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2,0.2);
if (High(FoodTPA)> 0) then
begin
FoodATPA := SplitTPA(FoodTPA,10);
SortATPASize(FoodATPA,True);
for i:=0 to High(FoodATPA) do
begin
if High(FoodATPA[i]) < FoodMinPoints then
Break;
end;
if i = 0 then Exit;
SetArrayLength(FoodATPA,i);
SortATPAFromFirstPoint(FoodATPA,Point(MICX, MICY));
for i:=Low(FoodATPA) to Min(High(FoodATPA),3) do
begin
MiddleTPAEX(FoodATPA[i],x,y);
MMouse(RandomRange(x-10,x+10),RandomRange(y-10,y+10),0,0);
if WaitUpTextMulti([FoodUpText], randomrange(200,600)) then
if IsUpTextMultiCustom([FoodUpText]) then
begin
ClickMouse2(mouse_left);
wait(750 + randomrange(250,1000));
CurrentHp := (CurrentHp + HealthHeals + RandomHealth);
end;
begin
Result := True;
Exit;
end;
end;
end else
begin
Result := False;
writeln('We are out of food!');
Logout;
TerminateScript;
end;
until(CurrentHp > HptoEat);
GameTab(tab_Stats);
end;