Results 1 to 8 of 8

Thread: Line 1: [Error] Variable Expected in script

  1. #1
    Join Date
    Apr 2007
    Posts
    220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Line 1: [Error] Variable Expected in script

    He I got a problem with a weird error. Line 1: [Error] (1:1): Variable Expected in script D:\Documents and Settings...Myscript.scar It says line 1 but thats fake the error can be anywhere in the script. I think it has something to do with some marks and time. This is my main loop where I use the timeing things in:
    SCAR Code:
    begin
      SetUpScript;
      SetUpRunescape;
      AntiBannage;
      MarkTime(TRTimeMark)

      if(players[currentplayer].loc='')then
        begin
          if(FindSymbol(x, y, 'bank'))then
          Players[CurrentPlayer].loc:= 'Falador(Bank)';
          if(FindSymbol(x, y, 'mine'))then
          Players[CurrentPlayer].loc:= 'Mine';
        end;

    repeat
      if(Players[CurrentPlayer].loc='Falador(Bank)')then
      begin
        WeAreInFally;
      end;

      if(Players[CurrentPlayer].loc='Mine')then
      begin
        WeAreInMine;
      end;

    until(not(LoggedIn))or
         (not(FindPickHeadColor))or
         (NoPick)or
         (WeAreDead)or
         (TimeFromMark(TRTimeMark)> TotalRunTime*60000)

    if(TimeFromMark(TRTimeMark)> TotalRunTime*60000)then
    begin
      PlayerProgressReport;
      FinalProgressReport;
      Writeln('TotalRunTime is up.');
      Writeln('Script finished.');
      TerminateScript;
    end;

    if(not(LoggedIn))then
    begin
      Players[CurrentPlayer].loc:= 'Lost';
      PlayerProgressReport;
      NextPlayer(False);
    end;

    if(not(FindPickHeadColor))then
    begin
      Writeln('Can''t FindPickHeadColor.');
      Writeln('Switching to next Player.');
      Players[CurrentPlayer].loc:= 'NoPickHeadColor';
      PlayerProgressReport;
      NextPlayer(False);
    end;

    if(NoPick)then
    begin
      Writeln('Can''t Find(useable)Pick.');
      Writeln('Switching to next player.');
      Players[CurrentPlayer].loc:= 'NoPick';
      PlayerProgressReport;
      NextPlayer(False);
    end;

    if(WeAreDead)then
    begin
      Writeln('Player Died.');
      Writeln('Switching to next player.');
      Players[CurrentPlayer].loc:= 'Died';
      PlayerProgressReport;
      NextPlayer(False);
    end;

    FinalProgressReport;
    end.


    In my constants I have this:
    SCAR Code:
    TotalRunTime = 7; //How long does the script runs?(Minutes)
    In my vars I got this:
    SCAR Code:
    TRTimeMark: integer;

    I'm not sure its with the marks and stuff.. Can someone help plz I'm working on this error for hours but I can't solve it and the error doesn't gives much info

  2. #2
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Add procedures and one mainloop.

  3. #3
    Join Date
    Apr 2007
    Posts
    220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Pentti View Post
    Add procedures and one mainloop.
    The first thing is my main loop .. But I won't add the real script cuz I worked so hard on it and I don't want someone to steal it or something.(BTW its now 800 lines or something).. But cant someone help me? There must be an explanation for this error And do you think my mainloop is ok??

  4. #4
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Fearlesssss View Post
    The first thing is my main loop .. But I won't add the real script cuz I worked so hard on it and I don't want someone to steal it or something.(BTW its now 800 lines or something).. But cant someone help me? There must be an explanation for this error And do you think my mainloop is ok??
    Oh ok, I think you forget an "end;" somewhere.

  5. #5
    Join Date
    Apr 2007
    Posts
    220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Pentti View Post
    Oh ok, I think you forget an "end;" somewhere.
    Could be .. I think it could be in my mining procedure but im a bit confused atm. And Pentti tnx a lot for quick reactions.
    Here are some procedures that are needed for the mining procedure:
    SCAR Code:
    procedure CheckPick;
    begin
    if(FindPick)then
      begin
    //    if(FearlessDebug)then Writeln('Found pickaxe.');
      end else
      begin
        Writeln('Can''t Find(useable)Pick');
        Writeln('Switching to next player.');
        Players[CurrentPlayer].loc:= 'NoPick';
        PlayerProgressReport;
        NextPlayer(False);
      end;
    end;
    SCAR Code:
    procedure CheckFight;
    begin
      if(FindFight)then
      begin
        RunAwayDirection(RunDir);
        wait(13000);
        RunBack;
        FightsPlayer:= FightsPlayer+1;
        FightsTotal:= FightsTotal+1;
      end;
    end;
    SCAR Code:
    procedure CheckGas;
    begin
      if(GasColors(gx, gy))then
      begin
        GassesPlayer:= GassesPlayer+1;
        GassesTotal:= GassesTotal+1;
      end;
    end;
    SCAR Code:
    function FindFastRandoms: Boolean; //Credits to: WT-Fakawi.
    var
      i: Integer;
    begin
      for i := 1 to 10 do
      begin
        case I of
          1: if FindDead then
              Result := True;
          2: if FindMod then
              Result := False;
          3: if FindMime then
              Result := True;
          4: if FindMaze then
              Result := True;
          5: if FindQuiz then
              Result := True;
          6: if FindDemon then
              Result := True;
          7: begin
              if NoGameTab then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'No GameTab';
                Logout;
                Exit;
              end;
            end;
          7: begin
              if InBlack then
              begin
                Result := True;
                Players[CurrentPlayer].loc := 'InBlack';
                Logout;
                Exit;
              end;
            end;
          8: If RC Then
              Result := True;
          9: if FindTalk then
              Result := True;
          {10: If HandleTrade Then
               Result := True; }

        end;
        wait(1);
      end;
    end;
    SCAR Code:
    procedure FckRandoms;
    begin
      FindNormalRandoms;
      FindFastRandoms;
    end;
    Few that's all I think now the mining procedure:
    SCAR Code:
    procedure MineCoal;
    var
    MCMark1, MCMark2: integer;
    begin
      Tries:= 0;
      repeat
      CheckFight;                                    //Fight
        if(FindObjOre2(x, y, 'ine', CoalColor1, CoalTol1, 4))or
          (FindObjOre2(x, y, 'ine', CoalColor2, CoalTol2, 4))or
          (FindObjOre2(x, y, 'ine', CoalColor3, CoalTol3, 4))or
          (FindObjOre2(x, y, 'ine', CoalColor4, CoalTol4, 4))then
         begin
           MMouse(x, y, 3, 3)
           CheckGas;                                 //Gas
           wait(50+random(100));
         end else
         begin
           Tries:= Tries+1;
         end;
      until(IsUpTextMulti('ine','ock','Mine'))or
           (Tries= 50)

      if(Tries= 50)then
      begin
        Writeln('Couldn''t find the Coal Ore.')
        Players[CurrentPlayer].loc:= 'Failed FindCoal'
        PlayerProgressReport;
        NextPlayer(False);
      end;

      if(IsUpTextMulti('ine','ock','Mine'))then
      begin
        if(Random(20) < 17)then
        begin
          Mouse(x, y, 0, 0, true);
          Flag;
          if(InChat('no ore curr'))then
          begin
            FckRandoms;
            MineCoal;
          end;
          MarkTime(MCMark1);
        end;
        repeat
          CheckGas;                                //Gas;
          CheckPick;
          wait(50);
          FckRandoms;                            //Anti-Randoms
          wait(50);
          CheckPick;                              //PickAxe
          wait(50);
          FindFight;                             //Fight;
         until(InChat('ou manage'))or
              (TimeFromMark(MCMark1 >= MineCoalTime{*1000}))
      end else
      begin
        Mouse(x, y, 0, 0, false);
        ChooseOption(x, y, 'Mine');
        Flag;
        if(InChat('no ore curr'))then
        begin
          FckRandoms;
          MineCoal;
        end;
        MarkTime(MCMark2);
        repeat
       //   CheckGas;                                //Gas;
          CheckPick;
          wait(50);
          FckRandoms;                            //Anti-Randoms
          wait(50);
          CheckPick;                              //PickAxe
          wait(50);
          FindFight;                             //Fight;
        until(InChat('ou manage'))or
             (TimeFromMark(MCMark2 >= MineCoalTime{*1000}))

        if(InChat('ou manage'))then
        begin
      //    if(FearlessDebug)then Writeln('Mined a Coal Ore');
          OresMinedPlayer:= OresMinedPlayer+1;
          OresMinedTotal:= OresMinedTotal+1;
        end;

        if(TimeFromMark(MCMark2) >= MineCoalTime{*1000})then
        begin
          Writeln('It took to long to mine the Coal Ore.');
          Writeln('Switching to next player.');
          Players[CurrentPlayer].loc:= 'Failed MineCoal';
          PlayerProgressReport;
          NextPlayer(False);
        end;
      end;
    end;

    Maybe you can find it?? Cuz I'm not really sure where to place an end cuz with all the repeats

    And BTW Don't even think about stealing this!!!!!
    (Not rlly talking to you pentti cuz I doubt it hardly if you gonna steal it)

  6. #6
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Not sure if there's anything wrong in procedure MineCoal;
    Try making it like this:
    SCAR Code:
    procedure MineCoal;
    {var
    MCMark1, MCMark2: integer;
    begin
      Tries:= 0;
      repeat
      CheckFight;                                    //Fight
        if(FindObjOre2(x, y, 'ine', CoalColor1, CoalTol1, 4))or
          (FindObjOre2(x, y, 'ine', CoalColor2, CoalTol2, 4))or
          (FindObjOre2(x, y, 'ine', CoalColor3, CoalTol3, 4))or
          (FindObjOre2(x, y, 'ine', CoalColor4, CoalTol4, 4))then
         begin
           MMouse(x, y, 3, 3)
           CheckGas;                                 //Gas
           wait(50+random(100));
         end else
         begin
           Tries:= Tries+1;
         end;
      until(IsUpTextMulti('ine','ock','Mine'))or
           (Tries= 50)
     
      if(Tries= 50)then
      begin
        Writeln('Couldn''t find the Coal Ore.')
        Players[CurrentPlayer].loc:= 'Failed FindCoal'
        PlayerProgressReport;
        NextPlayer(False);
      end;
     
      if(IsUpTextMulti('ine','ock','Mine'))then
      begin
        if(Random(20) < 17)then
        begin
          Mouse(x, y, 0, 0, true);
          Flag;
          if(InChat('no ore curr'))then
          begin
            FckRandoms;
            MineCoal;
          end;
          MarkTime(MCMark1);
        end;
        repeat
          CheckGas;                                //Gas;
          CheckPick;
          wait(50);
          FckRandoms;                            //Anti-Randoms
          wait(50);
          CheckPick;                              //PickAxe
          wait(50);
          FindFight;                             //Fight;
         until(InChat('ou manage'))or
              (TimeFromMark(MCMark1 >= MineCoalTime*1000))
      end else
      begin
        Mouse(x, y, 0, 0, false);
        ChooseOption(x, y, 'Mine');
        Flag;
        if(InChat('no ore curr'))then
        begin
          FckRandoms;
          MineCoal;
        end;
        MarkTime(MCMark2);
        repeat                          
          CheckPick;
          wait(50);
          FckRandoms;                          
          wait(50);
          CheckPick;                            
          wait(50);
          FindFight;                            
        until(InChat('ou manage'))or
             (TimeFromMark(MCMark2 >= MineCoalTime*1000))
     
        if(InChat('ou manage'))then
        begin
          OresMinedPlayer:= OresMinedPlayer+1;
          OresMinedTotal:= OresMinedTotal+1;
        end;
     
        if(TimeFromMark(MCMark2) >= MineCoalTime*1000)then
        begin
          Writeln('It took to long to mine the Coal Ore.');
          Writeln('Switching to next player.');
          Players[CurrentPlayer].loc:= 'Failed MineCoal';
          PlayerProgressReport;
          NextPlayer(False);
        end;
      end;}

    end;
    Try to start SCAR and check if it still gives any error, if it doesn't, then the bug is in that procedure.

  7. #7
    Join Date
    Apr 2007
    Posts
    220
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Tnx a lot man. I did that with a lot of procedures to check but I didn't with the mining procedure.. Pretty stupid. Now I need to find out the error Wish me luck

  8. #8
    Join Date
    May 2007
    Posts
    127
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    make sure you have not forgot an end; somewhere...i agree with pentti

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 11-02-2008, 12:39 PM
  2. Replies: 2
    Last Post: 08-25-2008, 01:32 AM
  3. Replies: 10
    Last Post: 06-01-2008, 02:15 PM
  4. Replies: 3
    Last Post: 02-07-2008, 02:15 AM
  5. Line 0: [Error] (0:1): Variable Expected in script
    By cathering_ in forum OSR Help
    Replies: 15
    Last Post: 09-09-2007, 11:40 AM

Posting Permissions

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