Log in

View Full Version : How to pickup multiple things



hogan
01-04-2012, 10:21 PM
How do i pickup more then 1 different drop?

I get an error using:

If(FindColorSpiralTolerance(x, y, [Charm, Charm1] , MSX1, MSY1, MSX2, MSY2, 5)) then


But not when i remove charm1:

if(FindColorSpiralTolerance(x, y, Charm , MSX1, MSY1, MSX2, MSY2, 5)) then


Or can i define charm at the top as more then 1 color?

jakeyboy29
01-04-2012, 10:23 PM
check out the SRL procedures, i think its something like\


If(FindColorSpiralTolerance(x, y, [''Charm'', ''Charm1''] , MSX1, MSY1, MSX2, MSY2, 5)) , ''Charm1'', ''Charm2'', ''Charm3'', ''Charm4'', ''Charm5'']then

hogan
01-04-2012, 10:28 PM
didnt mean to have the charm1 through 5 thing at the end i removed it now, and adding " didnt work

Press Play
01-04-2012, 10:29 PM
You should put:
If(FindColorSpiralTolerance(x, y, charm1 , MSX1, MSY1, MSX2, MSY2, 5))
or (FindColorSpiralTolerance(x, y, charm2 , MSX1, MSY1, MSX2, MSY2, 5)) then
and you can keep going for charm3, 4 etc!

Brandon
01-04-2012, 10:33 PM
you can NOT do this:

if(FindColorSpiralTolerance(x, y, Charm , MSX1, MSY1, MSX2, MSY2, 5)) , Charm1, Charm2, Charm3, Charm4, Charm5]then



Why the square brackets and round mixed? this is for an array [....] and (...) holds parameters or functions..

You can do


Items:= [{Array of colors here..}];
For I:= 0 To High(Items) do
Begin
if FindColorsSpiralTolerance(X, Y, TPA, Items[I], MSX1, MSY1, MSX2, MSY2, 10) then
begin
MiddleTPAEx(TPA, X, Y);
MMouse(X, Y, 0, 0);
if isUptextMultiCustom(.....) then
ClickMouse2(true);
end;
end;

hogan
01-04-2012, 10:35 PM
thanks buddy but i tried that and i get a syntax error after the first one... i dont understand why

here is the script: its for a private server so dont worry that its shitty

program Yakkiller;
{$i SRL/SRL.scar}
{$i SRL/SRL/skill/fighting.scar}
var
x,y:Integer;

const
Monster = 5670586;
Monster1 = 2568773;
Monster2 = 3489360;
AttTime = 1500;
XpCounter = 65860;
BlueCharm = 6381337;
Tolerance = 3;
Charm = 1413553;
Charm1= 2567019;
Charm2 = 936301;
Charm3 = 3885893;
Charm4 = 7576747;
Charm5 = 1101698;


Procedure AttackYak;
begin
if(FindColorSpiralTolerance(x, y, Monster, MSX1, MSY1, MSX2, MSY2, 5))then
begin
Mouse(x, y, 3, 3, True);
wait(5000)
end;
end;

Procedure WaitWhileFighting;
var FightTimer:integer;
begin
MarkTime(FightTimer);
if srl_InFight then
begin
repeat
wait(0);// This loop keeps checking if your in a fight for a maximum of 1 minute then quits
until(srl_InFight = False)or (TimeFromMark(FightTimer) > 1 * 60000)
end;
end;

Procedure Pickupdrop;
begin
if(FindColorSpiralTolerance(x, y, Charm, MSX1, MSY1, MSX2, MSY2, 5) or
if(FindColorSpiralTolerance(x, y, Charm1, MSX1, MSY1, MSX2, MSY2, 5) or
if(FindColorSpiralTolerance(x, y, Charm2, MSX1, MSY1, MSX2, MSY2, 5) or
if(FindColorSpiralTolerance(x, y, Charm3, MSX1, MSY1, MSX2, MSY2, 5) or
if(FindColorSpiralTolerance(x, y, Charm4, MSX1, MSY1, MSX2, MSY2, 5) or
if(FindColorSpiralTolerance(x, y, Charm5, MSX1, MSY1, MSX2, MSY2, 5) then
begin
Mouse(x, y, 0, 0, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;



procedure main;
begin
repeat
AttackYak;
WaitWhileFighting;
Pickupdrop;
until(false)
end;
begin
ClearDebug;
SetUpSrl;
ActivateClient;
main;
end.

Brandon
01-04-2012, 10:40 PM
No need for that many if statements.. also you might want to look into making case statements.. And some of your things are missing semi-colons at the end of them..
Example: Wait(0).. should have a semi-colon after it.. it's just good practice.


Procedure Pickupdrop;
begin
if(FindColorSpiralTolerance(x, y, Charm, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm1, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm2, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm3, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm4, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm5, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse(x, y, 0, 0, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;

jakeyboy29
01-04-2012, 10:43 PM
No need for that many if statements.. also you might want to look into making case statements.. And some of your things are missing semi-colons at the end of them..
Example: Wait(0).. should have a semi-colon after it.. it's just good practice.


Procedure Pickupdrop;
begin
if(FindColorSpiralTolerance(x, y, Charm, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm1, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm2, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm3, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm4, MSX1, MSY1, MSX2, MSY2, 5) or
FindColorSpiralTolerance(x, y, Charm5, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
Mouse(x, y, 0, 0, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;


pretty (99% sure) there is a much better way of doing it. ill go on my laptop and get it for you

hogan
01-04-2012, 10:43 PM
Tried adding the array thing but it didnt work still getting errors.

Like i said i know its shitty but idc cause its for a private server i just need the drop thing to work

program Yakkiller;
{$i SRL/SRL.scar}
{$i SRL/SRL/skill/fighting.scar}
var
x,y:Integer;

const
Monster = 5670586;
Monster1 = 2568773;
Monster2 = 3489360;
AttTime = 1500;
XpCounter = 65860;
BlueCharm = 6381337;
Tolerance = 3;
Charm = 1413553;
Charm1= 2567019;
Charm2 = 936301;
Charm3 = 3885893;
Charm4 = 7576747;
Charm5 = 1101698;


Procedure AttackYak;
begin
if(FindColorSpiralTolerance(x, y, Monster, MSX1, MSY1, MSX2, MSY2, 5))then
begin
Mouse(x, y, 3, 3, True);
wait(5000)
end;
end;

Procedure WaitWhileFighting;
var FightTimer:integer;
begin
MarkTime(FightTimer);
if srl_InFight then
begin
repeat
wait(0);// This loop keeps checking if your in a fight for a maximum of 1 minute then quits
until(srl_InFight = False)or (TimeFromMark(FightTimer) > 1 * 60000)
end;
end;

Procedure PickUpDrop;
Begin
Items:= [1413553, 2567019, 936301, 3885893, 7576747, 1101698];
For I:= 0 To High(Items) do
Begin
if FindColorsSpiralTolerance(X, Y, TPA, Items[I], MSX1, MSY1, MSX2, MSY2, 10) then
begin
MiddleTPAEx(TPA, X, Y);
MMouse(X, Y, 0, 0);
if isUptextMultiCustom(.....) then
ClickMouse2(true);
end;
end;
end;


procedure main;
begin
repeat
AttackYak;
WaitWhileFighting;
Pickupdrop;
until(false)
end;
begin
ClearDebug;
SetUpSrl;
ActivateClient;
main;
end.

Mark
01-04-2012, 10:44 PM
you can NOT do this:

if(FindColorSpiralTolerance(x, y, Charm , MSX1, MSY1, MSX2, MSY2, 5)) , Charm1, Charm2, Charm3, Charm4, Charm5]then



Why the square brackets and round mixed? this is for an array [....] and (...) holds parameters or functions..

You can do


Items:= [{Array of colors here..}];
For I:= 0 To High(Items) do
Begin
if FindColorsSpiralTolerance(X, Y, TPA, Items[I], MSX1, MSY1, MSX2, MSY2, 10) then
begin
MiddleTPAEx(TPA, X, Y);
MMouse(X, Y, 0, 0);
if isUptextMultiCustom(.....) then
ClickMouse2(true);
end;
end;


why didnt this work?

change this
var
x,y:Integer;

to this
i,x,y:Integer;
Items:TintegerArray;
TPA:TpointArray;

hogan
01-04-2012, 10:47 PM
i dont know, copy my scipt into simba and just attempt to hit run and compile it gives unknown identifier as an error

Kyle Undefined
01-04-2012, 10:49 PM
ggzz's loop would work for that perfectly, why not use that?

What's the error?

jakeyboy29
01-04-2012, 10:49 PM
Function FindColour(var X, Y: Integer): Boolean;
var
CTS: Integer;
TPA: TPointArray;
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 1.22);

Result:= FindObjectFX(TPA, ['5331916', 'another colour', 'more colour', 'more', 'more', 'more'], ['barrier', 'Pass', 'ed barrier', 'ed bar'], MSX1, MSY1, MSX2, MSY2, 10, 10, 20, True);

SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
end;

Mark
01-04-2012, 10:50 PM
here you go comapre this line by lien to yours see whats dif a few things where missed

program Yakkiller;
{$i SRL/SRL.scar}
{$i SRL/SRL/skill/fighting.scar}
var
i,x,y:Integer;
Items:TintegerArray;
TPA:TpointArray;
const
Monster = 5670586;
Monster1 = 2568773;
Monster2 = 3489360;
AttTime = 1500;
XpCounter = 65860;
BlueCharm = 6381337;
Tolerance = 3;
Charm = 1413553;
Charm1= 2567019;
Charm2 = 936301;
Charm3 = 3885893;
Charm4 = 7576747;
Charm5 = 1101698;


Procedure AttackYak;
begin
if(FindColorSpiralTolerance(x, y, Monster, MSX1, MSY1, MSX2, MSY2, 5))then
begin
Mouse(x, y, 3, 3, True);
wait(5000)
end;
end;

Procedure WaitWhileFighting;
var FightTimer:integer;
begin
MarkTime(FightTimer);
if srl_InFight then
begin
repeat
wait(0);// This loop keeps checking if your in a fight for a maximum of 1 minute then quits
until(srl_InFight = False)or (TimeFromMark(FightTimer) > 1 * 60000)
end;
end;

Procedure PickUpDrop;
Begin
Items:= [1413553, 2567019, 936301, 3885893, 7576747, 1101698];
For I:= 0 To High(Items) do
Begin
if FindColorsSpiralTolerance(X, Y, TPA, Items[I], MSX1, MSY1, MSX2, MSY2, 10) then
begin
MiddleTPAEx(TPA, X, Y);
MMouse(X, Y, 0, 0);
if isUptextMultiCustom(['.....']) then
ClickMouse2(true);
end;
end;
end;
begin
end.

hogan
01-04-2012, 10:50 PM
just put Items:TintegerArray; at the top

now i get unknown identifier for the "I" in

For I:= 0 To High(Items) do

Mark
01-04-2012, 10:52 PM
just put Items:TintegerArray; at the top

now i get unknown identifier for the "I" in

For I:= 0 To High(Items) do

that means you need to declare what its telling you
in your variables( Var)

edit: be careful whe nyou just copy and paste people code it not meant to work for everything there just examples to give you ideas