var un,pw:string; SWDelay,MDelay,SDelay,Delay,CMD:integer; function LogInIfNeeded:boolean; export; var i:integer; ContinueG:boolean; LoggedIn:boolean; begin ContinueG:=False; i:=0; LoggedIn:=False; //if logged out press Cancel if(LoginScreen)then begin Status('Clearing username, password fields'); ClickMouse(400,280,True); repeat Wait(100); until (StartScreen); end; //If logged out select Existing User if(StartScreen)then begin Status('Choosing existing user'); i:=0; ClickMouse(310,295,True); repeat Wait(100); i:=i+1; until (LogInScreen)or(i>=100); end; //If logged out, log in if(LoginScreen)then begin Status('Trying to log in'); ClickMouse(100,260,True); Wait(500); SendKeysSilent(un); Wait(1000); ClickMouse(120,310,True); Wait(500); SendKeysSilent(pw); Wait(1000); repeat i:=0; ClickMouse(380,250,True); repeat Wait(500+random(500)); i:=i+1; until (i>20)or((Not StartScreen)and(Not LogInScreen)); ContinueG:=(i<=20); until ContinueG; Wait(2500); ClickMouse(495,20,True); Wait(1000); MoveMouse(10,10); Wait(100); writeln('Login procces done!'); LoggedIn:=True; end; SetTimeOut((SWDelay*60+SWDelay*30),'LOGINIFNEEDED'); Result:=LoggedIn; Status(''); end; Procedure LogOut; var s:string; begin SetTimeOut(999999,'LOGINIFNEEDED'); while (Not StartScreen)and(Not LogInScreen) do begin MoveMouse(330,15); Wait(200); ClickMouse(350,280,True); Wait(1000); S:=GetChatMsg; if (pos('can t',s)<>0) or (pos('cant',s)<>0) then Wait(3000); end; Writeln('Logged out!'); repeat Wait(99999); until False; end; procedure WaitForFO; var i:integer; begin Status('Waiting for an fatigue operator! (0/'+inttostr(SWDelay)+' minutes)'); i:=0; repeat wait(60000); i:=i+1; Status('Waiting for an fatigue operator! ('+inttostr(i)+'/'+inttostr(SWDelay)+' minutes)'); until (i>=swdelay); LogInIfNeeded; end; Procedure FixMap(Path:Integer); var bool:extended; x,y:integer; Begin bool:=0; repeat MoveMouse(1+random(3),1+random(3)); Wait(10); MoveMouse(465+random(3),20+random(3)); Wait(Delay); if Not ProcessMap then Delay:=Delay+5 else ProcessPath(Path, x, y, bool, 0.1); if (Delay>MDelay) then begin Status('Resting for 10 seconds..'); Delay:=SDelay; LogInIfNeeded; end; until bool=1; end; procedure GoByPath(path: Integer); var HowFar: Integer; x, y, tx, ty: Integer; r: Extended; Dest: Boolean; NR:integer; begin NR:=0; FixMap(Path); repeat ClickMouse(460+random(3),15+random(3),True); Wait(300); ProcessMap; HowFar:= ProcessPath(Path, x, y, r, 0.05); if(r > 0.8)then begin NR:=0; if(HowFar = 0) then begin tx:=x; ty:=y; end else begin tx:=x+Random(1)-1; ty:=y+Random(1)-1; end; ClickMap(tx, ty, True); Wait(20+random(30)); ClickMap(tx, ty, True); Wait(70+random(30)); end else NR:=NR+1; if NR>2 then begin FixMap(Path); NR:=0; end else begin Dest:= (HowFar=0)and(x<=21)and(x>=15)and(y<=23)and(y>=14); if (GetFightMode<>0) then Wait(1000) else if(not Dest)then Wait(cmd); end; until(Dest); wait(200); movemouse(10,10); wait(100); end; function GetItem(ItemName:string; var dx,dy:integer; xs,ys,xe,ye:integer):boolean; Var BitMap,x,y,sxs,sys,sxe,sye:integer; LCItemName:string; Clicked:boolean; begin sxs:=xs; sys:=ys; sxe:=xe; sye:=ye; if (sxs<0) then sxs:=0; if (sys<0) then sys:=0; if (sxe>510) or (sxe<0) then sxe:=510; if (sye>325) or (sxe<0) then sye:=325; Clicked:=False; LCItemName:=LowerCase(ItemName); BitMap:=9999; Case LCItemName of 'clay' :BitMap:=BitmapFromString(3, 3,'91610F724B0BC2811562410A724B0B91610F62410A4F2100975B08'); 'tin' :BitMap:=BitmapFromString(3, 3,'857575724B0BB29C9C5A4F4F724B0B8575755A4F4F4F2100975B08'); 'copper' :BitMap:=BitmapFromString(3, 3,'A2400F724B0BD856156D2B0A724B0BA2400F6D2B0A4F2100975B08'); 'iron ore' :BitMap:=BitmapFromString(3, 2,'4C41414F2100975B084F2100724B0B724B0B'); 'silver' :BitMap:=9999; 'coal' :BitMap:=BitmapFromString(2, 3,'4D4D4D6D6D6D4D4D4D4D4D4D2727274D4D4D'); 'gold' :BitMap:=BitmapFromString(4, 2,'D8AC40BA9537BA9537A28130BA9537BA9537BA9537A28130'); 'saph' :BitMap:=BitmapFromString(4, 2,'0040D80037BA0037BA0030A20040D80037BA0037BA0030A2'); 'emerald' :BitMap:=BitmapFromString(4, 2,'2BAC2B2595252595252081202BAC2B259525259525208120'); 'ruby' :BitMap:=BitmapFromString(4, 2,'D82B00BA2500BA2500A22000BA2500BA2500BA2500A22000'); 'diamond' :BitMap:=BitmapFromString(5, 2,'D8D8D8D8D8D8BABABABABABAA2A2A2D8D8D8BABABABABABABABABAA2A2A2'); 'iron bar' :BitMap:=BitmapFromString(3, 4,'978C8C978C8C978C8CADA1A1827878827878ADA1A1827878827878C9BBBB827878665E5E'); 'steel bar' :BitMap:=BitmapFromString(3, 4,'979797979797979797ADADAD828282828282ADADAD828282828282C9C9C9828282666666'); 'coins' :BitMap:=BitmapFromString(3, 3,'FCC000C7A00B6B2C09C7A00B6B2C09FCC0004B280B6B2C09FEF660'); 'sleeping bag':BitMap:=BitmapFromString(5, 2,'7B542E7B542E988CB1CFAB7BCFAB7B9D6E3DF8EAA5F8EAA5F8EAA57B542E'); end; if BitMap<>9999 then begin FindBitmapIn(BitMap,x,y,sxs,sys,sxe,sye); dx:=x; dy:=y; Wait(100); Clicked:=True; end else Writeln('Bit map - '+ItemName+' - not defiened.'); Result:=Clicked; end; function SleepNeeded:boolean; var FL,Fatigue,x,y,Count,Tries:integer; FS,Text:string; Slept:boolean; begin Count:=0; Tries:=0; Slept:=False; movemouse(425,15); wait(100); ClickMouse(350,50,True); Wait(100); Text:=GetTextAt(365,189); FS:=copy(Text,1,Length(Text)); Fatigue:=StrToInt(FS); if Fatigue>=98 then begin Slept:=True; ClickMouse(490,15,True); wait(100); Status('Going to Sleep'); if GetItem('Sleeping Bag',x,y,264,36,509,240) then begin ClickMouse(x,y,True); Wait(1000); count:=0; repeat wait(1000); count:=count+1; if (count>=50) then begin ClickMouse(200,300,True); wait(1000); while (GetColor(209,255)=255) do wait(100); Count:=0; Tries:=Tries+1; end; if Tries>3 then begin WaitForFO; Wait(1000); Status('Going to sleep!'); if Not IsTextAt(168,293,'click here') then begin ClickMouse(490,15,True); wait(100); GetItem('Sleeping Bag',x,y,264,36,509,240); ClickMouse(x,y,True); Wait(1000); count:=0; tries:=0; end; end; until (IsTextAt(168,293,'click here')=False)and(Not LogInScreen)and(Not StartScreen)and((GetColor(289,290)<>0)and(GetColor(93,399)<>9203557)); end else begin writeln('There is no sleeping bag in your inventory! (Logging out!)'); LogOut; end; end; Wait(10); MoveMouse(10,10); Wait(10); Result:=Slept; end; function InvFull:Boolean; var Bool:boolean; begin MoveMouse(490,15); wait(100); MoveMouse(485,225); wait(100); if GetTextAt(6,2)=NIL then bool:=False else bool:=True; wait(10); MoveMouse(10,10); Wait(50); Result:=Bool; end; Procedure GetItemQuanity(IX,IY:integer; var ItemCount:LongInt); var TX,TY,TL:integer; Text:String; begin ItemCount:=0; if (IX>=59) and (IX<=107) then TX:=60; if (IX>=108) and (IX<=156) then TX:=109; if (IX>=157) and (IX<=205) then TX:=158; if (IX>=206) and (IX<=254) then TX:=207; if (IX>=255) and (IX<=303) then TX:=256; if (IX>=304) and (IX<=352) then TX:=305; if (IX>=353) and (IX<=401) then TX:=354; if (IX>=402) and (IX<=450) then TX:=403; if (IY>=31) and (IY<=64) then TY:=29; if (IY>=65) and (IY<=98) then TY:=63; if (IY>=99) and (IY<=132) then TY:=97; if (IY>=133) and (IY<=166) then TY:=131; if (IY>=167) and (IY<=200) then TY:=165; if (IY>=201) and (IY<=235) then TY:=199; Text:=GetTextAt(TX,TY); TL:=Length(Text); if TL>7 then TL:=7; ItemCount:=strtoint(copy(Text,1,TL)); end; Procedure MoveAside; var RC,Cord:integer; begin Repeat RC:=Random(3); Cord:=160+random(60) if RC=1 then Cord:=260+random(65) else if RC=2 then Cord:=260-random(100); MoveMouse(Cord,Cord); Wait(100); until (GetTextAt(6,2)=Nil); ClickMouse(Cord,Cord,True); Wait(1000); end; Function RightClickMenu(var tarx,tary:integer; xs,xe,ye:integer; Text:String):string; //Text works as 'Object1, Object2, Object3, etc...,' var x,y,dx,dy,tx,ty:integer; txs,txe,tye:integer; FoundText,Clicked:Boolean; TempText,OSText,S:string; Texts:array[1..100] of string; i,j:integer; begin FoundText:=False; txs:=xs; txe:=xe; tye:=ye; if txs<0 then txs:=0; if txe>510 then txe:=510; if tye>325 then tye:=325; y:=0; if FindColor(dx,dy,16776960,txs,y-5,txe,tye) then begin y:=dy; wait(50); if dx<0 then dx:=0; if dx>495 then dx:=495; if IsTextInArea(dx-5,dy-5,dx+5,dy+2,tx,ty,'Choose option') then begin FoundText:=True; x:=tx; y:=ty; end else y:=y+15; end else y:=y+15; Clicked:=False; TempText:=Text; i:=1; while (TempText<>'') and (i<100) do Begin Texts[i]:=copy(TempText,1,pos(',',TempText)-1); Delete(TempText,1,pos(',',TempText)+1); i:=i+1; end; if FoundText then begin repeat y:=y+15; OSText:=GetTextAt(x,y); j:=1; while (j0) then begin Clicked:=True; S:=Texts[j]; end j:=j+1; end; until (Clicked) or (y>=316); end; if Clicked then begin tarx:=x; tary:=y; end; Result:=S; end; //Procedure TalkTo(T{arget}Color:integer; T{arget}T{ext}X,T{arget}T{ext}Y:integer; T{arget}Text:string; S{econdary}T{ext}X,S{econdary}T{ext}Y:integer; S{econdary}Text:string; Option,F{inal}TX,F{inal}TY:integer; F{inal}Text:string; Path:integer); // Example: TalkTo(65536,6,2,'Banker: Talk',6,0,'l d like to access my bank account please',1{option},379,1,'Close window',BankPath); Procedure TalkTo(TColor:integer; TTX,TTY:integer; TText:string; STX,STY:integer; SText:string; Option,FTX,FTY:integer; FText:string; Path:integer); var x,y:integer; i,j:integer; bool,bool2,FoundTarget:boolean; begin i:=0; j:=0; Wait(100); repeat if (j>3)and(Path<>0) then begin GoByPath(Path); j:=0; end; FoundTarget:=False; repeat if FindColorSpiral(x,y,TColor,5,5,510,325) then begin MoveMouse(x,y); FoundTarget:=True; end else i:=i+1; Wait(50); until(IsTextAt(TTX,TTY,TText))or(IsTextAt(STX,STY,SText))or(i>=10); if i<10 then begin i:=0; ClickMouse(x,y,True); repeat wait(300); i:=i+1; bool:=IsTextAt(STX,STY,SText); bool2:=(Pos('busy',GetChatMsg)<>0) until(bool)or(bool2)or(i>=10); if bool2 then Wait(2000); if bool then begin Wait(100); MoveMouse(7,4+12*(Option-1)); Wait(500); ClickMouse(7,4+12*(Option-1),True); Wait(1000); i:=0; Repeat Wait(500); i:=i+1; until(IsTextAt(FTX,FTY,FText))or(i>=10); end; end; i:=0; if Not FoundTarget then j:=j+1; until(IsTextAt(FTX,FTY,FText)); end; //Empties your inventory from any unuseful stuff or aquired materials. Procedure EmptyBank(UsefulStuff:string); //UsefulStuff works as 'Object1, Object2, Object3, etc...,' var tx,x,y,i,j:integer; StrNum,TempStuff,ItemDescription:string; Num:longint; UsefulCheck:boolean; UsefulItems:array[1..46] of string; begin TempStuff:=UsefulStuff; i:=1; while (TempStuff<>'') and (i<46) do begin UsefulItems[i]:=copy(UsefulStuff,1,pos(',',UsefulStuff)-1); Delete(UsefulStuff,1,pos(',',UsefulStuff)+1); i:=i+1; end; Num:=0; x:=99; y:=48; while x<450 do begin while y<230 do begin tx:=x-42; repeat tx:=tx+7; StrNum:=GetTextAt(tx,y); Num:=strtoint(StrNum); until (tx>=x)or(Num>0); if num>0 then begin ClickMouse(x,y,True); Wait(1000); UsefulCheck:=False; ItemDescription:=GetTextAt(100,264); j:=1; While (Not UsefulCheck) and (j0 then UsefulCheck:=True; j:=j+1; end; if Not UsefulCheck then begin while(IsTextAt(422,264,'2500'))do begin ClickMouse(423,270,True); Wait(300); end; while(IsTextAt(389,264,'500'))do begin ClickMouse(390,270,True); Wait(300); end; while(IsTextAt(359,264,'100'))do begin ClickMouse(360,270,True); Wait(300); end; while(IsTextAt(334,264,'25'))do begin ClickMouse(335,270,True); Wait(300); end; while(IsTextAt(304,264,'Five'))do begin ClickMouse(305,270,True); Wait(300); end; while(IsTextAt(274,264,'One'))do begin ClickMouse(275,270,True); Wait(300); end; end; end; y:=y+34; end; y:=48; x:=x+49; end; end;