Poppee
2013-05-07 12:26:51
How can i add eating to my autofighter (07scape)
Thank you for help!
Sk1nyNerd
2013-05-07 12:44:37
is it OSR or P07, ive done both. You will need to do a combination of reading how many green pixels are left in your hp, pixel shift, and checking skills tab
Poppee
2013-05-07 12:51:59
[SIMBA=program GoblinGETDOWN; {$DEFINE SMART8} {$I SRL-OSR/SRL.Simba} {$I SRL-OSR/SRL/Misc/Debug.Simba} const goblinCOLOR1 = 5142839; goblinCOLOR2 = 2720940; greenLifeBar = 65280; var x, y, x1, y1: Integer; //Declare your username and password procedure DeclarePlayer; begin HowManyPlayers := 1; NumberOfPlayers(HowManyPlayers); CurrentPlayer := 0; with Players[0] do begin Name := ''; Pass := ''; Active := True; end; end; //More human like movement Procedure HumanMove; Begin case random(200) of 1..160: MMouse(RandomRange(X - 7, X + 7), RandomRange(y - 7, y + 7), 0, 0); 161..190: MMouse(RandomRange(X - 9, X + 9), RandomRange(y - 9, y + 9), 0, 0); 191..200: MMouse(RandomRange(X - 12, X + 12), RandomRange(y - 12, y + 12), 0, 0); End; End; procedure Antiban; begin case Random(100) of 1: HoverSkill('strenght', False); 2: HoverSkill('random', False); 3: Boredhuman; 4: Wait(2500 + random(4500)); 5: HoverSkill('attack', False); 6: PickUpMouse; 7: RandomMovement; 8: RandomRClick; end; end; procedure MiniBreaker; begin case Random(160) of 1: Wait(4000 + random(7400)); 2: Wait(2550 + random(8550)); 3: Wait(6004 + random(6759)); 4: Wait(2040 + random(2549)); end; end; procedure ClickGoblin; begin if (not LoggedIn) then begin LogInPlayer; MakeCompass('N'); KeyDown(VK_UP); Wait(RandomRange(1500, 2500)); KeyUp(VK_UP); end; repeat repeat wait(1200); until (FindColor(x, y, greenLifeBar, 206, 127, 298, 196) = false); if FindObjCustom(x, y, ['Goblin'], [goblinCOLOR1, goblinCOLOR2], 25) then begin x := x - 40; y := y - 40; if x < 0 then begin x := 0; end; if y < 0 then begin y := 0; end; end else begin KeyDown(VK_RIGHT); repeat Wait(RandomRange(50, 100)); until (FindObjCustom(x, y, ['Goblin'], [goblinCOLOR1, goblinCOLOR2], 5)) KeyUp(VK_RIGHT); end; if FindColor(x1, y1, greenLifeBar, x, y, x + 40, y + 40) = false then begin x := x + 40; y := y + 40; MMouse(x, y, 3, 3); Writeln('Goblins..Lets get experience!'); ClickMouse2(mouse_left); end else begin case Random(2) of 0: Antiban(); 1: MiniBreaker(); end; end; wait(2000); until (false) end; begin ClearDebug; SetupSRL; DeclarePlayer; ActivateClient; Wait(2000); ClickGoblin; end.]
l6bustank
2013-05-07 13:35:16
use a for…to…do loop for eating and check hp by finding hp bar color in a box that is ~in the middle of the MainScreen.
Poppee
2013-05-07 13:39:12
Cant find any tutorial about loop eating
EngageTheRage
2013-05-07 13:43:32
another way you can do it is to get your hp from the skill tab (the top number) and say if that is below a certain value, then eat.
Poppee
2013-05-07 13:54:47
Could u add some code here ? : D
How do i add this to my script.. tried kinda many ways
[SIMBA=procedure eating_food; begin if GetSkillInfo('hitpoints', true) > HpToEat then begin status := ' checking hp' wait(700+random(200)) antiban; end else begin gametab(tab_inv) wait(120+ random (200)) if gametab(tab_inv) Then begin if FindObjEx(X, Y, ['at', foodname], [foodcolor1, foodcolor2, foodcolor3], 10, 50, MIX1, MIY1, MIX2, MIY2) THEN begin status := ' eating' MouseBox(X+3, Y+3, X+3, Y+3, mouse_left); sleep(1000+random(1000)) gametab(tab_stats) end else begin status := ' out of food, logging out after 20 seconds' TabDTM := DTMFromString('m1gAAAHic42JgYOAFYmkg5gJiESBmBWJ+BgSQhmKQOh4kvjRUXgKqlw2IRYE4KykJSDISxP8ZiAOETYJgBAAAz9MDgg=='); if FindDTM(TabDTM, x, y, MIX1, MIY1, MIX2, MIY2) then begin MouseBox(X+1, Y+1, X+1, Y+1, mouse_left); sleep(10000+random(4000)) logout; FreeDTM(TabDTM); terminatescript; end; end end end end;]
EngageTheRage
2013-05-07 14:01:01
i think that was aimed at me ??? well here's a snippet of how i sometimes eat …
procedure Eat;
var
hitpoints, xc, yc: Integer;
begin
gametab(tab_stats);
MyDeBug('Started eat');
hitpoints := getskillinfo('hp', True);
if hitpoints < 10 then
begin
GetMeOutOfHere;
end;
if hitpoints < 30 then
begin
MyDeBug('hp below 30, time to eat');
gametab(tab_inv);
FindNormalRandoms;
if FindDTM(foodDTM, xc, yc, MIX1, MIY1, MIX2, MIY2) then
begin
MyDeBug('found food so about to eat it!');
MMouse(xc, yc, 2, 2);
wait(randomrange(50,150));
ClickMouse2(True);
wait(randomrange(400,800));
end else
begin
MyDeBug('no food! runnnnn');
GetMeOutOfHere;
end;
gametab(tab_stats);
end;
end;
foodDTM is set at the beginning when the user chooses which type of food they will be using :)
Poppee
2013-05-07 14:08:34
Like this ?
procedure EattheFood;
begin
HpPercenttoEat := round(55 * (PercenttoEat/100));
if(EatFood = 1) then
begin
repeat
if(CountColorTolerance(65280, 224, 80, 294, 150, 1) < HpPercenttoEat) then
begin
writeln(FloatToStr(CountColorTolerance(65280, 224, 114, 294, 150, 1)));
DrawCustomPaint('Eating', IntToStr(competitionsplayedcount), FloatToStr(expgained), IntToStr(ticketsgained), IntToStr(ctw), TimeRunning, FloatToStr(expperhour));
writeln('Your Hp is below ' + IntToStr(PercenttoEat) + ' percent! Looking for food…');
Open_Inv_Tab;
wait(randomrange(500,1450));
if P07_FindObjEx(x, y, ['at', FoodName], [FoodColor1, FoodColor2], 5, 50, MIX1, MIY1, MIX2, MIY2) then
begin
writeln('Food found! Eating food…');
MMouse(x,y,2,2);
wait(randomrange(50,150));
ClickMouse2(mouse_left);
wait(randomrange(100,450));
end
else
begin
DrawCustomPaint('Food not found!', IntToStr(competitionsplayedcount), FloatToStr(expgained), IntToStr(ticketsgained), IntToStr(ctw), TimeRunning, FloatToStr(expperhour));
writeln('Food not found!');
FoodnotFound := FoodnotFound + 1;
Exit;
end;
end
else
Exit;
until(CountColorTolerance(65280, 224, 80, 294, 150, 1) > HpPercenttoEat);
end;
if(EatFood = 0) then
Exit;
end;