SRL Archive - SRL Archives

FindLamp fix


Shuttleu

2008-08-13 09:57:33

i noticed that FindLamp in AntiRandoms.scar had broken because the lamp had been updated and changed slightly so i decided to fix it
function FindLamp(skill: string): Boolean;
var
LampTime, x, y, i: Integer;
begin
GameTab(4);
if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
if (FindBitmapToleranceIn(Lamp, x, y, MIX1, MIY1, MIX2, MIY2, 40)) then
begin
Result := True;
Mouse(x, y, 1, 1, True);
Wait(1500 + Random(500));
MarkTime(LampTime);
for i:= 1 to 4 do
begin
case (LowerCase(Skill)) of
'attack': Mouse(61, 90, 35, 35, True);
'strength': Mouse(125, 97, 35, 35, True);
'ranged': Mouse(184, 97, 35, 35, True);
'magic': Mouse(241, 97, 35, 35, True);
'defence': Mouse(302, 95, 35, 5, True);
'crafting', 'craft': Mouse(358, 95, 35, 35, True);
'hitpoints', 'hp': Mouse(419, 95, 35, 35, True);
'prayer', 'pray': Mouse(60, 150, 35, 35, True);
'agility': Mouse(125, 150, 35, 35, True);
'herblore': Mouse(177, 150, 35, 35, True);
'thieving', 'thief': Mouse(237, 150, 35, 35, True);
'fishing', 'fish': Mouse(303, 150, 35, 35, True);
'runecraft', 'runecrafting': Mouse(356, 150, 35, 35, True);
'slayer', 'slay': Mouse(421, 150, 35, 35, True);
'farming', 'farm': Mouse(63, 205, 35, 35, True);
'mining', 'mine': Mouse(120, 205, 35, 35, True);
'smithing', 'smith': Mouse(180, 205, 35, 35, True);
'hunting', 'hunt', 'hunter': Mouse(241, 205, 35, 35, True);
'cooking', 'cook': Mouse(303, 205, 35, 35, True);
'firemaking', 'fire': Mouse(360, 205, 35, 35, True);
'woodcutting', 'wc': Mouse(428, 205, 35, 35, True);
'fletching', 'fletch': Mouse(180, 260, 35, 35, True);
'construction': Mouse(241, 260, 35, 35, True);
'summoning': Mouse(303, 260, 35, 35, True);
else Mouse(419, 95, 35, 35, True);
end;
Wait(500 + Random(200) + Random(100));
if FindColorTolerance(x, y, 5865621, 155, 117, 370, 250, 0) then Break;
if (TimeFromMark(LampTime) > 10000) then
begin
Result := False;
Logout;
Players[CurrentPlayer].Rand := 'Lamp';
Exit;
end;
end;
Mouse(380, 270, 70, 20, True);
Wait(500 + Random(150) + Random(150));
Inc(Lamps);
TakeScreen('Lamp Random Solved');
AddToSRLLog('******** SOLVED LAMP RANDOM ********');
//WriteFileString(TheFile, '******** SOLVED LAMP RANDOM ********' + Chr(13));
end;
end;
i dont know if this has already been fixed but if it hasn't then here they are

~shut

EDIT: here is what the lamp looks like now

tarajunky

2008-08-13 10:05:38

We should also add a function that will detect the text that RS spits out if you try to bank items like this, just in case the random handling breaks again.

"A magical force prevents you from banking this item."

Heavenzeyez1

2008-08-13 10:07:51

AFAIK some1 already fixed that ..
Not sure .
But thanks anyways .
~Eerik~

Harry

2008-08-13 10:20:45

Markus has already added to the Dev Repos, I am 99% sure.

Shuttleu

2008-08-13 10:23:21

oh ok im sorry for the useless post then

~shut

the scar noob

2008-08-13 10:27:41

Nice, but imo it's more beautiful to use "IntToPoint", like so:
function FindLamp(skill: string): Boolean;
var
LampTime, x, y, i: Integer;
P: TPoint;
begin
GameTab(4);
if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
if (FindBitmapToleranceIn(Lamp, x, y, MIX1, MIY1, MIX2, MIY2, 40)) then
begin
Result := True;
Mouse(x, y, 1, 1, True);
Wait(1500 + Random(500));
MarkTime(LampTime);
for i:= 1 to 4 do
begin
case (LowerCase(Skill)) of
'attack': P := IntToPoint(61, 90);
'strength': P := IntToPoint(125, 97);
'ranged': P := IntToPoint(184, 97);
'magic': P := IntToPoint(241, 97);
'defence': P := IntToPoint(302, 95);
'crafting', 'craft': P := IntToPoint(358, 95);
'hitpoints', 'hp': P := IntToPoint(419, 95);
'prayer', 'pray': P := IntToPoint(60, 150);
'agility': P := IntToPoint(125, 150);
'herblore': P := IntToPoint(177, 150);
'thieving', 'thief': P := IntToPoint(237, 150);
'fishing', 'fish': P := IntToPoint(303, 150);
'runecraft', 'runecrafting': P := IntToPoint(356, 150);
'slayer', 'slay': P := IntToPoint(421, 150);
'farming', 'farm': P := IntToPoint(63, 205);
'mining', 'mine': P := IntToPoint(120, 205);
'smithing', 'smith': P := IntToPoint(180, 205);
'hunting', 'hunt', 'hunter': P := IntToPoint(241, 205);
'cooking', 'cook': P := IntToPoint(303, 205);
'firemaking', 'fire': P := IntToPoint(360, 205);
'woodcutting', 'wc': P := IntToPoint(428, 205);
'fletching', 'fletch': P := IntToPoint(180, 260);
'construction': P := IntToPoint(241, 260);
'summoning': P := IntToPoint(303, 260);
end;
if ( Tp.x and Tp.y) <> 0 then
Mouse(Tp.x, Tp.y, 35, 35, True)
else
Mouse(419, 95, 35, 35, True);
Wait(500 + Random(200) + Random(100));
if FindColorTolerance(x, y, 5865621, 155, 117, 370, 250, 0) then Break;
if (TimeFromMark(LampTime) > 10000) then
begin
Result := False;
Logout;
Players[CurrentPlayer].Rand := 'Lamp';
Exit;
end;
end;
Mouse(380, 270, 70, 20, True);
Wait(500 + Random(150) + Random(150));
Inc(Lamps);
TakeScreen('Lamp Random Solved');
AddToSRLLog('******** SOLVED LAMP RANDOM ********');
//WriteFileString(TheFile, '******** SOLVED LAMP RANDOM ********' + Chr(13));
end;
end;

-Tsn.

Shuttleu

2008-08-13 10:36:58

From: the scar noob
Nice, but imo it's more beautiful to use "IntToPoint", like so:
function FindLamp(skill: string): Boolean;
var
LampTime, x, y, i: Integer;
P: TPoint;
begin
GameTab(4);
if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
if (FindBitmapToleranceIn(Lamp, x, y, MIX1, MIY1, MIX2, MIY2, 40)) then
begin
Result := True;
Mouse(x, y, 1, 1, True);
Wait(1500 + Random(500));
MarkTime(LampTime);
for i:= 1 to 4 do
begin
case (LowerCase(Skill)) of
'attack': P := IntToPoint(61, 90);
'strength': P := IntToPoint(125, 97);
'ranged': P := IntToPoint(184, 97);
'magic': P := IntToPoint(241, 97);
'defence': P := IntToPoint(302, 95);
'crafting', 'craft': P := IntToPoint(358, 95);
'hitpoints', 'hp': P := IntToPoint(419, 95);
'prayer', 'pray': P := IntToPoint(60, 150);
'agility': P := IntToPoint(125, 150);
'herblore': P := IntToPoint(177, 150);
'thieving', 'thief': P := IntToPoint(237, 150);
'fishing', 'fish': P := IntToPoint(303, 150);
'runecraft', 'runecrafting': P := IntToPoint(356, 150);
'slayer', 'slay': P := IntToPoint(421, 150);
'farming', 'farm': P := IntToPoint(63, 205);
'mining', 'mine': P := IntToPoint(120, 205);
'smithing', 'smith': P := IntToPoint(180, 205);
'hunting', 'hunt', 'hunter': P := IntToPoint(241, 205);
'cooking', 'cook': P := IntToPoint(303, 205);
'firemaking', 'fire': P := IntToPoint(360, 205);
'woodcutting', 'wc': P := IntToPoint(428, 205);
'fletching', 'fletch': P := IntToPoint(180, 260);
'construction': P := IntToPoint(241, 260);
'summoning': P := IntToPoint(303, 260);
end;
if ( Tp.x and Tp.y) <> 0 then
Mouse(Tp.x, Tp.y, 35, 35, True)
else
Mouse(419, 95, 35, 35, True);
Wait(500 + Random(200) + Random(100));
if FindColorTolerance(x, y, 5865621, 155, 117, 370, 250, 0) then Break;
if (TimeFromMark(LampTime) > 10000) then
begin
Result := False;
Logout;
Players[CurrentPlayer].Rand := 'Lamp';
Exit;
end;
end;
Mouse(380, 270, 70, 20, True);
Wait(500 + Random(150) + Random(150));
Inc(Lamps);
TakeScreen('Lamp Random Solved');
AddToSRLLog('******** SOLVED LAMP RANDOM ********');
//WriteFileString(TheFile, '******** SOLVED LAMP RANDOM ********' + Chr(13));
end;
end;

-Tsn.

yer well i just wanted to update it and not change it too much

plus it was only a quick fix

~shut

the scar noob

2008-08-13 10:41:07

From: Shuttleu
yer well i just wanted to update it and not change it too much

plus it was only a quick fix

~shut


I know, I know, it was only a suggestion and I'm bored, lol:p

-Tsn.

Shuttleu

2008-08-13 10:42:53

well if your bored then help me with this :)

~shut

Nava2

2008-08-16 15:34:32

It should be:

{*******************************************************************************
function FindLamp(skill: String): Boolean;
by: Pups, Starblaster100 and PriSoner and ShuttleU
Description: handles Genie. Results True if lamp found and handled.
skill: Skill to use with lamp eg. 'strength', 'attack', etc.
*******************************************************************************}

unction FindLamp(skill: string): Boolean;
var
LampTime, x, y, i: Integer;
P: TPoint;
begin
GameTab(4);
if FindColorTolerance(x, y, 1084300, MIX1, MIY1, MIX2, MIY2, 40) then
if (FindBitmapToleranceIn(Lamp, x, y, MIX1, MIY1, MIX2, MIY2, 40)) then
begin
Result := True;
Mouse(x, y, 1, 1, True);
Wait(1500 + Random(500));
MarkTime(LampTime);
for i:= 1 to 4 do
begin
case (LowerCase(Skill)) of
'attack': P := Point(61, 90);
'strength': P := Point(125, 97);
'ranged': P := Point(184, 97);
'magic': P := Point(241, 97);
'defence': P := Point(302, 95);
'crafting', 'craft': P := Point(358, 95);
'hitpoints', 'hp': P := Point(419, 95);
'prayer', 'pray': P := Point(60, 150);
'agility': P := Point(125, 150);
'herblore': P := Point(177, 150);
'thieving', 'thief': P := Point(237, 150);
'fishing', 'fish': P := Point(303, 150);
'runecraft', 'runecrafting': P := Point(356, 150);
'slayer', 'slay': P := Point(421, 150);
'farming', 'farm': P := Point(63, 205);
'mining', 'mine': P := Point(120, 205);
'smithing', 'smith': P := Point(180, 205);
'hunting', 'hunt', 'hunter': P := Point(241, 205);
'cooking', 'cook': P := Point(303, 205);
'firemaking', 'fire': P := Point(360, 205);
'woodcutting', 'wc': P := Point(428, 205);
'fletching', 'fletch': P := Point(180, 260);
'construction': P := Point(241, 260);
'summoning': P := Point(303, 260);
end;
if ((P.x and P.y) <> 0) then
Mouse(P.x, P.y, 35, 35, True)
else
Mouse(419, 95, 35, 35, True);
Wait(500 + Random(200) + Random(100));
if FindColorTolerance(x, y, 5865621, 155, 117, 370, 250, 0) then Break;
if (TimeFromMark(LampTime) > 10000) then
begin
Result := False;
Logout;
Players[CurrentPlayer].Rand := 'Lamp';
Exit;
end;
end;
Mouse(380, 270, 70, 20, True);
Wait(500 + Random(150) + Random(150));
Inc(Lamps);
//TakeScreen('Lamp Random Solved');
AddToSRLLog('******** SOLVED LAMP RANDOM ********');
//WriteFileString(TheFile, '******** SOLVED LAMP RANDOM ********' + Chr(13));
end;
end;

Just fixed some errors I found in TSN's version.