Results 1 to 5 of 5

Thread: Add a limit to how many times a repeat can happen

  1. #1
    Join Date
    Oct 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Add a limit to how many times a repeat can happen

    Hey, basically I've been making this script for cutting a magic tree on my private server so i can make a detection system... I have successfully made the script work and have ran it for about 3 hours without fail but when I ran it over night, i must of suffered from some lag and because i do all my teleporting and banking by co-ordinated and wait's to be the same every time, my character has ran off into an area and sits there "waiting for tree...". This tree isn't in this area and never will be so i wanted to add a limit to how many times my script can actually loop before it goes to a fial safe and teleports away.
    Heres my waiting script:
    Simba Code:
    //Theres obviously more up here, secret ;)
           until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance))
           or not(FindColorSpiralTolerance (x, y, 3029313, 702, 418, 710, 428, 20))
           writeln('Waiting for tree');
           wait(3000);
           until not(FindColorSpiralTolerance(x, y, 3029313, 702, 418, 710, 428, 20));
           Writeln('Full inventory, Going to bank.');
           end;
    I was trying to add something like this:
    Simba Code:
    var
      I :Integer; //this is declared earlier
    Simba Code:
    //Theres obviously more up here, secret ;)
           until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance))
           or not(FindColorSpiralTolerance (x, y, 3029313, 702, 418, 710, 428, 20))
           WriteLn('waited ' + IntToStr(I) + ' Times.'); //tells you how many times you have waited
           Inc(I);
           wait(3000);
           until not(FindColorSpiralTolerance(x, y, 3029313, 702, 418, 710, 428, 20)); //until inventory is full
           or until(I = 6); //or until you have waited 6 times
           Writeln('Full inventory, Going to bank.');
           end;

    but I get:
    Code:
    [Error] C:\Users\Taylor\Desktop\Working Magic Tree Bot.simba(36:8): Identifier expected at line 35
    Compiling failed.
    I also treid:
    Simba Code:
    //Theres obviously more up here, secret ;)
           until not(FindColorSpiralTolerance(x, y, TreeColour, TreeX1, TreeY1, TreeX2, TreeY2,  TreeColourTolerance))
           or not(FindColorSpiralTolerance (x, y, 3029313, 702, 418, 710, 428, 20))
           WriteLn('waited ' + IntToStr(I) + ' Times.');
           Inc(I);
           wait(3000);
           until not(FindColorSpiralTolerance(x, y, 3029313, 702, 418, 710, 428, 20)) //took out the semi-colon thing
           or until(I = 6);
           Writeln('Full inventory, Going to bank.');
           end;
    then i get
    Code:
    [Error] C:\Users\Taylor\Desktop\Working Magic Tree Bot.simba(36:11): Syntax error at line 35
    Compiling failed.
    any suggestions?

  2. #2
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    You dont have to do 'until Condition1 or until condition2', just 'until (Condition1 or Condition2)'. 1 until is sufficient.

  3. #3
    Join Date
    Oct 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I do not fully understand. So should i do this:

    Simba Code:
    until not(FindColorSpiralTolerance(x, y, 3029313, 702, 418, 710, 428, 20)
           or until(I = 6))
    because i get errors with that too.

  4. #4
    Join Date
    Oct 2012
    Posts
    13
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Oh i get you, so i did this:

    Simba Code:
    until not(FindColorSpiralTolerance(x, y, 3029313, 702, 418, 710, 428, 20));
           or (I = 6);
    and got the error
    Code:
    [Error] C:\Users\Taylor\Desktop\Working Magic Tree Bot.simba(36:8): Identifier expected at line 35
    Compiling failed.
    Fixed it, took out the semi-colons !! thank you very much

    Edit: Now it works but once it has found the tree, after the tree goes again it continues to count from the number it left off at, D:
    Last edited by h4x0rdafuq; 10-05-2012 at 10:27 AM.

  5. #5
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    The variable I is declared locally so it will reset to 0 when the procedure/function is recalled. If you prefer to retain its value throughout the script, declare it globally.
    i.e. Declare it outside of procedures, like below program name.

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
  •