SRL Archive - OSR Help

Progress report aint working


remco1337

2012-06-08 10:55:40

My Progress report isnt working please help :S

program ShantayCooker;
{$DEFINE SMART}
{$i srl\srl.simba}
var
Fish, FishCooked, FishBurned, CookLevel, Cookinglevel, Antibans:Integer;


const
RandomBreaks = False; // Make True False if you don't want random minibreaks 40sec
LongBreak = False; //Make True if you want 10-15 mins breaks.
FishExp = 30; // Amount of xp gain each cooked fish

procedure Antiban;
begin
case Random(2300) of
0..1: begin HoverSkill('cooking', False); Wait(300 + Random(500)); MMouse(256, 161, 250, 160); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
2..3: begin HoverSkill('firemaking', False); Wait(300 + Random(500)); MMouse(256, 161, 250, 160); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
4: begin HoverSkill('random', False); Wait(300 + Random(500)); MMouse(256, 161, 250, 160); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
5..7: begin RandomRClick; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
8..10: begin PickUpMouse; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
11..13: begin RandomMovement; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
14..16: begin BoredHuman;WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
17: begin ExamineInv; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
18..22: begin SleepAndMoveMouse(Random(5000)); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
25: begin FindNormalRandoms; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;

end;
end;
procedure CheckLevels;
begin
GameTab(Tab_Stats);
CookingLevel := GetSkillLevel('Cooking');
GameTab(Tab_Inv);
end;
Procedure TakeBreaks;
begin
debugLn('Doing small break like 40 sec')
Wait(30000 + Random(20000));

end;

Procedure TakeLongBreaks;
begin
debugLn('Doing Long break like 15 mins')
Wait(900000 + Random(40000));
Logout;
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Pin := ''; // Bank Pin. Leave it if you don't have one.
Players[0].Active := True;
end;
function BankScreenEx: boolean; //New
begin
result:= BankScreen or PinScreen;
end;

{function FindFire(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.23, 7.04);
if not(FindColorsTolerance(arP, 4236004, MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 39.80) and (X <= 54.84) and (Y >= 39.49) and (Y <= 51.18) and (Z >= 7.13) and (Z <= 14.56) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('ire')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;
}
function ClickFire: Boolean;
var
x, y:Integer;
begin

WriteLn('Clicking Fire');
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.18, 3.67);
if FindObjEx(x, y, ['ire', 'fir'], [5031675, 1207175, 1273740, 1406871 ,3383546], 15, 50, 1, 5, 689, 390) then
begin
FindNormalRandoms;
Mouse(x, y, 5 , 5, mouse_Right);
WaitOptionMulti(['Fire', 'ire'], 500);
Result := True;
end;
end;
Procedure Prog;
begin
if FindBlackChatMessage('accidently burne') then
FishBurned := FishBurned+1 else
if FindBlackChatMessage('successful cook some') then
FishCooked := FishCooked+1 else
if FindBlackChatMessage('Roast a') then
FishCooked := FishCooked+1 else
if FindBlackChatMessage('just advanced a') then
Cooklevel := Cooklevel+1;
end;
Procedure Cook;
var
Time, New, Old, CookLevel :integer;
begin
Repeat
Prog;
AntiBan;
FindNormalRandoms;
WriteLn('Cook');
Wait(1000+Random(1000));
MouseItem(RandomRange(1,28),mouse_Left);
wait(750+Random(500));
if(not ClickFire)then
Continue;
MarkTime(Time);
WriteLn('Waiting');
While(GetColor(272, 446) <> 2070783)do
begin
Wait(100+Random(300));
if(TimeFromMark(Time) > 8000)then
begin
WriteLn('Timeout');
exit;
end;
end;
WriteLn('Clicking icon');
prog;
MouseBox(233, 405, 287, 450, mouse_Left);
MarkTime(Time);
Prog;
WriteLn('Waiting again...');
Wait(38000+Random(2000));
antiban;
case random(5000) of
0..5: TakeBreaks;
end;
Old := CountColorTolerance(9739435, MIX1, MIY1, MIX2, MIY2, 10);
While(True)do
begin
New := CountColorTolerance(9739435, MIX1, MIY1, MIX2, MIY2, 10);
if(New <> Old)then
begin
Old := New;
MarkTime(Time);
end;
Wait(10+Random(30));
if(TimeFromMark(Time) > 4000)then
begin
WriteLn('Timeout');
FindNormalRandoms;
exit;
end;
end;
Until(True);
end;

function FindShantayChest: boolean; //ty erik
var a, tmpCTS, Tries: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
begin
result:=false;
if not LoggedIn then Exit;
if BankScreenEx then
begin
result:=true;
Exit;
end;
FindNormalRandoms;

tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.12);

if FindColorsSpiralTolerance(MSCX, MSCY, tpa, 6451582, MSX1, MSY1, MSX2, MSY2, 7) then
begin
ATPA:= TPAtoATPAEx(tpa, 25, 25);
for a:=0 to high(atpa) do
begin
MP:= MiddleTPA(atpa[a]);
Mouse(mp.x, mp.y, 4, 4, mouse_move);
if WaitUpText('Open', 500) then
begin
ClickMouse2(mouse_left);
if WaitFunc(@DidRedClick, 50, 1000) then
begin
writeln('Clicked Bank chest');
if WaitFunc(@BankScreenEx, 100, 5000) then
begin
writeln('BankScreen found');
result:= true;

break;
end;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;


Procedure Bank;
var
X, Y, P, a, tmpCTS, Tries : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
begin
FindNormalRandoms;
x := MSCX;
y := MSCY;
if not LoggedIn or FindNormalRandoms then
Exit;
Antiban;
// 5859188
//if FindObjTPA(X,Y, 2572631,5 ,1 ,20 ,20, 600, ['Open']) then
//if FindColorsSpiralTolerance(MSCX, MSCY, tpa, 6451582, MSX1, MSY1, MSX2, MSY2, 7) then
if FindShantayChest then
if PinScreen then
InPin(Players[CurrentPlayer].Pin);

if Bankscreen then
Wait(RandomRange(800, 1500));
if InvFull then
DepositAll;
WithDraw(0,0,0);
Closebank;
FindNormalRandoms;
Antiban;
Fish := Fish + 28
case random(10000) of
0..5: TakeBreaks;
end;
end;
procedure Progress;
var
FishPH,XPPH,GPPH:Integer;

begin
FishPH := Round((FishCooked * 3600) / (GetTimeRunning / 1000));
XPPH := Round(((FishCooked * FishExp) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('***********w100 Cookah**********');
Writeln('* ~By Remco1337~ ');
Writeln('*Fish Cooked: ' + IntToStr(FishCooked) + ' (' + IntToStr(FishPH) + ' P/H)');
Writeln('*Fish Burned: ' + IntToStr(FishBurned));
Writeln('*XP earned: ' + IntToStr(Fish * FishExp)+ ' (' + IntToStr(XPPH) + ' P/H)');
writeln('*Cooking Level: '+ IntToStr(CookingLevel));
Writeln('*Levels Gained: ' + IntToStr(CookLevel));
Writeln('*AntiBan Preformed: ' + IntToStr(Antibans));
Writeln('*Total Time: ' + TimeRunning);
Writeln('********************************');
end;
Procedure Startup;
begin
if not LoggedIn then
begin
repeat
FindNormalRandoms;
LoginPlayerToLob;
until LobbyScreen;

OpenWorldScreen;
if not WorldScreen then
OpenWorldScreen;
if WorldScreen then
begin
writeln('picking world 100');
SelectWorld(100);
LogInPlayer;
end;
end;
If loggedIn then
begin
Prog;
Antiban;
CheckLevels;
FindNormalRandoms;
debugln('Starting up');
MakeCompass('S');
GameTab(Tab_Inv);
SetAngle(SRL_ANGLE_HIGH);
end;
end;

Procedure Mainloop;
Begin
If LoggedIn then
debugln('Performing the mainloop');
FindNormalRandoms;
Progress;
Prog;
FindNOrmalRandoms;
Bank;
FindNormalRandoms;
Prog;
Cook;
AntiBan;
Prog;
FindNormalRandoms;
end;
begin
ClearDebug;
DeclarePlayers;
Smart_Server := 16;
Smart_Members := False;
Smart_Signed := False;
Smart_SuperDetail := False;
SetUpSRL;
if (RandomBreaks) then
TakeBreaks;
Startup;
repeat //Does the same thing as up above
MainLoop;
Antiban;
FindNormalRandoms;
until(AllPlayersInactive);
end.

NKN

2012-06-08 11:03:03

What is it doing wrong?

Not showing up?

remco1337

2012-06-08 11:05:18

The Progress report isnt working please help :S

program ShantayCooker;
{$DEFINE SMART}
{$i srl\srl.simba}
var
Fish, FishCooked, FishBurned, CookLevel, Cookinglevel, Antibans:Integer;


const
RandomBreaks = False; // Make True False if you don't want random minibreaks 40sec
LongBreak = False; //Make True if you want 10-15 mins breaks.
FishExp = 30; // Amount of xp gain each cooked fish

procedure Antiban;
begin
case Random(2300) of
0..1: begin HoverSkill('cooking', False); Wait(300 + Random(500)); MMouse(256, 161, 250, 160); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
2..3: begin HoverSkill('firemaking', False); Wait(300 + Random(500)); MMouse(256, 161, 250, 160); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
4: begin HoverSkill('random', False); Wait(300 + Random(500)); MMouse(256, 161, 250, 160); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
5..7: begin RandomRClick; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
8..10: begin PickUpMouse; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
11..13: begin RandomMovement; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
14..16: begin BoredHuman;WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
17: begin ExamineInv; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
18..22: begin SleepAndMoveMouse(Random(5000)); WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;
25: begin FindNormalRandoms; WriteLn('Performing Antiban'); Antibans := Antibans + 1; end;

end;
end;
procedure CheckLevels;
begin
GameTab(Tab_Stats);
CookingLevel := GetSkillLevel('Cooking');
GameTab(Tab_Inv);
end;
Procedure TakeBreaks;
begin
debugLn('Doing small break like 40 sec')
Wait(30000 + Random(20000));

end;

Procedure TakeLongBreaks;
begin
debugLn('Doing Long break like 15 mins')
Wait(900000 + Random(40000));
Logout;
end;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Pin := ''; // Bank Pin. Leave it if you don't have one.
Players[0].Active := True;
end;
function BankScreenEx: boolean; //New
begin
result:= BankScreen or PinScreen;
end;

{function FindFire(var fx, fy: Integer): Boolean;
var
arP, arAP: TPointArray;
arC, arUC: TIntegerArray;
ararP: T2DPointArray;
tmpCTS, i, j, arL, arL2: Integer;
P: TPoint;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.23, 7.04);
if not(FindColorsTolerance(arP, 4236004, MSX1, MSY1, MSX2, MSY2, 3)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
arUC := arC;
ClearSameIntegers(arUC);
arL := High(arUC);
arL2 := High(arC);

for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);

if (X >= 39.80) and (X <= 54.84) and (Y >= 39.49) and (Y <= 51.18) and (Z >= 7.13) and (Z <= 14.56) then
begin
for j := 0 to arL2 do
begin
if (arUC[i] = arC[j]) then
begin
SetLength(arAP, Length(arAP) + 1);
arAP[High(arAP)] := arP[j];
end;
end;
end;
end;

SortTPAFrom(arAP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arAP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('ire')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;
}
function ClickFire: Boolean;
var
x, y:Integer;
begin

WriteLn('Clicking Fire');
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(0.18, 3.67);
if FindObjEx(x, y, ['ire', 'fir'], [5031675, 1207175, 1273740, 1406871 ,3383546], 15, 50, 1, 5, 689, 390) then
begin
FindNormalRandoms;
Mouse(x, y, 5 , 5, mouse_Right);
WaitOptionMulti(['Fire', 'ire'], 500);
Result := True;
end;
end;
Procedure Prog;
begin
if FindBlackChatMessage('accidently burne') then
FishBurned := FishBurned+1 else
if FindBlackChatMessage('successful cook some') then
FishCooked := FishCooked+1 else
if FindBlackChatMessage('Roast a') then
FishCooked := FishCooked+1 else
if FindBlackChatMessage('just advanced a') then
Cooklevel := Cooklevel+1;
end;
Procedure Cook;
var
Time, New, Old, CookLevel :integer;
begin
Repeat
Prog;
AntiBan;
FindNormalRandoms;
WriteLn('Cook');
Wait(1000+Random(1000));
MouseItem(RandomRange(1,28),mouse_Left);
wait(750+Random(500));
if(not ClickFire)then
Continue;
MarkTime(Time);
WriteLn('Waiting');
While(GetColor(272, 446) <> 2070783)do
begin
Wait(100+Random(300));
if(TimeFromMark(Time) > 8000)then
begin
WriteLn('Timeout');
exit;
end;
end;
WriteLn('Clicking icon');
prog;
MouseBox(233, 405, 287, 450, mouse_Left);
MarkTime(Time);
Prog;
WriteLn('Waiting again...');
Wait(38000+Random(2000));
antiban;
case random(5000) of
0..5: TakeBreaks;
end;
Old := CountColorTolerance(9739435, MIX1, MIY1, MIX2, MIY2, 10);
While(True)do
begin
New := CountColorTolerance(9739435, MIX1, MIY1, MIX2, MIY2, 10);
if(New <> Old)then
begin
Old := New;
MarkTime(Time);
end;
Wait(10+Random(30));
if(TimeFromMark(Time) > 4000)then
begin
WriteLn('Timeout');
FindNormalRandoms;
exit;
end;
end;
Until(True);
end;

function FindShantayChest: boolean; //ty erik
var a, tmpCTS, Tries: Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
begin
result:=false;
if not LoggedIn then Exit;
if BankScreenEx then
begin
result:=true;
Exit;
end;
FindNormalRandoms;

tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.12);

if FindColorsSpiralTolerance(MSCX, MSCY, tpa, 6451582, MSX1, MSY1, MSX2, MSY2, 7) then
begin
ATPA:= TPAtoATPAEx(tpa, 25, 25);
for a:=0 to high(atpa) do
begin
MP:= MiddleTPA(atpa[a]);
Mouse(mp.x, mp.y, 4, 4, mouse_move);
if WaitUpText('Open', 500) then
begin
ClickMouse2(mouse_left);
if WaitFunc(@DidRedClick, 50, 1000) then
begin
writeln('Clicked Bank chest');
if WaitFunc(@BankScreenEx, 100, 5000) then
begin
writeln('BankScreen found');
result:= true;

break;
end;
end;
end;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;


Procedure Bank;
var
X, Y, P, a, tmpCTS, Tries : Integer;
TPA : TPointArray;
ATPA : T2DPointArray;
MP : TPoint;
begin
FindNormalRandoms;
x := MSCX;
y := MSCY;
if not LoggedIn or FindNormalRandoms then
Exit;
Antiban;
// 5859188
//if FindObjTPA(X,Y, 2572631,5 ,1 ,20 ,20, 600, ['Open']) then
//if FindColorsSpiralTolerance(MSCX, MSCY, tpa, 6451582, MSX1, MSY1, MSX2, MSY2, 7) then
if FindShantayChest then
if PinScreen then
InPin(Players[CurrentPlayer].Pin);

if Bankscreen then
Wait(RandomRange(800, 1500));
if InvFull then
DepositAll;
WithDraw(0,0,0);
Closebank;
FindNormalRandoms;
Antiban;
Fish := Fish + 28
case random(10000) of
0..5: TakeBreaks;
end;
end;
procedure Progress;
var
FishPH,XPPH,GPPH:Integer;

begin
FishPH := Round((FishCooked * 3600) / (GetTimeRunning / 1000));
XPPH := Round(((FishCooked * FishExp) * 3600) / (GetTimeRunning / 1000));
ClearDebug;
Writeln('***********w100 Cookah**********');
Writeln('* ~By Remco1337~ ');
Writeln('*Fish Cooked: ' + IntToStr(FishCooked) + ' (' + IntToStr(FishPH) + ' P/H)');
Writeln('*Fish Burned: ' + IntToStr(FishBurned));
Writeln('*XP earned: ' + IntToStr(Fish * FishExp)+ ' (' + IntToStr(XPPH) + ' P/H)');
writeln('*Cooking Level: '+ IntToStr(CookingLevel));
Writeln('*Levels Gained: ' + IntToStr(CookLevel));
Writeln('*AntiBan Preformed: ' + IntToStr(Antibans));
Writeln('*Total Time: ' + TimeRunning);
Writeln('********************************');
end;
Procedure Startup;
begin
if not LoggedIn then
begin
repeat
FindNormalRandoms;
LoginPlayerToLob;
until LobbyScreen;

OpenWorldScreen;
if not WorldScreen then
OpenWorldScreen;
if WorldScreen then
begin
writeln('picking world 100');
SelectWorld(100);
LogInPlayer;
end;
end;
If loggedIn then
begin
Prog;
Antiban;
CheckLevels;
FindNormalRandoms;
debugln('Starting up');
MakeCompass('S');
GameTab(Tab_Inv);
SetAngle(SRL_ANGLE_HIGH);
end;
end;

Procedure Mainloop;
Begin
If LoggedIn then
debugln('Performing the mainloop');
FindNormalRandoms;
Progress;
Prog;
FindNOrmalRandoms;
Bank;
FindNormalRandoms;
Prog;
Cook;
AntiBan;
Prog;
FindNormalRandoms;
end;
begin
ClearDebug;
DeclarePlayers;
Smart_Server := 16;
Smart_Members := False;
Smart_Signed := False;
Smart_SuperDetail := False;
SetUpSRL;
if (RandomBreaks) then
TakeBreaks;
Startup;
repeat //Does the same thing as up above
MainLoop;
Antiban;
FindNormalRandoms;
until(AllPlayersInactive);
end.

NKN

2012-06-08 11:07:18

Please refrain from making two threads about the same problem.

remco1337

2012-06-08 11:48:29

Ooh sorry I failed likely

remco1337

2012-06-08 11:49:41

It doenst change the cooked and burned :S

Runaway

2012-06-08 11:56:00

You call Prog; before and after cooking, but it won't work properly that way since all of the text you're searching for would appear while you're cooking. It's only going to catch the last message you receive every time unless you call it repeatedly while cooking.

remco1337

2012-06-08 12:29:46

So i have to make an repeat ?

Runaway

2012-06-08 13:16:58

Well, I'm assuming this part of the code is where you wait for it to finish cooking:


WriteLn('Waiting again...');
Wait(38000+Random(2000));

Instead you could do something like:


MarkTime(t);
repeat
Prog;
Wait(1500);
until (TimeFromMark(t) > 40000);

But that won't necessarily work well. It could read the same text twice or miss a line of text. You're better off using some sort of color check to find out how many were burned and then subtract that from 28 to get cooked/burned.

Saltyspoons

2012-06-08 19:43:15

Maybe you should change "accidently" to "accidentally". That could have some effect?

Nava2

2012-06-09 19:42:11

Threads merged.