Results 1 to 7 of 7

Thread: Help with my script

  1. #1
    Join Date
    Dec 2011
    Posts
    91
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Smile Help with my script

    I am trying to make a very simple chicken killer but I am getting this line

    Simba Code:
    [Hint] (82:10): Variable 'Result' never used at line 81
    [Error] (119:1): 'BEGIN' expected at line 118
    Compiling failed.

    Here is the script itself.

    Simba Code:
    program ChickenKiller;
    {.include/SRL/SRL.simba}
    {.include SRL/SRL/Misc/SMART.simba}
    {.include SRL\SRL.simba}
    {.Include SRL\SRL\Misc\Debug.simba}

    const
      SmartWorld = 15;              // Which World/Server do you want to use?
      SmartMembers = True;     //  Are you a Member?
      SmartSigned = True;         //  Signed/UnSigned Client?
      SmartSuperDetail = False;    //  Use Super Detail?
      Version           = '1.0';
      NumbOfPlayers     = 1;
      StartPlayer       = 0;

        procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Username
      Players[0].Pass := ''; //Password
      Players[0].Active := True;
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
    end;
    Procedure Antiban; //Antiban, Credits to YoHo
    Begin
      Case Random(192) Of
        0: HoverSkill('Woodcutting', False);  //skill
        1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
        2: ExamineInv;
        3: RandomAngle(1);
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
        5: HoverSkill('random', False);
      End;
    End;

    Function ChickenColor: Integer;   //Credits to ACA
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 1.07);

      FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find chicken.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));

            Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    Function KillChicken: Boolean;
    var
    x, y: Integer;
    begin;
    x:= MSCX;
      y:= MSCY;
      If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack'])  Then
      Begin
       Case Random(2) Of
        0: Mouse(x, y, 5, 5, True);
        1: Begin
            Mouse(x, y, 5, 5, False);
            Wait(100+Random(100));
            WaitOption('attack', 500);
             End;
    end;

    Flag;


    begin
      DeclarePlayers;
      Smart_Server := SmartWorld;
      Smart_Members := SmartMembers;
      Smart_Signed := SmartSigned;
      Smart_SuperDetail := SmartSuperDetail;
      SetupSRL;
      If not (LoggedIn) then
    LoginPlayer;
    ChickenColor;

    Repeat
      KillChicken;
        Until (False);
        end;
        end;
    end;

    Any help and or constructive criticism is appreciated.

    Okay, I got it working. Now, what is a better way to find a chicken? I'm using aca and I couldn't find a great color so it's kinda clicking all over the place
    Last edited by Supertrent1; 02-12-2012 at 09:58 PM.
    Hi I'm new and just starting to script. Check out my first Simba script ever here:
    http://villavu.com/forum/showthread.php?t=73533
    If I helped you:
    http://i.picasion.com/pic49/4d86097a...49046f1fb2.gif

  2. #2
    Join Date
    Feb 2008
    Posts
    19
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    looks like you are missing a few ends in some places heres what it should look like -->
    Code:
     program ChickenKiller;
    {.include/SRL/SRL.simba}
    {.include SRL/SRL/Misc/SMART.simba}
    {.include SRL\SRL.simba}
    {.Include SRL\SRL\Misc\Debug.simba}
    
    const
      SmartWorld = 15;              // Which World/Server do you want to use?
      SmartMembers = True;     //  Are you a Member?
      SmartSigned = True;         //  Signed/UnSigned Client?
      SmartSuperDetail = False;    //  Use Super Detail?
      Version           = '1.0';
      NumbOfPlayers     = 1;
      StartPlayer       = 0;
    
        procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Username
      Players[0].Pass := ''; //Password
      Players[0].Active := True;
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
    end;
    Procedure Antiban; //Antiban, Credits to YoHo
    Begin
      Case Random(192) Of
        0: HoverSkill('Woodcutting', False);  //skill
        1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
        2: ExamineInv;
        3: RandomAngle(1);
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
        5: HoverSkill('random', False);
      End;
    End;
    
    Function ChickenColor: Integer;   //Credits to ACA
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 1.07);
    
      FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find chicken.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
    
            Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    Function KillChicken: Boolean;
    var
    x, y: Integer;
    begin;
    x:= MSCX;
      y:= MSCY;
      If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack'])  Then
      Begin
       Case Random(2) Of
        0: Mouse(x, y, 5, 5, True);
        1: Begin
            Mouse(x, y, 5, 5, False);
            Wait(100+Random(100));
            WaitOption('attack', 500);
            End;
       end;
      end;
    end;
    
    // this needs to be placed in  a wrapper some where  ... Flag;
    
    procedure MainLoop;
    begin
     KillChicken;
    end;
    begin
      DeclarePlayers;
      Smart_Server := SmartWorld;
      Smart_Members := SmartMembers;
      Smart_Signed := SmartSigned;
      Smart_SuperDetail := SmartSuperDetail;
      SetupSRL;
      If not (LoggedIn) then
      LoginPlayer;
      ChickenColor;
      repeat
        MainLoop;
      until False;
    end.
    Last edited by shadowrecon; 02-12-2012 at 09:49 PM.

  3. #3
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    Code:
    program ChickenKiller;
    {.include/SRL/SRL.simba}
    {.include SRL/SRL/Misc/SMART.simba}
    {.include SRL\SRL.simba}
    {.Include SRL\SRL\Misc\Debug.simba}
    
    const
      SmartWorld = 15;              // Which World/Server do you want to use?
      SmartMembers = True;     //  Are you a Member?
      SmartSigned = True;         //  Signed/UnSigned Client?
      SmartSuperDetail = False;    //  Use Super Detail?
      Version           = '1.0';
      NumbOfPlayers     = 1;
      StartPlayer       = 0;
    
        procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Username
      Players[0].Pass := ''; //Password
      Players[0].Active := True;
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
    end;
    Procedure Antiban; //Antiban, Credits to YoHo
    Begin
      Case Random(192) Of
        0: HoverSkill('Woodcutting', False);  //skill
        1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
        2: ExamineInv;
        3: RandomAngle(1);
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
        5: HoverSkill('random', False);
      End;
    End;
    
    Function ChickenColor: Integer;   //Credits to ACA
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 1.07);
    
      FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find chicken.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
    
            Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    Function KillChicken: Boolean;
    var
    x, y: Integer;
    begin;
    x:= MSCX;
      y:= MSCY;
      If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack'])  Then
      Begin
       Case Random(2) Of
        0: Mouse(x, y, 5, 5, True);
        1: Begin
            Mouse(x, y, 5, 5, False);
            Wait(100+Random(100));
            WaitOption('attack', 500);
             End;
       end;
      end
    end;
    
    
    
    
    begin
      DeclarePlayers;
      Smart_Server := SmartWorld;
      Smart_Members := SmartMembers;
      Smart_Signed := SmartSigned;
      Smart_SuperDetail := SmartSuperDetail;
      SetupSRL;
      If not (LoggedIn) then
        LoginPlayer;
      ChickenColor;
    
      Repeat
        KillChicken;
      Until (False);
    
    end.
    it was more than just one end. u put ends in wierd places and such. fixed it though.

  4. #4
    Join Date
    Feb 2006
    Posts
    3,044
    Mentioned
    4 Post(s)
    Quoted
    21 Post(s)

    Default

    Simba Code:
    program ChickenKiller;
    {.include/SRL/SRL.simba}
    {.include SRL/SRL/Misc/SMART.simba}
    {.include SRL\SRL.simba}
    {.Include SRL\SRL\Misc\Debug.simba}

    const
      SmartWorld = 15;              // Which World/Server do you want to use?
      SmartMembers = True;     //  Are you a Member?
      SmartSigned = True;         //  Signed/UnSigned Client?
      SmartSuperDetail = False;    //  Use Super Detail?
      Version           = '1.0';
      NumbOfPlayers     = 1;
      StartPlayer       = 0;

        procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Username
      Players[0].Pass := ''; //Password
      Players[0].Active := True;
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
    end;

    Procedure Antiban; //Antiban, Credits to YoHo
    Begin
      Case Random(192) Of
        0: HoverSkill('Woodcutting', False);  //skill
        1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
        2: ExamineInv;
        3: RandomAngle(1);
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
        5: HoverSkill('random', False);
      End;
    End;

    Function ChickenColor: Integer;   //Credits to ACA
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 1.07);

      FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find chicken.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));

            Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    Function KillChicken: Boolean;
    var
    x, y: Integer;
    begin;
    x:= MSCX;
      y:= MSCY;
      If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack'])  Then
      Begin
       Case Random(2) Of
        0: Mouse(x, y, 5, 5, True);
        1: Begin
            Mouse(x, y, 5, 5, False);
            Wait(100+Random(100));
            WaitOption('attack', 500);
             End;
    end;

    Flag;
        end;
        end;


    begin
      DeclarePlayers;
      Smart_Server := SmartWorld;
      Smart_Members := SmartMembers;
      Smart_Signed := SmartSigned;
      Smart_SuperDetail := SmartSuperDetail;
      SetupSRL;
      If not (LoggedIn) then
    LoginPlayer;
    ChickenColor;

    Repeat
      KillChicken;
        Until (False);
    end.


    It was a kinda mess :P Keep mainloop simple. Keep functions Seperated from each others, (and procedures ofc)

    Compare that and your old version to see differences. I'm little bit tired currently...

    ~Home

  5. #5
    Join Date
    Dec 2011
    Posts
    91
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by x[Warrior]x3500 View Post
    Code:
    program ChickenKiller;
    {.include/SRL/SRL.simba}
    {.include SRL/SRL/Misc/SMART.simba}
    {.include SRL\SRL.simba}
    {.Include SRL\SRL\Misc\Debug.simba}
    
    const
      SmartWorld = 15;              // Which World/Server do you want to use?
      SmartMembers = True;     //  Are you a Member?
      SmartSigned = True;         //  Signed/UnSigned Client?
      SmartSuperDetail = False;    //  Use Super Detail?
      Version           = '1.0';
      NumbOfPlayers     = 1;
      StartPlayer       = 0;
    
        procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Username
      Players[0].Pass := ''; //Password
      Players[0].Active := True;
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
    end;
    Procedure Antiban; //Antiban, Credits to YoHo
    Begin
      Case Random(192) Of
        0: HoverSkill('Woodcutting', False);  //skill
        1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
        2: ExamineInv;
        3: RandomAngle(1);
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
        5: HoverSkill('random', False);
      End;
    End;
    
    Function ChickenColor: Integer;   //Credits to ACA
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.10, 1.07);
    
      FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find chicken.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    
      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);
    
      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);
    
        if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
    
            Break;
        end;
      end;
    
      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);
    
      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;
    Function KillChicken: Boolean;
    var
    x, y: Integer;
    begin;
    x:= MSCX;
      y:= MSCY;
      If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack'])  Then
      Begin
       Case Random(2) Of
        0: Mouse(x, y, 5, 5, True);
        1: Begin
            Mouse(x, y, 5, 5, False);
            Wait(100+Random(100));
            WaitOption('attack', 500);
             End;
       end;
      end
    end;
    
    
    
    
    begin
      DeclarePlayers;
      Smart_Server := SmartWorld;
      Smart_Members := SmartMembers;
      Smart_Signed := SmartSigned;
      Smart_SuperDetail := SmartSuperDetail;
      SetupSRL;
      If not (LoggedIn) then
        LoginPlayer;
      ChickenColor;
    
      Repeat
        KillChicken;
      Until (False);
    
    end.
    it was more than just one end. u put ends in wierd places and such. fixed it though.
    Thanks for the help and quick reply's. You too shadow. Both +rep'd.
    Hi I'm new and just starting to script. Check out my first Simba script ever here:
    http://villavu.com/forum/showthread.php?t=73533
    If I helped you:
    http://i.picasion.com/pic49/4d86097a...49046f1fb2.gif

  6. #6
    Join Date
    Dec 2011
    Posts
    91
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Bump! Need help with finding the chicken instead of everything.
    Hi I'm new and just starting to script. Check out my first Simba script ever here:
    http://villavu.com/forum/showthread.php?t=73533
    If I helped you:
    http://i.picasion.com/pic49/4d86097a...49046f1fb2.gif

  7. #7
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    well that could be a few things:

    1. why do u use a tolerance if you are autocoloring the chicken ( If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then ) why a tolerance of 3? the color is already found.

    2. check to see if your autocolor is too broad. maybe u should select fewer colors that are more unique to chickens.

    3. learn to create your own ATPAs instead of using FindObjTPA.

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
  •