Results 1 to 8 of 8

Thread: How do I restart repeat loop from inside loop

  1. #1
    Join Date
    Dec 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default How do I restart repeat loop from inside loop

    As title says. I made a script and in the main line I have a repeat loop because I want it to do a bunch of procedures over and over again for about 120 repeats. But theres a random chance something will mess up the script so I need it to restart the loop from the top when that happens. Help please.

  2. #2
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    550
    Mentioned
    8 Post(s)
    Quoted
    71 Post(s)

    Default

    Too vague. Paste some concrete code and it will be easier to give you advice.
    By mess up the script do you mean that the entire script terminates, or that this specific loop ends?
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  3. #3
    Join Date
    Nov 2018
    Location
    System32
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Simba Code:
    if messup then
      FirstProcedure;
    Is that what you mean? Would be hard to give you good advice without at least seeing the loop.
    Last edited by Zombified; 12-07-2018 at 05:35 AM.

  4. #4
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    805
    Mentioned
    11 Post(s)
    Quoted
    330 Post(s)

    Default

    Could look at Label/GoTo, but you need to put in your script a specific way or it can cause issues.

    Little guide here: https://villavu.com/forum/showthread.php?t=16507

    There are many different ways to work with looped stuff, but you need to be more specific in what you are asking. Paste your code, or if you don't want it public, write up a procedure of how your script functions, and what you want to achieve.

  5. #5
    Join Date
    Dec 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I tried posting some stuff but I got a message saying a mod needs to review it first had code in it

  6. #6
    Join Date
    Nov 2018
    Location
    System32
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by Nerdy777 View Post
    I tried posting some stuff but I got a message saying a mod needs to review it first had code in it
    In the meantime, feel free to join the Discord server for help! It may not be instant, but there are a lot of helpful members.
    https://discordapp.com/invite/627s6fm

  7. #7
    Join Date
    Dec 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    If the game is running correctly it wouldn't crash and the procedures would be able to go in order from 1 - 5, but if it crashes I need the script to detect the game crashed and reopen the game but when the game opens it doesn't open up to where the game left off. I need the script to essential go 1 - 3 and then back to 1 and repeat procedures 1 - 5 as if nothing ever happened whenever the second FindDTM runs successfully.

    The script detects all this in procedure 3. I've shown below 2 if FindDTMs, whenever the script reads up to the end of the second FindDTM I need it to restart the script completely at procedure 1, forgetting everything thats ever happened inside the repeat loop.

    ------------------------------------------------------------------------------------------------------

    procedure 1

    begin
    end

    procedure 2

    begin
    end

    procedure 3

    begin

    if FindDTM(Example1, v, w, 191, 4, 748, 976) or
    FindDTM(Example2, v, w, 191, 4, 748, 976) then
    begin
    writeLn('--- App Crashed! WAITING 10 seconds for user input OR Going to try and REOPEN...');
    wait(10000);
    DidWeCrashProcedure;
    MoveMouse(317, 791);
    GetMousePos(v, w);
    ClickMouse(v, w, mouse_Left);
    wait(2000);
    MoveMouse(405, 220);
    GetMousePos(v, w);
    ClickMouse(v, w, mouse_Left);
    wait(2000);
    MoveMouse(326, 627);
    GetMousePos(v, w);
    ClickMouse(v, w, mouse_Left);
    writeLn('WAITING 25 seconds for app to open');
    wait(10000);
    writeLn('Been 10 seconds');
    wait(10000);
    writeLn('Been 20 seconds');
    wait(5000);
    writeLn('FINISHED waiting 25 secconds');
    if FindDTM(Example3, v, w, 298, 483, 634, 622) then
    begin
    MoveMouse(470, 550);
    GetMousePos(v, w);
    ClickMouse(v, w, mouse_Left);
    wait(8000);
    MoveMouse(476, 100);
    GetMousePos(v, w);
    ClickMouse(v, w, mouse_Left);
    wait(200);
    ClickMouse(v, w, mouse_Left);
    HoldMouse(v, w, mouse_Left);
    wait(200);
    MoveMouse(476, 120);
    wait(200);
    MoveMouse(476, 220);
    wait(200);
    MoveMouse(476, 320);
    wait(200);
    MoveMouse(476, 420);
    wait(200);
    GetMousePos(v, w);
    ReleaseMouse(v, w, mouse_Left);
    ...
    end

    procedure 4

    begin
    end

    procedure 5

    begin
    end


    begin

    t := 0;
    ClearDebug;
    LoadDTM;
    repeat
    procedure 1
    procedure 2
    procedure 3
    procedure 4
    procedure 5
    t := t+1;
    until(t = 120);
    CrashClient;

    end

    ------------------------------------------------------------------------------------------------------
    Last edited by Nerdy777; 12-07-2018 at 05:15 PM.

  8. #8
    Join Date
    Oct 2012
    Posts
    1,225
    Mentioned
    39 Post(s)
    Quoted
    579 Post(s)

    Default

    Simba Code:
    for loop := 1 to 120 do
    begin
      //proc1();
      //proc2();

      if problem then
        loop := 1;
    end;

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •