Boreas
2006-11-15 16:01:51
I wrote a seaweed collector for shilo village (start in bank with at least 2 seaweed in first bank slot,username and pass setup is a way down) and it worked ok, but I made a few things better. When I made those changes I screwed other stuff help, and now I don't know what to do. Any ideas?
By the way it works by withdrawing 1 seaweed to calibrate color because the color in inventory is the same as on MS. It gets 3 seaweed from left to right, then click below the river to start going back, then when it sees the questcolor, it stops and gets another 3. It does this 9 times then when it starts going back it keeps going, and banks. If there's anything else you need to know please ask. Also please keep this members only, even keep the fact that seaweed collecting is autoable a secret, because there's no randoms and I want to keep it that way.
By the way it works by withdrawing 1 seaweed to calibrate color because the color in inventory is the same as on MS. It gets 3 seaweed from left to right, then click below the river to start going back, then when it sees the questcolor, it stops and gets another 3. It does this 9 times then when it starts going back it keeps going, and banks. If there's anything else you need to know please ask. Also please keep this members only, even keep the fact that seaweed collecting is autoable a secret, because there's no randoms and I want to keep it that way.
program new;
{.include srl\srl.scar}
var questcolor,tries1,bridge,a,i,tries,red,seaweedcolor:integer;
findyellowdone:boolean;
procedure waittilstill;
var
points: array [0..17] of tpoint;
color: array [0..17] of integer;
oldcolor: array [0..17] of integer;
gh,hg,same: integer;
begin
points[1].x:=600
points[1].y:=30
points[2].x:=630
points[2].y:=30
points[3].x:=660
points[3].y:=30
points[4].x:=690
points[4].y:=30
points[5].x:=600
points[5].y:=60
points[6].x:=630
points[6].y:=60
points[7].x:=660
points[7].y:=60
points[8].x:=690
points[8].y:=60
points[9].x:=600
points[9].y:=90
points[10].x:=630
points[10].y:=90
points[11].x:=660
points[11].y:=90
points[12].x:=690
points[12].y:=90
points[13].x:=600
points[13].y:=120
points[14].x:=630
points[14].y:=120
points[15].x:=660
points[15].y:=120
points[0].x:=690
points[0].y:=120
gh:=17;
repeat
wait(50);
gh:=gh+1;
hg:=(gh mod 16);
oldcolor[hg]:=color[hg];
color[hg]:=getcolor(points[hg].x,points[hg].y);
if (color[hg]=oldcolor[hg]) then same:=same+1;
if not(color[hg]=oldcolor[hg]) then same:=0;
until same>=10;
end;
type ybox = record
x1,y1,x2,y2,cx,cy:integer;
active:boolean;
end;
type tehpoint = record
x,y :integer;
active : boolean;
end;
type combo = record
point1,point2,x1,y1,x2,y2,dist:integer;
active:boolean;
end;
procedure findyellows (var fx, fy:integer; PointsToFind,width,basex,basey,endx,endy:integer);
var
box :array of ybox;
ypoint : array of tehpoint;
x,d,e,nob,fyx,fyy,currentpoint,lp,ldistance,row,prow,col,nor,noc:integer;
begin
noc:=(( (endx-basex) - (width mod (endx-basex)))/width)+1;
nor:=(( (endy-basey) - (width mod (endy-basey)))/width)+1;
nob:=nor*noc;
setarraylength(box, ((nob)+2));
repeat
x:=x+1;
if ((x+noc) mod noc)>0 then
col:=((x+noc) mod noc);
if ((x+noc) mod noc) =0then
col:=noc;
prow:=0;
repeat
prow:=prow+1;
until ( x<=(noc*prow));
row:=prow;
box[x].x1:=(basex+ ((col-1)*width) );
box[x].x2:=(basex+(col*width));
box[x].y1:=(basey+ ((row-1)*width) );
box[x].y2:=(basey+(row*width));
box[x].cx:=round((box[x].x2+box[x].x1)/2);
box[x].cy:=round((box[x].y2+box[x].y1)/2);
box[x].active:=true;
{
//draws the boxes on paint
movemouse(box[x].x1,box[x].y1);
holdmouse(box[x].x1,box[x].y1,true);
movemouse(box[x].x2,box[x].y2);
releasemouse(box[x].x2,box[x].y2,true);
}
until x>=nob;
currentpoint:=1;
d:=0;
setarraylength(ypoint, pointstofind+1);
repeat
d:=d+1;
if (box[d].active) then
begin
if findcolor(fyx,fyy,195836,box[d].x1,box[d].y1,box[d].x2,box[d].y2) then
begin
ypoint[currentpoint].x :=fyx;
ypoint[currentpoint].y :=fyy;
currentpoint:=currentpoint+1;
box[d].active:=false;
end;
end;
until (( currentpoint= pointstofind)or (d=nob));
e:=0;
ldistance:=1000;
findsymbol(x,y,'bank');
repeat
if (not (ypoint[e].x = 0) and not(ypoint[e].y=0)) then
begin
if Round(Sqrt(Sqr(ypoint[e].x - x) + Sqr(ypoint[e].y -y))) <ldistance then
begin
ldistance:=Round(Sqrt(Sqr(ypoint[e].x - x) + Sqr(ypoint[e].y -y)));
lp:=e;
end;
end;
e:=e+1;
until e=(getarraylength(ypoint)-1);
fx:=ypoint[lp].x;
fy:=ypoint[lp].y;
findyellowdone:=true;
/////////--------------------analysis end--------------------------
end;
Function angledir(angle,Side:String): Boolean;
Var
Fx, Fy, Dx, Dy : Integer;
ComMark: Integer;
Left_Right : Boolean;
Begin
MarkTime(ComMark);
Case LowerCase(Side) Of
'n' : Begin Fx := 566; Fy := 13; End;
'e' : Begin Fx := 560; Fy := 19; End;
's' : Begin Fx := 566; Fy := 27; End;
'w' : Begin Fx := 573; Fy := 20; End;
end;
If FindColor(Dx,Dy,723587,Fx,Fy,Fx,Fy) Then
begin
Result:=True;
case angle of
'h':
begin
if (Loggedin) then
begin
keydown(38);
sleep(1000 + random(100) + random(200));
keyup(38);
wait(1000 + random(100));
end;
end;
'l':
begin
if (Loggedin) then
begin
keydown(40);
sleep(1000 + random(100) + random(200));
keyup(40);
wait(1000 + random(100));
end;
end;
end;
Exit;
end
If Random(2) = 1 Then Left_Right := True
Else Left_Right := False;
If Left_Right Then
begin
case angle of
'h':keydown(38);
'l':keydown(40);
end;
KeyDown(VK_RIGHT)
end
Else
begin
case angle of
'h':keydown(38);
'l':keydown(40);
end;
KeyDown(VK_Left);
end;
Repeat
Wait((10)+ Random(10));
If(FindColor(Dx,Dy,723587,Fx,Fy,Fx,Fy))then
begin
Result := True;
break;
end;
Until(TimeFromMark(ComMark) > 7000);
If Left_Right Then
begin
case angle of
'h':keyup(38);
'l':keyup(40);
end;
KeyUp(VK_Right);
end
Else
begin
case angle of
'h':keyup(38);
'l':keyup(40);
end;
KeyUp(VK_Left);
end;
End;
begin
setupsrl;
mousespeed:=20;
HowManyPlayers := 2;
CurrentPlayer:=0;
NumberOfPlayers(HowManyPlayers);
Players[0].Name :='';
Players[0].Pass :='';
Players[1].Name :='';
Players[1].Pass :='';
activateclient;
if not(loggedin) then loginplayer;
red:= DTMFromString('78DA637CC6C4C0F0910105C0B88C501A004C4' +
'502CD');
bridge:= DTMFromString('78DA634C6762608867400179FE460C29409A1' +
'188FF0301630AA69AF7EF9FC0D580006312A69AEAFEEDA86AB289' +
'302787B03900B02513D9');
repeat
angledir('l','n');
repeat
findsymbol(x,y,'bank');
mouse(x,y,5,5,true);
repeat
findyellows(x,y,16,10,590,30,700,120);
mouse(x,y,3,3,true);
countflag(0);
tries1:=0;
repeat
mmouse(207+random(303-207), 132+random(199-132),0,0);
tries1:=tries1+1;
until( (isuptextmulti('Banker','ank','ker')) or (tries1>5));
until isuptextmulti('Banker','ank','ker');
getmousepos(x,y);
mouse(x,y,0,0,false);
mouse(x-5+random(10),y+40+random(5),0,0,true);
wait(2000);
until bankscreen;
//-----find banker dudes and open bank
fixbank;
Depositall;
withdraw(1,1,1);
angledir('h','n');
findsymbol(x,y,'bank');
mouse(((x-3)+random(2)),(y-(10+random(3))),0,0,true);
gametab(4);
waittilstill;
mouse(588+random(611-588),70+random(96-70),2,2,true);
countflag(0);
mouse(643,58,5,5,true);
countflag(0);
// repeat //
// wait(50); //
// until isfkeydown(12);//
findmmdtm(x,y,bridge);
mouse(x,y,3,3,true);
seaweedcolor:=getcolor(583,224);
countflag(0);
findsymbolcolorifneeded('quest', false,questcolor);
repeat
repeat
repeat if (not(((invcount+2) mod 3)=0)or( invcount=1)or (i=3)) then begin
repeat if (not(((invcount+2) mod 3)=0)or( invcount=1)or (i=3)) then begin
a:=getsystemtime;
repeat if (not(((invcount+2) mod 3)=0)or( invcount=1)or (i=3)) then begin
repeat
wait(100)
until (findmmdtm(x,y,red) or ((getsystemtime-a)>10000));
if not(findmmdtm(x,y,red)) then
begin
logout;
loginplayer; a:=getsystemtime;
findmmdtm(x,y,red)
end; end;
until (FindDTM(red, x, y, 620, 8, 723, 158));
mouse(x,y,3,3,true);
waittilstill;
wait(100);
gametab(4);
seaweedcolor:=getcolor(583,224);
wait(100); end;
until findcolor(x,y,seaweedcolor,142,107,374,296);
mouse(x,y,1,1,false); end;
until (chooseoption(x,y,'eed') or (((invcount+2) mod 3)=0));
//getmousepos(x,y);
//mouse(x,y,0,0,true);
wait(1000+random(2000));
i:=i+1;
until ((invcount+2) mod 3)=0;
i:=3;
{
tries:=0;
x:=0; y:=0;
repeat
FindSymbol(x,y,'furnace');
if ( ((x=0)and(y=0)) ) then
begin
SendArrowSilentWait(3, 200 + Random(50));
tries:=tries+1;
wait(10);
end;
if tries>15 then
begin
logout;
wait(1000+random(1000));
loginplayer;
repeat
wait(10);
until (loggedin);
tries:=0
end;
until (( not((x=0)or(y=0)) ) );
findsymbol(x,y,'furnace');
mouse(x,y,5,5,true); }
mouse(629,130,5,5,true);
repeat
wait(100);
until FindColor(x, y, questcolor, 540, 8, 723, 158);
if not(invcount=28) then begin wait(5000+3000);mouse(mmcx,mmcy,5,5,true);end;
until invcount=28;
countflag(0);
//findsymbol(x,y,'furnace');
//mouse(x,y,5,5,true);
makecompass('n');
countflag(0);
findsymbol(x,y,'furnace')
mouse(x,y+30,5,5,true);
repeat
wait(100);
until findsymbol(x,y,'bank');
mouse(x,y,5,5,true);
waittilstill;
until (isfkeydown(6));
end.