Jump to content
adrianhmartinez

Whats wrong with my script on line 9

Recommended Posts

i started having problems when i added the up,down,left,right const

 

this is the message it gives:

compiler error line 9 Semicolon(;)expected

 

const
MonsterColor = 2113085; 
MonsterColor2 = 1982526;
MonsterColor3 = 2047548;
MonsterColor4 = 4940366;
MonsterColor5 = 1467240;
Mistake = 5583690;
Hat = 8178392;
Up = 526, 40;  <------------ line 9 it has a ; i dont know what the problem is
Down = 482, 633;
Left = 82, 309;
Right = 949, 372;
WaitTime = 1000;


var
x, y, c: Integer;

function SearchforMonster1: Boolean;
begin
Result := FindColor(x, y, MonsterColor, 94, 52, 933, 589) 
or FindColor(x, y, MonsterColor2, 94, 52, 933, 589) 
or FindColor(x, y, MonsterColor3, 94, 52, 933, 589) 
or FindColor(x, y, MonsterColor4, 94, 52, 933, 589) 
or FindColor(x, y, MonsterColor5, 94, 52, 933, 589);
Wait(WaitTime); 
Movemouse(x, y); 
ClickMouse(x, y, False);
end;

function SearchForPlayr: Boolean;
Begin 
ClickMouse(783, 697, False);
end;

function SearchForHat: Boolean;
Begin 
Result := FindColor(x, y, Hat, 513, 580, 952, 641);
Wait(WaitTime); 
Movemouse(x, y); 
ClickMouse(x, y, False);
end;


Begin 
repeat
 c:=c+1;
(SearchforMonster1)
Wait(WaitTime);
(SearchForPlayr)
Wait(WaitTime);
(SearchForHat);
Wait(WaitTime +500);
(SearchForPlayr)
Wait(WaitTime);
(SearchForHat);
Wait(WaitTime);
ClickMouse(517, 722, False);
ClickMouse(514, 541, False);
until(c>=99999999)
end.

Link to comment
Share on other sites

You cannot use constants like that..

 

Either you add TPoint variables for those OR you add those constants as so:

 

const
 Up_X = 526;
 Up_Y = 40;
 Down_X = 482;
 Down_Y = 633;
 Left_X = 82;
 Left_Y = 309;
 Right_X = 949;
 Right_Y = 372;

 

..below is the way with TPoint variables:

 

var
 Up, Down, Left, Right: TPoint;

procedure SetupDirections;
begin
 Up := Point(526, 40); 
 Down := Point(482, 633);
 Left := Point(82, 309);
 Right := Point(949, 372);
end;

begin
 SetupDirections;
 Wait(1000);
 MoveMouse(Up.X, Up.Y);
 Wait(250);
 MoveMouse(Down.X, Down.Y);
 Wait(250);
 MoveMouse(Left.X, Left.Y);
 Wait(250);
 MoveMouse(Right.X, Right.Y);
end.

Link to comment
Share on other sites

ok tkx i got it now, i got this last problem

how would i go to end (do nothing) if not find color on this part of the script

 

procedure map1; //-3,10
Begin 
if FindColor(x, y, 1259176, 299, 226, 338, 249);
then
Wait(WaitTime); 
Movemouse(952, 330); 
ClickMouse(952, 330, False);
end;

 

it expects an "else" but i put else end and it still doesnt work

 

-- i also have a problem on part of that script that when it does not find the color mouse goes to 0,0 top left corner.

Link to comment
Share on other sites

SCRIPT FINISHED

 

const
MonsterColor = 2113085; 
MonsterColor2 = 2114883;
MonsterColor3 = 2047548;
MonsterColor4 = 4940366;
MonsterColor5 = 1467240;
Mistake = 5583690; // not used
Hat = 8178392;
WaitTime = 1000;


var
x, y, c: Integer;

function SearchforMonster1: Boolean; // Search for monster to attk 
var  MonsterColors: TIntArray; 
begin  MonsterColors := [MonsterColor, MonsterColor2, MonsterColor3, MonsterColor4,
MonsterColor5];   
Result := FindColors(x, y, MonsterColors, 94, 52, 933, 589);   
if Result 
then  
begin    
Wait(WaitTime);      
Movemouse(x, y);      
ClickMouse(x, y, False);   
end; 
end; 

procedure SearchForPlayr; // Click on mistake
Begin 
MoveMouse(783, 697);
ClickMouse(783, 697, False);
end;

function SearchForHat: Boolean; //Search for hat in battle
Begin 
Result := FindColor(x, y, Hat, 513, 580, 952, 641);
if Result 
then  
begin
Wait(WaitTime); 
Movemouse(x, y); 
ClickMouse(x, y, False);
end; 
end;

procedure Endofbattle;  // click ok and change sets
begin 
if FindColor(x, y, 25087, 435, 539, 591, 556) then
begin
Wait(WaitTime);
Movemouse(x, y); 
ClickMouse(x, y, mbLeft);
Wait(WaitTime);
MoveMouse(652, 665);
ClickMouse(652, 665, mbLeft);
ClickMouse(652, 665, mbLeft);
Wait(WaitTime);
MoveMouse(783, 664);
ClickMouse(783, 664, mbLeft);
ClickMouse(783, 664, mbLeft);
Wait(WaitTime);
KeyDown(Chr(13));
KeyUp(Chr(13));

end;
end;

procedure map1; //-3,-10
begin 
if FindColor(x, y, 1259176, 299, 226, 338, 249) then
begin
Wait(WaitTime);
Movemouse(952, 330); 
ClickMouse(952, 330, mbLeft);
Wait(WaitTime);
end;
end;

procedure map2; //-2,-10
begin 
if FindColor(x, y, 3442, 677, 496, 713, 518) then
begin
Wait(WaitTime);
Movemouse(528, 630); 
ClickMouse(528, 630, mbLeft);
end;
end;

procedure map3; //-2,-9
begin 
if FindColor(x, y, 469145, 547, 291, 583, 313) then
begin
Wait(WaitTime);
Movemouse(953, 340); 
ClickMouse(953, 340, mbLeft);
end;
end;

procedure map4; //-1,-9
begin 
if FindColor(x, y, 401835, 275, 521, 309, 540) then
begin
Wait(WaitTime);
Movemouse(954, 320); 
ClickMouse(954, 320, mbLeft);
end;
end;

procedure map5; //0,-9
begin 
if FindColor(x, y, 465812, 610, 355, 644, 375) then
begin
Wait(WaitTime);
Movemouse(948, 354); 
ClickMouse(948, 354, mbLeft);
end;
end;

procedure map6; //0,-10
begin 
if FindColor(x, y, 664959, 274, 307, 308, 328) then
begin
Wait(WaitTime);
Movemouse(83, 304); 
ClickMouse(83, 304, mbLeft);
end;
end;

procedure map7; //1,-9
begin 
if FindColor(x, y, 398744, 392, 521, 422, 542) then
begin
Wait(WaitTime);
Movemouse(457, 42); 
ClickMouse(457, 42, mbLeft);
end;
end;

procedure map8; //1,-10
begin 
if FindColor(x, y, 2634957, 603, 142, 657, 170) then
begin
Wait(WaitTime);
Movemouse(491, 38); 
ClickMouse(491, 38, mbLeft);
end;
end;

procedure map9; //1,-11
begin 
if FindColor(x, y, 469429, 667, 383, 702, 403) then
begin
Wait(WaitTime);
Movemouse(483, 41); 
ClickMouse(483, 41, mbLeft);
end;
end;

procedure map10; //1,-12
begin 
if FindColor(x, y, 2114265, 853, 377, 878, 395) then
begin
Wait(WaitTime);
Movemouse(83, 327); 
ClickMouse(83, 327, mbLeft);
end;
end;

procedure map11; //0,-12
begin 
if FindColor(x, y, 3027399, 605, 416, 657, 440) then
begin
Wait(WaitTime);
Movemouse(483, 633); 
ClickMouse(483, 633, mbLeft);
end;
end;

procedure map12; //0,-11
begin 
if FindColor(x, y, 135289, 243, 326, 272, 349) then
begin
Wait(WaitTime);
Movemouse(79, 350); 
ClickMouse(448, 630, mbLeft);
end;
end;

procedure map13; //-1,-10
begin 
if FindColor(x, y, 861290, 152, 219, 190, 237) then
begin
Wait(WaitTime);
Movemouse(490, 38); 
ClickMouse(490, 38, mbLeft);
end;
end;

procedure map14; //-1,-11
begin 
if FindColor(x, y, 269188, 666, 414, 689, 435) then
begin
Wait(WaitTime);
Movemouse(529, 41); 
ClickMouse(529, 41, mbLeft);
end;
end;

procedure map15; //-1,-12
begin 
if FindColor(x, y, 2181574, 92, 181, 119, 197) then
begin
Wait(WaitTime);
Movemouse(80, 343); 
ClickMouse(80, 343, mbLeft);
end;
end;

procedure map16; //-2,-12
begin 
if FindColor(x, y, 730539, 519, 335, 550, 356) then
begin
Wait(WaitTime);
Movemouse(88, 318); 
ClickMouse(88, 318, mbLeft);
end;
end;

procedure map17; //-3,-12
begin 
if FindColor(x, y, 404132, 244, 377, 274, 403) then
begin
Wait(WaitTime);
Movemouse(493, 632); 
ClickMouse(493, 632, mbLeft);
end;
end;

procedure map18; //-3,-11
begin 
if FindColor(x, y, 270246, 696, 337, 722, 360) then
begin
Wait(WaitTime);
Movemouse(491, 632); 
ClickMouse(491, 632, mbLeft);
end;
end;

Begin 
repeat
 c:=c+1;
(SearchforMonster1)  //attk
Wait(WaitTime);
(SearchForPlayr) //click mistake
Wait(WaitTime);
(SearchForHat); //cast spell
Wait(WaitTime +500); //lag time
(SearchForPlayr) //click mistake
Wait(WaitTime);
(SearchForHat); //cast spell
Wait(WaitTime);
ClickMouse(513, 725, mbLeft); // end turn
Wait(WaitTime);
(Endofbattle) //end battle and switch sets
Wait(WaitTime);
(SearchforMonster1) //attk
Wait(WaitTime);
(SearchforMonster1) //attk
Wait(WaitTime);
(map1)
Wait(WaitTime - 700);
(map2)
Wait(WaitTime - 700);
(map3)
Wait(WaitTime - 700);
(map4)
Wait(WaitTime - 700);
(map5)
Wait(WaitTime - 700);
(map6)
Wait(WaitTime - 700);
(map7)
Wait(WaitTime - 700);
(map8)
Wait(WaitTime - 700);
(map9)
Wait(WaitTime - 700);
(map10)
Wait(WaitTime - 700);
(map11)
Wait(WaitTime - 700);
(map12)
Wait(WaitTime - 700);
(map13)
Wait(WaitTime - 700);
(map14)
Wait(WaitTime - 700);
(map15)
Wait(WaitTime - 700);
(map16)
Wait(WaitTime - 700);
(map17)
Wait(WaitTime - 700);
(map18)
until(c>=999999999)
end.

Edited by adrianhmartinez
Link to comment
Share on other sites

Satisfying when it all finally comes together isn't it? Makes all the frustration worthwhile.

 

May I suggest a change to SearchforMonster1? Also keep in mind:

  • Indentation is your bestest friend. Makes maintaining your code a zillion times easier.
  • If you want an infinite loop you can simply use Repeat ... Until False;

 

[sCAR]const

MonsterColor = 2113085;

MonsterColor2 = 2114883;

MonsterColor3 = 2047548;

MonsterColor4 = 4940366;

MonsterColor5 = 1467240;

Mistake = 5583690; // not used

Hat = 8178392;

WaitTime = 1000;

 

 

var

x, y: Integer;

 

function SearchforMonster1: Boolean; // Search for monster to attk

var

MonsterColors: TIntArray;

begin

MonsterColors := [MonsterColor, MonsterColor2, MonsterColor3, MonsterColor4,

MonsterColor5];

Result := FindColors(x, y, MonsterColors, 94, 52, 933, 589);

if Result then

begin

Wait(WaitTime);

Movemouse(x, y);

ClickMouse(x, y, False);

end;

end;

 

procedure SearchForPlayr; // Click on mistake

Begin

MoveMouse(783, 697);

ClickMouse(783, 697, False);

end;

 

function SearchForHat: Boolean; //Search for hat in battle

Begin

Result := FindColor(x, y, Hat, 513, 580, 952, 641);

if Result then

begin

Wait(WaitTime);

Movemouse(x, y);

ClickMouse(x, y, False);

end;

end;

 

procedure Endofbattle; // click ok and change sets

begin

if FindColor(x, y, 25087, 435, 539, 591, 556) then

begin

Wait(WaitTime);

Movemouse(x, y);

ClickMouse(x, y, mbLeft);

end;

end;

 

procedure map1; //-3,-10

begin

if FindColor(x, y, 1259176, 299, 226, 338, 249) then

begin

Wait(WaitTime);

Movemouse(952, 330);

ClickMouse(952, 330, mbLeft);

Wait(WaitTime);

ClickMouse(652, 665, mbLeft);

ClickMouse(652, 665, mbLeft);

Wait(WaitTime);

ClickMouse(783, 664, mbLeft);

ClickMouse(783, 664, mbLeft);

Wait(WaitTime);

end;

end;

 

procedure map2; //-2,-10

begin

if FindColor(x, y, 3442, 677, 496, 713, 518) then

begin

Wait(WaitTime);

Movemouse(528, 630);

ClickMouse(528, 630, mbLeft);

end;

end;

 

procedure map3; //-2,-9

begin

if FindColor(x, y, 469145, 547, 291, 583, 313) then

begin

Wait(WaitTime);

Movemouse(953, 340);

ClickMouse(953, 340, mbLeft);

end;

end;

 

procedure map4; //-1,-9

begin

if FindColor(x, y, 401835, 275, 521, 309, 540) then

begin

Wait(WaitTime);

Movemouse(954, 320);

ClickMouse(954, 320, mbLeft);

end;

end;

 

procedure map5; //0,-9

begin

if FindColor(x, y, 465812, 610, 355, 644, 375) then

begin

Wait(WaitTime);

Movemouse(948, 354);

ClickMouse(948, 354, mbLeft);

end;

end;

 

procedure map6; //1,-9

begin

if FindColor(x, y, 398744, 392, 521, 422, 542) then

begin

Wait(WaitTime);

Movemouse(457, 42);

ClickMouse(457, 42, mbLeft);

end;

end;

 

procedure map7; //1,-10

begin

if FindColor(x, y, 2634957, 603, 142, 657, 170) then

begin

Wait(WaitTime);

Movemouse(491, 38);

ClickMouse(491, 38, mbLeft);

end;

end;

 

procedure map8; //1,-11

begin

if FindColor(x, y, 469429, 667, 383, 702, 403) then

begin

Wait(WaitTime);

Movemouse(483, 41);

ClickMouse(483, 41, mbLeft);

end;

end;

 

procedure map9; //1,-12

begin

if FindColor(x, y, 3166187, 755, 246, 810, 279) then

begin

Wait(WaitTime);

Movemouse(75, 290);

ClickMouse(75, 290, mbLeft);

end;

end;

 

procedure map10; //0,-12

begin

if FindColor(x, y, 3027399, 605, 416, 657, 440) then

begin

Wait(WaitTime);

Movemouse(483, 633);

ClickMouse(483, 633, mbLeft);

end;

end;

 

procedure map11; //0,-10

begin

if FindColor(x, y, 731011, 274, 305, 312, 330) then

begin

Wait(WaitTime);

Movemouse(79, 350);

ClickMouse(79, 350, mbLeft);

end;

end;

 

procedure map12; //-1,-10

begin

if FindColor(x, y, 861290, 152, 219, 190, 237) then

begin

Wait(WaitTime);

Movemouse(490, 38);

ClickMouse(490, 38, mbLeft);

end;

end;

 

procedure map13; //-1,-11

begin

if FindColor(x, y, 269188, 666, 414, 689, 435) then

begin

Wait(WaitTime);

Movemouse(529, 41);

ClickMouse(529, 41, mbLeft);

end;

end;

 

procedure map14; //-1,-12

begin

if FindColor(x, y, 2181574, 92, 181, 119, 197) then

begin

Wait(WaitTime);

Movemouse(80, 343);

ClickMouse(80, 343, mbLeft);

end;

end;

 

procedure map15; //-2,-12

begin

if FindColor(x, y, 730539, 519, 335, 550, 356) then

begin

Wait(WaitTime);

Movemouse(88, 318);

ClickMouse(88, 318, mbLeft);

end;

end;

 

procedure map16; //-3,-12

begin

if FindColor(x, y, 404132, 244, 377, 274, 403) then

begin

Wait(WaitTime);

Movemouse(493, 632);

ClickMouse(493, 632, mbLeft);

end;

end;

 

procedure map17; //-3,-11

begin

if FindColor(x, y, 270246, 696, 337, 722, 360) then

begin

Wait(WaitTime);

Movemouse(491, 632);

ClickMouse(491, 632, mbLeft);

end;

end;

 

Begin

repeat

(SearchforMonster1) //attk

Wait(WaitTime);

(SearchForPlayr) //click mistake

Wait(WaitTime);

(SearchForHat); //cast spell

Wait(WaitTime +500); //lag time

(SearchForPlayr) //click mistake

Wait(WaitTime);

(SearchForHat); //cast spell

Wait(WaitTime);

ClickMouse(491, 632, mbLeft); // end turn

Wait(WaitTime);

(Endofbattle) //end battle and switch sets

Wait(WaitTime);

(SearchforMonster1) //attk

Wait(WaitTime);

(SearchforMonster1) //attk

Wait(WaitTime);

(map1)

Wait(WaitTime - 600);

(map2)

Wait(WaitTime - 600);

(map3)

Wait(WaitTime - 600);

(map4)

Wait(WaitTime - 600);

(map5)

Wait(WaitTime - 600);

(map6)

Wait(WaitTime - 600);

(map7)

Wait(WaitTime - 600);

(map8)

Wait(WaitTime - 600);

(map9)

Wait(WaitTime - 600);

(map10)

Wait(WaitTime - 600);

(map11)

Wait(WaitTime - 600);

(map12)

Wait(WaitTime - 600);

(map13)

Wait(WaitTime - 600);

(map14)

Wait(WaitTime - 600);

(map15)

Wait(WaitTime - 600);

(map16)

Wait(WaitTime - 600);

(map17)

until False;

end.[/sCAR]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...