SCAR Code:
program ByNickRules;
{.include srl/srl.scar}
var //FORM VARIABLES
EndInitForm : Boolean;
frmDesign : TForm;
Button1, Button2, Button3, Button4,
Button5, Button6, Button7, Button8 : TButton;
ComboBox1, ComboBox2 : TComboBox;
GroupBox1 :TGroupBox;
DBbox : TMemo;
Magnify, Close, closes, OOS,enhanced, x,y,c, popu : Integer; //SCRIPT VARIABLE
ThePlant : String;
{//////////////////basic procedures (all by me)\\\\\\\\\\\\\\\\\}
procedure Cmouse(x,y: integer);
begin
holdmouse(x,y,true)
wait(75)
releasemouse(x,y,true)
end;
Procedure WriteDB(S: String); {Writes in the form debug box}
begin
with DBbox.lines do
begin
add(s);
end;
end;
Procedure CDB(sender: TObject);
var
i: Integer;
begin
with DBbox.lines do
begin
clear;
end;
end;
procedure L; {search left}
var
x,y:integer;
begin
FindColorspiral(x,y,4758089,239,185,330,267)
HoldMouse(x, y, True);
MoveMouse(468, 171);
ReleaseMouse(468, 171, True);
end;
Procedure D; {search down}
var
x,y:integer;
begin
FindColorspiral(x,y,4758089,239,185,330,267)
HoldMouse(x, y, True);
MoveMouse(0, 107);
Wait(202);
ReleaseMouse(2, 107, True);
end;
Procedure UR; {search up and right}
var
x,y:integer;
begin
FindColorspiral(x,y,4758089,239,185,330,267)
HoldMouse(x, y, True);
MoveMouse(43, 320);
Wait(328);
ReleaseMouse(43, 320, True);
end;
Procedure U; {search up}
begin
FindColorspiral(x,y,4758089,239,185,330,267)
HoldMouse(x, y, True);
MoveMouse(540, 335);
ReleaseMouse(540, 335, True);
ReleaseMouse(540, 335, True);
end;
procedure HandlePause; {checks for F3}
begin
if isfkeydown(3) then
repeat
wait(500)
until(not isfkeydown(3))
end;
{End of basic procedures for script}
Procedure LoadDTMs;
begin
Magnify := DTMFromString('78DA639CCAC4C0709C910119FCFFFF1F4CC34' +
'419416A8EA1AAD9BD6C0AA69AA3A86ACA7C3451D5CC06AAB986AA' +
'66654D00AA9A8544983319A8E61C01352D4035E7F1FB0B007EAD1' +
'5E5');
OOS := DTMFromString('78DA63546564606803622430658F239886893' +
'2AA10A1A610C8FA82A2842174C6045435ED409632AA39FFFF3E45' +
'55730DC87A4EC09C2540D633026A4481AC7634BBFEFF4755230C6' +
'4F5E1F71700C794170E');
Close := DTMFromString('78DA639CCDC8C060CF8002FEFFFF0FA619A17' +
'CC649409603AA9AC36E56A86A9600598E04D42C00B25CF1DB0500' +
'7C590C03');
Enhanced := DTMFromString('78DA6374606460E8066224F0FFFF7F300D136' +
'53407B2A6A1AA99B2C711554D3A90658F66CEDFA7A86A9A812C5E' +
'5435A13326A0AA990F6409E2570300810F0DFC');
end;
Procedure Check2;
var
x,y:Integer;
begin
if(FindDTM(enhanced,x,y,0,0,747,480))then
begin
WriteLn('=========SCRIPT FAILER NOTICE=========');
WriteLn('=GAME ENGINE ENHANCED')
WriteLn('=TERMINATING SCRIPT');
WriteLn('=========END OF FAILER NOTICE=========')
terminatescript;
end;
end;
procedure Popups;
var
x,y: Integer;
begin
If(FindDTM(OOS,x,y,0,0,747,480))then
begin
WriteLn('=========SCRIPT FAILER NOTICE=========');
WriteLn('=THE GAME IS OUT OF SYNC WITH SERVER');
WriteLn('=TERMINATING SCRIPT');
WriteLn('=========END OF FAILER NOTICE=========')
TerminateScript;
end else
begin
If(FindDTM(close,x,y,0,0,747,480))then
begin
check2;
WriteLn('SUCCESFULY BLOCKED A POPUP.');
Inc(popup);
WriteLn('POPUP COUNT := '+ IntToStr(popup));
Cmouse(x,y)
end;
end;
end;
Procedure FindIt(P,sp: integer);
begin
WriteLn('PROCEDURE: FindIt(P,sp: integer); STARTED AT '+THetime);
sp:=0;
cmouse(684,558);
wait(5000)
for SP := -1 to P-1 do
begin
Cmouse(708,333);
sp:=sp+1;
wait(500)
end;
WriteLn('At page');
WriteLn('PROCEDDURE FindIt(P,sp: integer); ENDED AT '+tHEtime);
end;
Procedure BuyIt(Slot: integer);
begin
WriteLn('PPROCEDURE BuyIt(Slot: integer); STARTED AT '+TheTime);
case (slot) of
1: begin
Cmouse(170,351);
end;
2: begin
Cmouse(308,352);
end;
3: begin
Cmouse(446,351);
end;
4: begin
Cmouse(585,351);
end;
5:begin
cmouse(170,545);
end;
6: begin
cmouse(309,545);
end;
7: begin
cmouse(444,545);
end;
8: begin
cmouse(582,545);
end;
end;
WriteLn('PROCEDURE: BuyIt(Slot: integer); ENDED AT '+TheTime);
end;
Procedure CompleteIt(Page,Slot:Integer);
begin
WriteLn('PROCEDURE STARTED: CompleteIt(Page,Slot:Integer); AT '+TheTime)
FindIt(Page,1);
WriteLn('Going to page '+IntToStr(page))
writeDB('Going to page '+IntToStr(page))
wait(1000)
WriteDB('At page. Buying Seed from slot '+IntToStr(slot));
WriteLn('At page. Buying Seed from slot '+IntToStr(slot));
BuyIt(Slot);
WriteLn('PROCEDURE CompleteIt(Page,Slot:Integer); ENDED AT '+TheTime);
end;
procedure buylotsahaybales(sender:TObject); //Inspired by Nadeem :P
var
x,y,i: Integer;
begin
WriteLn('PROCEDURE buylotsahaybales(sender:TObject); STARTED AT '+TheTime);
showmessage('makes a line from top to Right and down (/). press F4 at where you want the top row to be. Makes 25 haybales.');
Repeat
GetMousePos(x,y)
wait(500)
Until(isFkeydown(4))
repeat
Clickmouse(x,y,true);
x := x-5;
y := y+3;
i := i+1;
until(i>= 25)
WriteDB('25 haybales placed!');
WriteLn('PROCEDURE buylotsahaybales(sender:TObject); ENDED AT '+TheTime);
end;
procedure SellAllHaybales(Sender: TObject);
begin
writeLn('PROCEDURE SellAllHaybales(sender: TObject); STARTED AT '+THETIME);
writeDB('Selling haybales!');
wait(500)
Cmouse(732,505);
repeat
FindColor(x,y,4304372,0,0,761,493);
Cmouse(x,y)
wait(400)
cmouse(301,392)
wait(400)
until(isfkeydown(4) or not FindColor(x,y,4304372,0,0,761,493))
WriteDB('Haybales Sold!');
writeLn('PROCEDURE SellAllHaybales(sender: TObject); ENDED AT '+THETIME);
end;
procedure pick(Sender: TObject);
begin
ShowMessage('click an unusuall color of the plant your harvesting. basicly, not green...');
WriteLn('PROCEDURE pick(Sender: TObject); STARTED AT '+TheTime);
Wait(750)
pickcolor(c,x,y)
WriteDB('Picking All plants with that color!');
repeat
findcolor(x,y,c,0,0,662,440);
Popups;
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,c,0,0,662,440) or isfkeydown(4)) ;
L;
repeat
Popups;
findcolor(x,y,c,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,c,0,0,662,440) or isfkeydown(4)) ;
D;
repeat
Popups;
findcolor(x,y,c,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,c,0,0,662,440) or isfkeydown(4)) ;
UR;
repeat
Popups;
findcolor(x,y,c,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,c,0,0,662,440) or isfkeydown(4)) ;
U;
repeat
Popups;
findcolor(x,y,c,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,c,0,0,662,440) or isfkeydown(4)) ;
WriteLn('PROCEDURE pick(Sender: TObject); ENDED AT '+TheTime);
end;
Procedure TS(sender:Tobject);
begin
frmDesign.ModalResult:= mrOk;
end;
Procedure plow(Sender: TObject);
Begin
WriteLn('PROCEDURE plow(Sender: TObject); STARTED AT '+TheTime);
WriteDB('Plowing land!');
wait(500);
Cmouse(637,504);
repeat
Popups;
findcolortolerance(x,y,1005420,0,32,662,440,25);
Cmouse(x,y);
HandlePause;
until(not findcolortolerance(x,y,1005420,0,32,662,440,25) or isfkeydown(4));
L;
repeat
Popups;
findcolor(x,y,1005420,0,32,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,1005420,0,32,662,440) or isfkeydown(4)) ;
D;
repeat
Popups;
findcolor(x,y,1005420,0,32,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,1005420,0,32,662,440) or isfkeydown(4)) ;
UR;
repeat
Popups;
findcolor(x,y,1005420,0,32,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,1005420,0,32,662,440) or isfkeydown(4)) ;
U;
repeat
Popups;
findcolor(x,y,1005420,0,32,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,1005420,0,32,662,440) or isfkeydown(4));
WriteLn('PROCEDURE plow(Sender: TObject); ENDED AT '+TheTime);
end;
Procedure Plant(Sender: TObject);
begin
WriteLn('PROCEDURE Plant(Sender: TObject); STARTED AT '+TheTime);
WriteDB('Planting!');
CompleteIt(StrToInt(ComboBox1.text),StrToInt(ComboBox2.text))
wait(1000);
repeat
Popups;
findcolor(x,y,2709397,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,2709397,0,0,662,440) or isfkeydown(4)) ;
L;
repeat
Popups;
findcolor(x,y,2709397,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,2709397,0,0,662,440) or isfkeydown(4)) ;
D;
repeat
Popups;
findcolor(x,y,2709397,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,2709397,0,0,662,440) or isfkeydown(4)) ;
UR;
repeat
Popups;
findcolor(x,y,2709397,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,2709397,0,0,662,440) or isfkeydown(4)) ;
U;
repeat
Popups;
findcolor(x,y,2709397,0,0,662,440);
Cmouse(x,y);
HandlePause;
until(not findcolor(x,y,2709397,0,0,662,440) or isfkeydown(4)) ;
WriteLn('PROCEDURE Plan(Sender: TObject); STARTED AT '+TheTime);
WriteDB('Planting finished!');
end;
Procedure SetupPlayer;
var
x,y:Integer;
begin
FindDTM(magnify,x,y,555,427,761,495)
Cmouse(x,y)
Cmouse(x,y)
Cmouse(x,y)
Cmouse(x,y)
Cmouse(x,y)
end;
Procedure Animals(sender: Tobject);
var
x,y,xx,yy:integer;
begin
WriteLn('PROCEDURE Animals(Sender: TObject); STARTED AT '+TheTime);
WriteDB('Collecting animal products!');
Repeat
If FindcolorTolerance(x,y,12559825,0,0,662,440,5) or FindcolorTolerance(x,y,8605387,0,0,662,440,5) then
Cmouse(x+8,y+8);
handlepause;
Getmousepos(xx,yy)
Cmouse(xx+40,yy+50)
handlepause;
Until(IsFkeydown(4) or not FindcolorTolerance(x,y,12559825,0,0,662,440,5) or Findcolortolerance(x,y,8605387,0,0,662,440,5))
WriteLn('PROCEDURE plow(Sender: TObject); ENDED AT '+TheTime);
WriteDB('Finished collecting animal products!');
end;
procedure InitFormOnClose(Sender : TObject; var Action : TCloseAction);
begin
if(not(frmDesign.ModalResult = 1))then
EndInitForm := True;
end;
procedure InitForm;
begin
frmDesign := CreateForm;
with frmDesign do
begin
OnClose := @InitFormOnClose;
BorderStyle := bsSingle;
BorderIcons := [biMinimize];
Left := 601;
Top := 103;
ClientWidth := 534;
ClientHeight := 306;
Caption := 'Farmville Bot PRO';
Color := clWhite;
Font.Color := clWindowText;
Font.Height := -11;
Font.Name := 'OCR A Extended';
Font.Style := [];
PixelsPerInch := 96;
end;
Button1 := TButton.Create(frmDesign);
with Button1 do
begin
Parent := frmDesign;
Left := 0;
Top := 64;
Width := 177;
Height := 57;
Caption := 'Plow';
TabOrder := 0;
OnClick := @plow;
end;
Button2 := TButton.Create(frmDesign);
with Button2 do
begin
Parent := frmDesign;
Left := 352;
Top := 64;
Width := 177;
Height := 57;
Caption := 'Pick';
OnClick := @Pick;
end;
Button3 := TButton.Create(frmDesign);
with Button3 do
begin
Parent := frmDesign;
Left := 176;
Top := 64;
Width := 177;
Height := 33;
Caption := 'Plant';
OnClick := @plant;
end;
Button5 := TButton.Create(frmDesign);
with Button5 do
begin
Parent := frmDesign;
Left := 0;
Top := 0;
Width := 177;
Height := 57;
Caption := 'Collect Animal Products';
OnClick := @animals;
end;
ComboBox1 := TComboBox.Create(frmDesign);
with ComboBox1 do
begin
Parent := frmDesign;
Left := 176;
Top := 96;
Width := 89;
Height := 20;
ItemHeight := 12;
TabOrder := 5;
Text := 'Page';
with Items do
begin
Add('1');
Add('2');
Add('3');
Add('4');
Add('5');
Add('6');
end;
end;
Button6 := TButton.Create(frmDesign);
with Button6 do
begin
Parent := frmDesign;
Left := 176;
Top := 0;
Width := 177;
Height := 57;
Caption := 'Buy lotsa haybales';
TabOrder := 6;
OnClick := @BuyLotsaHayBales;
end;
Button7 := TButton.Create(frmDesign);
with Button7 do
begin
Parent := frmDesign;
Left := 352;
Top := 0;
Width := 177;
Height := 57;
Caption := 'Sell ALL haybales';
TabOrder := 7;
OnClick := @SellAllHaybales;
end;
GroupBox1 := TGroupBox.Create(frmDesign);
with GroupBox1 do
begin
Parent := frmDesign;
Left := 0;
Top := 129;
Width := 529;
Height := 176;
Caption := 'Debug Box';
Color := clMedGray;
ParentColor := False;
TabOrder := 8;
end;
DBbox := TMemo.Create(GroupBox1);
with DBbox do
begin
Parent := GroupBox1;
Left := 0;
Top := 16;
Width := 529;
Height := 153;
ReadOnly := True;
TabOrder := 0;
ScrollBars := ssnone;
end;
Button4 := TButton.Create(frmDesign);
with Button4 do
begin
Parent := frmDesign;
Left := 448;
Top := 272;
Width := 81;
Height := 33;
Caption := 'Close Form';
TabOrder := 3;
OnClick := @TS;
end;
ComboBox2 := TComboBox.Create(frmDesign);
with ComboBox2 do
begin
Parent := frmDesign;
Left := 264;
Top := 96;
Width := 89;
Height := 20;
ItemHeight := 12;
TabOrder := 9;
Text := 'Slot';
with Items do
begin
Add('1');
Add('2');
Add('3');
Add('4');
Add('5');
Add('6');
Add('7');
Add('8');
end;
end;
Button8 := TButton.Create(GroupBox1);
with Button8 do
begin
Parent := GroupBox1;
Left := 200;
Top := 160;
Width := 89;
Height := 17;
Caption := 'Clear';
TabOrder := 1;
OnClick := @CDB;
end;
WriteDB('Thank you for using the farmville bot pro by Nickrules.');
WriteDB('For instructions, Or to post feedback/bugs, visit: ');
WriteDB('SRL-Forums >scar> Other Scripts> FB-Farmville Bot');
end;
procedure SafeInitForm;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('InitForm', v);
end;
procedure ShowInitFormModal;
begin
frmDesign.ShowModal;
end;
procedure SafeShowInitFormModal;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowInitFormModal', v);
end;
procedure MainInitForm;
begin
try
SafeInitForm;
SafeShowInitFormModal;
finally
FreeForm(frmDesign);
except
WriteLn('An error seems to have occurred in: InitForm');
end;
end;
begin
setupsrl;
loadDTMs;
ClearDebug;
GetSelf.WindowState := wsMinimized;
MainInitForm;
GetSelf.WindowState := wsNormal;
if(EndInitForm) then
TerminateScript;
writeln('ran for '+ timerunning)
writeln('closed '+Inttostr(closes) +' popups');
end.