Results 1 to 4 of 4

Thread: Restarting Script?

  1. #1
    Join Date
    Aug 2009
    Posts
    164
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Restarting Script?

    Is there a command to restart a script? I couldn't find anything in the manuals except terminate...

    Thanks!

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I am not sure about a command, but you could just do it using an extra loop outside of your main loop:

    SCAR Code:
    repeat
      repeat
        Mine;
        Bank;
        Walk;
        Whatever;
        if(YouWantToRestart)then
          break;
      until(false);
    until(false);

    So just put an extra repeat until around your main loop. Whenever you want to restart, just call a break.

  3. #3
    Join Date
    Aug 2009
    Posts
    164
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm looking for a way to restart the script during a procedure, such as:

    If we are not where we want to be, restart script.
    Else: Continue

    Any ideas?

  4. #4
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    What you want is labels.
    Example:

    SCAR Code:
    program LabelExample;
    var
      I : Integer;

    label
      YourLabel;   //Declare a label...I've called it YourLabel

    begin
      YourLabel:  //Where to come back to...Put a colon (:) on the end, not a semi-colon (;)
      I:= Random(10);
      if (I <> 5) then
      begin
        WriteLn('Going back');
        goto YourLabel; //This tells the script to go back to YourLabel (3 lines up)
      end else
        WriteLn('I = 5!');  //Puts 'I = 5!' in the debug box when I does = 5
    end.

    Here are two other tuts:
    http://www.villavu.com/forum/showthr...ghlight=labels
    http://www.villavu.com/forum/showthr...ghlight=labels

    Richard.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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
  •