Log in

View Full Version : Eat food error in script



sukomabawls
07-13-2007, 08:11 PM
my autofighter script thats being released soon has a few errors and i need some help working them out, so if you will test the main loop for me and you'll notice right away that after it kills the monster it doesnt even check if you need food or not, it just logs out and does the writeln i put in for the reason, you'll see... Also one tiny quick thing, this isnt very imprtant, but i think the attack type selection could use a quick upgrade, idk.
program SukomabawlsAutoFighter;
{.include SRL/SRL.scar}
{.include SRL/SRL/skill/fighting.scar}
var AJV:integer;
const //Make Sure You Are Logged In When The Script Starts
Color1 = 6512487;//Monster Colors In Lines 5-7
Color2 = 9012366;//You Can Fight Multiple Monsters, Just Add Their Colors Too!
Color3 = 7107444;
Color4 = 7236209;
Color5 = 6844271;
Color6 = 4804688;
MonsterName = 'Giant Rat';//Monster Name
Tol = 5;//Monster Finding Tolerance
TimeOut = 25000;//Keep This Number Over 15 Seconds(15000)
Skill = 'Strength';//What Skill To Train, Attack, Strength, Defence
clickr = false;// Keep This False

//Food Eating Section//
UseFood = True;// True or false
CurrentHP = 17;// Put Your HP Level Here
EatAt = 8;// What HP To Eat Food At
FightBack = 14;// Continue Fighting At What HP
Food = 7184764;// 2 Food Colors
Food2 = 5009237;// You Can Use 2 Different Food Items, Just Put 2nd Color Here
LogoutNow = 5;// Logout If HP Gets To This

procedure DeclarePlayers;
begin
Writeln('Thanks For Choosing My AutoFighter!');
Wait(5000);
ClearDebug;
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
Players[0].Name :='your pooned8';//Username Here
Players[0].Pass :='******';//Password Here
Players[0].Nick :='you'; // 3-4 Username Letters (No Caps!!)
Players[0].Active:= True;
end;

Procedure Heal;
Begin
If (UseFood = True) Then
WriteLn('Checking If Food Is Needed...');
If (GetHp <= EatAt) Then
repeat;
WriteLn('Eating Food, HP Too Low!');
GameTab(4);
If (GameTab(4)) Then
If (FindColorTolerance(x, y, Food, MIX1, MIY1, MIX2, MIY2, 3)or
FindColorTolerance(x, y, Food2, MIX1, MIY1, MIX2, MIY2, 3)) Then
MMouse(x, y, 2, 3);
If (IsUpText('Eat')) Then
MMouse(x, y, 2, 3);
Mouse(x, y, 2, 3, True);
AJV:=AJV+1;
until(GetHp >= FightBack);
end;


procedure Kill;
begin
FightNPC(Color1, Color2, Color3, Color4, Color5, Color6, tol, TimeOut)
end;

Procedure AntiRandomsAndBans;
begin
SRLRandomsReport;
BoredHuman;
RandomMovement;
HoverSkill(Skill, Clickr);
FindNormalRandoms;
AlmostLogout;
end;

procedure Health;
begin
If (GetHp <= LogoutNow) Then
Logout;
begin
Writeln('HP Got Too Low, You Were Logged Out!');
NextPlayer(True);
LoginPlayer;
end;
end;

Begin
SetupSRL;
DeclarePlayers;
Repeat
Kill;
Heal;
Kill;
Heal;
Health;
Kill;
Heal;
Kill;
Health;
AntiRandomsAndBans;
HoverSkill('Random', false);
wait(2453+Random(432));
Health;
Until(IsFKeyDown(5));
end.

Thanks if you can help, i really just need the EatFood function up and working, but the attack type selection would also be helpfull.

tpm1164
07-16-2007, 12:55 AM
take the if(GameTag(4)) thing out, then it should solve the food problem(it might not, but it should).

JAD
07-16-2007, 01:13 AM
Everybody thinks if you go if(GameTab(4))then will just result true if your on the game tab.. But if you call for just GameTab(4), it will click the game tab. I believe GameTab(4) results true if you weren't on the game tab specified and then clicks it. But, if you call GameTab(4) before the if(GameTab(4))then thing, it will result false because you will already have been on game tab 4.. So take that out and it should work =)

Santa_Clause
07-16-2007, 01:18 AM
What?! I thought GameTab(4) was a boolean. If it's on GameTab 4 already, it won't click. If it isn't, then it will.

JAD
07-16-2007, 01:22 AM
What?! I thought GameTab(4) was a boolean. If it's on GameTab 4 already, it won't click. If it isn't, then it will.

It is.. But people think, and try to use it like it just results true if you are on the tab, and results false if you are not on the tab. I believe it results true (didn't check) if it wasn't on the tab, and then it clicks the tab.

Anyways, even if I'm wrong, (to lazy to check.. :p) you don't need if(GameTab(4))then in there because you already called for it to open the inventory tab before that.. :p