Jump to content
CaydDmann

Help me please?

Recommended Posts

I'm trying to make a script that automatically bakes brownies... here's what I have got. I keep getting errors about "Identifier expected". I'm still new at this, could you help please?

 

program AutoBrownieBaker;

var
Cook: Integer;
Brownies: Integer;
Exitbutton: Integer;
Ok: Integer;
Prepare: Integer;
Prepare2: Integer;
Prepare3: Integer;
Serve: Integer;
Login: Integer;
Levelup: Integer;
x,y: Integer;

procedure LoadBmps;
begin
Levelup:= BitmapFromString(1, 1, 'beNrLSDsPAALWAZ4=');
Ok:= BitmapFromString(1, 1, 'beNpLKX4GAAL7Ab4=');
Prepare:= BitmapFromString(1, 1, 'beNq7u+YTAATkAnw=');
Prepare2:= BitmapFromString(1, 1, 'beNpzkugGAAGEAOY=');
Prepare3:= BitmapFromString(1, 1, 'beNpbvasXAAQFAfM=');
Serve:= BitmapFromString(1, 1, 'beNq7/fQiAAUvApI=');
Login:= BitmapFromString(1, 1, 'beNq7ceMGAAUTAok=');
Cook:= BitmapFromString(1, 1, 'beNqbMWMGAAOTAck=');
Exitbutton:= BitmapFromString(1, 1, 'beNqbHHoQAAMnAao=');
Brownies:= BitmapFromString(1, 1, 'beNp7/PMRAAWAAr8=');
end;

procedure UseBitmap;
begin
if(FindBitmap(Levelup,x,y)) then
begin
  wait(500)
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Ok,x,y)) then
begin
  wait(2000)
  ClickMouse(x,y,true);
  wait(500)
end;
begin
if(FindBitmap(Exitbutton,x,y)) then
begin
  wait(500)
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Prepare,x,y)) then
begin
  wait(500);
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Prepare2,x,y)) then
begin
  wait(500);
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Prepare3,x,y)) then
begin
  wait(500);
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Serve,x,y)) then
begin
  wait(500);
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Login,x,y)) then
begin
  wait(500);
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Cook,x,y)) then
begin
  wait(500);
  ClickMouse(x,y,true);
end;
begin
if(FindBitmap(Brownies,x,y)) then
begin
wait(500);
ClickMouse(x,y,true);
end;
end.

Edited by Freddy
Link to comment
Share on other sites

'begin' is used to start a new block of code, there's no need to write 'begin' after an 'end' statement.

 

if(FindBitmap(Levelup,x,y)) then
begin
wait(500)
ClickMouse(x,y,true);
end;
[u][b]begin <- wrong, should be removed[/b][/u]
if(FindBitmap(Ok,x,y)) then
begin
wait(2000)
ClickMouse(x,y,true);
wait(500)
end;

Link to comment
Share on other sites

That's good to know! But now I'm getting semicolon expected errors..?

 

---MERGED---

 

Actually nevermind, I figured it out! How would I make this script loop? Like where would I put repeat and until(false) if I wanted it to keep searching+clicking on the bitmaps?

program AutoBrownieBaker;

var
Cook: Integer;
Brownies: Integer;
Exitbutton: Integer;
Ok: Integer;
Prepare: Integer;
Prepare2: Integer;
Prepare3: Integer;
Serve: Integer;
Login: Integer;
Levelup: Integer;
x,y: Integer;

procedure LoadBmps;
begin
Levelup:= BitmapFromString(1, 1, 'beNrLSDsPAALWAZ4=');
Ok:= BitmapFromString(1, 1, 'beNpLKX4GAAL7Ab4=');
Prepare:= BitmapFromString(1, 1, 'beNq7u+YTAATkAnw=');
Prepare2:= BitmapFromString(1, 1, 'beNpzkugGAAGEAOY=');
Prepare3:= BitmapFromString(1, 1, 'beNpbvasXAAQFAfM=');
Serve:= BitmapFromString(1, 1, 'beNq7/fQiAAUvApI=');
Login:= BitmapFromString(1, 1, 'beNq7ceMGAAUTAok=');
Cook:= BitmapFromString(1, 1, 'beNqbMWMGAAOTAck=');
Exitbutton:= BitmapFromString(1, 1, 'beNqbHHoQAAMnAao=');
Brownies:= BitmapFromString(1, 1, 'beNp7/PMRAAWAAr8=');
end;

procedure UseBitmap;
begin
 if(FindBitmap(Levelup,x,y)) then
  begin
   wait(500)
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Ok,x,y)) then
  begin
   wait(2000)
   ClickMouse(x,y,true);
   wait(500)
  end;
 if(FindBitmap(Exitbutton,x,y)) then
  begin
   wait(500)
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Prepare,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Prepare2,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Prepare3,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Serve,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Login,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Cook,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
 if(FindBitmap(Brownies,x,y)) then
  begin
   wait(500);
   ClickMouse(x,y,true);
  end;
end;
begin
end.

Edited by Freddy
Link to comment
Share on other sites

Put repeat before the part you want to repeat and until after it. Like this:

program New;
begin
 repeat
   if(FindBitmap(Levelup,x,y)) then    begin
     wait(500);
     ClickMouse(x,y,true);
   end;
 until 1 = 1;
end.

Everything between the 'repeat' to 'until' would repeat forever since the condition to keep repeating is 1 = 1, always True. You can also say 'until True'.

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...