Jump to content
byron

scar divi noob! need REPEAT or LOOP

Recommended Posts

hey All!,

 

i am new to scripting with scar divi .. or scripting in general

i used axife mouse recorder but cant find a registered copy or even a copy to buy so i can save my scripts

so i desided to go in the deep and use scar divi

i am making a script with very basic functions

its for dragon city (facebook) all i want it to do is click the habitasts and colect the gold (only needs to be clicked)

so i have used this:

 

MoveMouse(837, 194);

MouseBtnDown(837, 194, mbleft);

Wait(100);

MouseBtnUp(837, 194, mbleft);

Wait(1000);

 

of course using the x,y of each habitat

 

 

i have also made a fail safe function... the idea is that it enters the url of the game and restarts it in case a pop up ruins the sequence

 

MoveMouse(190, 43);

MouseBtnDown(190, 43, mbleft);

Wait(100);

MouseBtnUp(190, 43, mbleft);

 

TypeText('http://apps.facebook.com/dragoncity/');

MoveMouse(190, 70);

Wait(500);

MouseBtnDown(190, 70, mbleft);

Wait(100);

 

NOTE: could not find how to use the enter key so i click on the auto fill url

 

 

so now i need it to loop though the habbits 15 times before it restarts from the beginning

and play till i manualy stop it!!!

 

so what is the most basic way to repeat a script after looping a part of it?

 

- - - Updated - - -

 

if not for 15 times... minutes will do!

Link to comment
Share on other sites

Edit: SCAR is written in Pascal. For more help, you can google something like "looping in Pascal."

 

If you need to loop a certain number of times, I would recommend the For...Do loop

At the end of each cycle, it increases i by 1 and it will continue until i=15. You need to declare i in your variables, though.

 

To repeat something until a condition is met, I recomment Repeat...Until (condition)

So, your script would look like

 

Program New;
Var i:Integer;

begin
  Repeat
     For i:=1 to 15 Do
        Begin
           //Your code here to repeat
        End;
    //More Code here
  Until false; //Until you use the hotkeys to stop the script
end.

 

Using Until false; is never a good idea in a script, but it doesn't look like you have much coding experience so it will do for your sake. You just use the hotkeys or press the stop button in scar.

Edited by lazarbeam
Link to comment
Share on other sites

i get an error on

Until false; //Until you use the hotkeys to stop the script

end.

 

on the end. line

 

identifier expected

 

 

 

Program New;

Var i:Integer;

what i did is

 

begin

// code here

 

Repeat

For i:=1 to 15 Do

Begin

//my code to repeat

End;

Until false; //Until you use the hotkeys to stop the script

end.

 

- - - Updated - - -

 

this is all of it

 

program New;

Var i:Integer;

begin

MoveMouse(1245, 750);

MouseBtnDown(1245, 750, mbleft);

Wait(100);

MouseBtnUp(1245, 750, mbleft);

Wait(1000);

MoveMouse(1174, 450);

MouseBtnDown(1174, 450, mbleft);

Wait(100);

MouseBtnUp(1174, 450, mbleft);

Wait(1000);

MoveMouse(1277, 480);

MouseBtnDown(1277, 480, mbleft);

Wait(100);

MouseBtnUp(1277, 480, mbleft);

Wait(1000);

MoveMouse(1174, 450);

MouseBtnDown(1174, 450, mbleft);

Wait(100);

MouseBtnUp(1174, 450, mbleft);

Wait(1000);

MoveMouse(1277, 480);

MouseBtnDown(1277, 480, mbleft);

Wait(100);

MouseBtnUp(1277, 480, mbleft);

Wait(5000);

MoveMouse(190, 43);

MouseBtnDown(190, 43, mbleft);

Wait(100);

MouseBtnUp(190, 43, mbleft);

 

TypeText('http://apps.facebook.com/dragoncity/');

MoveMouse(190, 70);

Wait(500);

MouseBtnDown(190, 70, mbleft);

Wait(100);

MouseBtnUp(190, 70, mbleft);

Wait(25000);

MoveMouse(1357, 719);

MouseBtnDown(1357, 719, mbleft);

Wait(100);

MouseBtnUp(1357, 719, mbleft);

Wait(500);

MoveMouse(1357, 719);

MouseBtnDown(1357, 719, mbleft);

Wait(100);

MouseBtnUp(1357, 719, mbleft);

Wait(500);

MoveMouse(1357, 719);

MouseBtnDown(1357, 719, mbleft);

Wait(100);

MouseBtnUp(1357, 719, mbleft);

Wait(500);

MoveMouse(1357, 719);

MouseBtnDown(1357, 719, mbleft);

Wait(100);

MouseBtnUp(1357, 719, mbleft);

Wait(500);

MoveMouse(1357, 719);

MouseBtnDown(1357, 719, mbleft);

Wait(100);

MouseBtnUp(1357, 719, mbleft);

Wait(500);

MoveMouse(1357, 719);

MouseBtnDown(1357, 719, mbleft);

Wait(100);

MouseBtnUp(1357, 719, mbleft);

Wait(500);

 

 

MoveMouse(905, 96);

MouseBtnDown(905, 96, mbleft);

Wait(100);

MouseBtnUp(905, 96, mbleft);

Wait(500);

 

MoveMouse(888, 119);

MouseBtnDown(888, 119, mbleft);

Wait(100);

MouseBtnUp(888, 119, mbleft);

Wait(500);

MoveMouse(1068, 652);

MouseBtnDown(1068, 652, mbleft);

Wait(100);

MouseBtnUp(1068, 652, mbleft);

Wait(1000);

MoveMouse(888, 119);

MouseBtnDown(888, 119, mbleft);

Wait(100);

MouseBtnUp(888, 119, mbleft);

Wait(500);

 

MoveMouse(1068, 652);

MouseBtnDown(1068, 652, mbleft);

Wait(100);

MouseBtnUp(1068, 652, mbleft);

Wait(1000);

MoveMouse(1068, 652);

MouseBtnDown(1068, 652, mbleft);

Wait(100);

MouseBtnUp(1068, 652, mbleft);

Wait(1000);

MoveMouse(1068, 652);

MouseBtnDown(1068, 652, mbleft);

Wait(100);

MouseBtnUp(1068, 652, mbleft);

Wait(1000);

begin

Repeat

For i:=1 to 15 Do

Begin

MoveMouse(837, 194);

MouseBtnDown(837, 194, mbleft);

Wait(100);

MouseBtnUp(837, 194, mbleft);

Wait(1000);

 

MoveMouse(784, 221);

MouseBtnDown(784, 221, mbleft);

Wait(100);

MouseBtnUp(784, 221, mbleft);

Wait(1000);

 

MoveMouse(838, 244);

MouseBtnDown(838, 244, mbleft);

Wait(100);

MouseBtnUp(838, 244, mbleft);

Wait(1000);

 

MoveMouse(880, 280);

MouseBtnDown(880, 280, mbleft);

Wait(100);

MouseBtnUp(880, 280, mbleft);

Wait(1000);

 

MoveMouse(630, 325);

MouseBtnDown(630, 325, mbleft);

Wait(100);

MouseBtnUp(630, 325, mbleft);

Wait(1000);

 

MoveMouse(686, 339);

MouseBtnDown(686, 339, mbleft);

Wait(100);

MouseBtnUp(686, 339, mbleft);

Wait(1000);

 

MoveMouse(720, 388);

MouseBtnDown(720, 388, mbleft);

Wait(100);

MouseBtnUp(720, 388, mbleft);

Wait(1000);

 

MoveMouse(644, 378);

MouseBtnDown(644, 378, mbleft);

Wait(100);

MouseBtnUp(644, 378, mbleft);

Wait(1000);

 

MoveMouse(598, 405);

MouseBtnDown(598, 405, mbleft);

Wait(100);

MouseBtnUp(598, 405, mbleft);

Wait(1000);

 

MoveMouse(665, 418);

MouseBtnDown(665, 418, mbleft);

Wait(100);

MouseBtnUp(665, 418, mbleft);

Wait(1000);

 

MoveMouse(585, 457);

MouseBtnDown(585, 457, mbleft);

Wait(100);

MouseBtnUp(585, 457, mbleft);

Wait(1000);

 

MoveMouse(580, 361);

MouseBtnDown(580, 361, mbleft);

Wait(100);

MouseBtnUp(580, 361, mbleft);

Wait(1000);

 

MoveMouse(537, 385);

MouseBtnDown(537, 385, mbleft);

Wait(100);

MouseBtnUp(537, 385, mbleft);

Wait(1000);

 

MoveMouse(536, 320);

MouseBtnDown(536, 320, mbleft);

Wait(100);

MouseBtnUp(536, 320, mbleft);

Wait(1000);

 

MoveMouse(490, 344);

MouseBtnDown(490, 344, mbleft);

Wait(100);

MouseBtnUp(490, 344, mbleft);

Wait(1000);

 

MoveMouse(437, 367);

MouseBtnDown(437, 367, mbleft);

Wait(100);

MouseBtnUp(437, 367, mbleft);

Wait(1000);

 

MoveMouse(522, 444);

MouseBtnDown(522, 444, mbleft);

Wait(100);

MouseBtnUp(522, 444, mbleft);

Wait(1000);

 

MoveMouse(471, 401);

MouseBtnDown(471, 401, mbleft);

Wait(100);

MouseBtnUp(471, 401, mbleft);

Wait(1000);

End;

Until false; //Until you use the hotkeys to stop the script

end.

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