Results 1 to 11 of 11

Thread: Where does my error come from?

  1. #1
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Where does my error come from?

    First of i want to say thanks as you guys have been very helpful and most my posts seems to be here asking for help.

    Well im getting Invalid number of parameters and proberly a number of other errors as i get to the end of my first scirpt, its only a small 175 line scirpt.

    Simba Code:
    program new;
    //{$DEFINE SMART}
    {$i srl\srl.scar}
    //{$i reflection\reflection.simba}

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;//Change this accordingly
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      With Players[0] do
      begin
        Name :=''; //Name
        Pass :=''; //Pass
        Active := True; //True if you want this player to be used
        Integers[0] := 0;//Time To run before breaking
      end;

      {
      With Players[1] do  //copy and change number accordingly to add players
      begin
        Name :='';
        Pass :='';
        Active:=True;
        Booleans[0] := false;//Are you ranging?
        Integers[0] := 0;//1st color of monster
        Integers[1] := 0;//2nd color of monster
        Integers[2] := 0;//3rd color of monster
        Strings[0] := '';//monster name
      end;
      }

    end;

    Procedure MyWait(TimeToWait:Integer);
    Var Time:Integer;
    Begin
    MarkTime(Time);
    FindNormalRandoms;
      Repeat
        Case Random(5000) Of
          1: RandomRClick;
          2: HoverSkill('attack',False);
          3: HoverSkill('defence',False);
          4: HoverSkill('strength',False);
          5: HoverSkill('hitpoints',False);
          6: PickUpMouse;
          7: RandomMovement;
          8: BoredHuman;
          9: LevelUp;
        End;
      Until(TimeFromMark(Time)>=TimeToWait)
    End;

    Function FindChicken:Boolean;
    Var x,y,i,tol:Integer;
    Begin
      I := 0
      tol := 41
      If Not LoggedIn Then Exit;
      If srl_InFight Then Exit;
      Repeat
        If FindColorSpiralTolerance(x,y,3655910,MSX1,MSY1,MSX2,MSY2,41) Then
        Begin
          MMouse(x,y,2,2);
          MyWait(Random(50));
          writeln('Moving Mouse');
          If IsUpText('ick') Then
          Begin
            GetMousePos(x,y);
            writeln('Getting mouse pos');
            MyWait(Random(100));
            If Random(20) = 1 Then
            Begin
              MyWait(Random(10));
              Mouse(x,y,0,0,True);
              writeln('Clicking');
              Result := True;
              Break;
            End Else Begin
              Mouse(x,y,0,0,False);
              ChooseOption('ttac');
              writeln('Right clicking');
              Result := True;
              Break;
             End;
          End Else Begin
            writeln('Couldnt not find uptext');
            Inc(I);
          End;
        End Else Begin
          writeln('Did not find colour');
          Inc(I);
          Inc(Tol);
        End;
      Until(I>20)
      If I > 20 Then
      Begin
        writeln('Could not find chicken');
        Exit;
      End;
    End;

    Function FindLoot:Boolean;
    Var x,y:Integer;
    Begin

      If Not LoggedIn Then Exit;
      If IsMoving Then Exit;
        SetColorToleranceSpeed(2);
        SetColorspeed2Modifiers(0.10,0.89);
        If IsMoving Then
          Mywait(RandomRange(1000,2000));
        If FindColorSpiralTolerance(x,y,10921922,MSX1,MSY1,MSX2,MSY2,6) Then
        Begin
          MMouse(x,y,3,3);
          If WaitUptext('ake',RandomRange(250,650)) Then
          Begin
            GetMousePos(X,Y);
            Mouse(x,y,0,0,False);
            If ChooseOption('eathe') Then
              writeln('Found feathers');
              MyWait(RandomRange(400,950));
          End;
        End Else writeln('Not found colour, this is normaly as im loop it at least 4 times to check we have everything :)');
    End;

    Procedure MainLoop;
    Var I,Time:Integer;
    Begin
    Repeat
      Time := 0
      MarkTime(Time);
      LogInPlayer;
        Repeat
          If FindChicken Then
          Begin
            I := 0
            MyWait(RandomRange(750,2200));
            While srl_InFight Do
            MyWait(Random(250));
            FindLoot;
          End Else Inc(I);
        Until((I > 50) Or Not LoggedIn Or (TimeFromMark > CurrentPlayer.Integer[0]))
        If I > 50 Then
        Begin
          writeln('Could not find monsters : Player now inactive');
          If LoggedIn Then
            Logout;
          NextPlayer(False);
        End;
        If Not LoggedIn Then
        Begin
          writeln('Not Logged in : Player now inactive');
          NextPlayer(False);
        End;
        If (TimeFromMark > CurrentPlayer.Integer[0]) Then
        Begin
          If Not HowManyPlayers = 1 Then
          Begin
            writeln('Only one player breaking for time you set');
            Logout;
            NextPlayer(True);
            Wait(CurrentPlayer.Integer[1]);
          End Else Begin
            writeln('More then one player moving onto next player');
            Logout;
            NextPlayer(True);
          End;
    Until(AllPlayersInactive);
    End;

    begin
    SetupSRL;
    end.

    Thanks
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  2. #2
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Line 144, TimeFromMark has a parameter.

  3. #3
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    Until (I > 50) or (Not LoggedIn) or (TimeFromMark(Time) > Players[CurrentPlayer].Integers[0])
    You have to set what Mark to check the time from.
    Also, I think you have to do:
    Simba Code:
    Players[CurrentPlayer].Integers[0]
    instead of the way you did.

    Ninja'd -.-

    -Boom

  4. #4
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, thanks. How could i miss that

    Thanks again

    Edit:
    Also
    Identifier expected at line 170
    Which is
    Until(AllPlayersInactive)

    Thanks again
    Last edited by Troll; 12-24-2010 at 07:24 PM.
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  5. #5
    Join Date
    Dec 2010
    Posts
    808
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    program new;
    //{$DEFINE SMART}
    {$i srl\srl.scar}
    //{$i reflection\reflection.simba}

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;//Change this accordingly
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      With Players[0] do
      begin
        Name :=''; //Name
        Pass :=''; //Pass
        Active := True; //True if you want this player to be used
        Integers[0] := 0;//Time To run before breaking
      end;

      {
      With Players[1] do  //copy and change number accordingly to add players
      begin
        Name :='';
        Pass :='';
        Active:=True;
        Booleans[0] := false;//Are you ranging?
        Integers[0] := 0;//1st color of monster
        Integers[1] := 0;//2nd color of monster
        Integers[2] := 0;//3rd color of monster
        Strings[0] := '';//monster name
      end;
      }

    end;

    Procedure MyWait(TimeToWait:Integer);
    Var Time:Integer;
    Begin
    MarkTime(Time);
    FindNormalRandoms;
      Repeat
        Case Random(5000) Of
          1: RandomRClick;
          2: HoverSkill('attack',False);
          3: HoverSkill('defence',False);
          4: HoverSkill('strength',False);
          5: HoverSkill('hitpoints',False);
          6: PickUpMouse;
          7: RandomMovement;
          8: BoredHuman;
          9: LevelUp;
        End;
      Until(TimeFromMark(Time)>=TimeToWait)
    End;

    Function FindChicken:Boolean;
    Var x,y,i,tol:Integer;
    Begin
      I := 0
      tol := 41
      If Not LoggedIn Then Exit;
      If srl_InFight Then Exit;
      Repeat
        If FindColorSpiralTolerance(x,y,3655910,MSX1,MSY1,MSX2,MSY2,41) Then
        Begin
          MMouse(x,y,2,2);
          MyWait(Random(50));
          writeln('Moving Mouse');
          If IsUpText('ick') Then
          Begin
            GetMousePos(x,y);
            writeln('Getting mouse pos');
            MyWait(Random(100));
            If Random(20) = 1 Then
            Begin
              MyWait(Random(10));
              Mouse(x,y,0,0,True);
              writeln('Clicking');
              Result := True;
              Break;
            End Else Begin
              Mouse(x,y,0,0,False);
              ChooseOption('ttac');
              writeln('Right clicking');
              Result := True;
              Break;
             End;
          End Else Begin
            writeln('Couldnt not find uptext');
            Inc(I);
          End;
        End Else Begin
          writeln('Did not find colour');
          Inc(I);
          Inc(Tol);
        End;
      Until(I>20)
      If I > 20 Then
      Begin
        writeln('Could not find chicken');
        Exit;
      End;
    End;

    Function FindLoot:Boolean;
    Var x,y:Integer;
    Begin

      If Not LoggedIn Then Exit;
      If IsMoving Then Exit;
        SetColorToleranceSpeed(2);
        SetColorspeed2Modifiers(0.10,0.89);
        If IsMoving Then
          Mywait(RandomRange(1000,2000));
        If FindColorSpiralTolerance(x,y,10921922,MSX1,MSY1,MSX2,MSY2,6) Then
        Begin
          MMouse(x,y,3,3);
          If WaitUptext('ake',RandomRange(250,650)) Then
          Begin
            GetMousePos(X,Y);
            Mouse(x,y,0,0,False);
            If ChooseOption('eathe') Then
              writeln('Found feathers');
              MyWait(RandomRange(400,950));
          End;
        End Else writeln('Not found colour, this is normaly as im loop it at least 4 times to check we have everything :)');
    End;

    Procedure MainLoop;
    Var I,Time:Integer;
    Begin
    Repeat
      Time := 0
      MarkTime(Time);
      LogInPlayer;
        Repeat
          If FindChicken Then
          Begin
            I := 0
            MyWait(RandomRange(750,2200));
            While srl_InFight Do
            MyWait(Random(250));
            FindLoot;
          End Else Inc(I);
        Until (I > 50) or (Not LoggedIn) or (TimeFromMark(Time) > Players[CurrentPlayer].Integers[0])
        If I > 50 Then
        Begin
          writeln('Could not find monsters : Player now inactive');
          If LoggedIn Then
            Logout;
          NextPlayer(False);
        End;
        If Not LoggedIn Then
        Begin
          writeln('Not Logged in : Player now inactive');
          NextPlayer(False);
        End;
        If (TimeFromMark(Time) > Players[CurrentPlayer].Integers[0]) Then
        Begin
          If Not HowManyPlayers = 1 Then
          Begin
            writeln('Only one player breaking for time you set');
            Logout;
            NextPlayer(True);
            Wait(Players[CurrentPlayer].Integers[1]);
          End Else
          Begin
            writeln('More then one player moving onto next player');
            Logout;
            NextPlayer(True);
          End;
          End;
    Until(AllPlayersInactive);
    End;

    begin
    SetupSRL;
    end.
    You needed an extra end
    ^ That compiles successfully

    -Boom

  6. #6
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    before you submit this script you should learn about Standards. You can check them out here.

    http://villavu.com/forum/showthread.php?t=60288

    A lot of people would appreciate it and give you more feedback.
    Still learning to code in Simba.

  7. #7
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks Dynamite your the best and ill try to keep that in mind thanks death

    Dang, i feel like a idiot with all these errors but when i run what Dynamite posted i get this in Login.scar or is it .simba
    Code:
    [Hint] C:\Simba\Includes\SRL/SRL/core/gametab.scar(1514:3): Variable 'P' never used at line 1513
    [Hint] (105:10): Variable 'Result' never used at line 104
    Compiled succesfully in 889 ms.
    SRL Compiled in 0 msec
    1
    2
    4
    Error: Out Of Range at line 395
    The following DTMs were not freed: [SRL - Lamp bitmap]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap]
    File[C:\Simba\Includes\SRL/logs/SRL log 24-12-10 0.txt] has not been freed in the script, freeing it now.
    Thanks for all your help

    ~The idiot
    Last edited by Troll; 12-24-2010 at 08:01 PM.
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  8. #8
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    The hints don't matter. As for the out of range, maybe you didn't have user/pass filled in? Or you don't have Active set to true.

  9. #9
    Join Date
    Sep 2008
    Location
    My House
    Posts
    519
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats weird it ran for me.
    Still learning to code in Simba.

  10. #10
    Join Date
    Aug 2007
    Location
    in a random little world
    Posts
    5,778
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

  11. #11
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It compiles, but it you call the main loop you get the error

    Also thanks Shuttleu
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

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
  •