Results 1 to 21 of 21

Thread: First script. Reflection ftw. Don't hate :)

  1. #1
    Join Date
    Aug 2007
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default First script. Reflection ftw. Don't hate :)

    Well here is my first script.

    I was surprised at how long it took me to make this. Actually writing the script did not take very long at all, but doing all the research and learning beforehand was a lot harder than I expected.

    This is not the first script I have written to macro RS. A month or so ago I wrote a few scripts for a java bot called Optimusbot. The bot has since died and that is why I am back here trying to learn to script this stuff . But man, java is sure easier than this pascal stuff. At least for writing scripts like this

    Anyways, here is my first script. Its small enough to post in the thread but I will also attach it because that seems to be the preferred way around here

    What its called: KIW Thief
    What it does: pickpocket NPCs
    I did take a few code snippets from other scripts, but they are all given credit and slightly modified.

    v2:
    SCAR Code:
    program KIWthief;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/reflection/reflection.scar}

    {**********************************************************************
     __  __   ______   __      __      ______  __                     ___  
    /\ \/\ \ /\__  _\ /\ \  __/\ \    /\__  _\/\ \      __          /'___\
    \ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \   \/_/\ \/\ \ \___ /\_\     __ /\ \__/
     \ \ , <    \ \ \  \ \ \ \ \ \ \     \ \ \ \ \  _ `\/\ \  /'__`\ \ ,__\
      \ \ \\`\   \_\ \__\ \ \_/ \_\ \     \ \ \ \ \ \ \ \ \ \/\  __/\ \ \_/
       \ \_\ \_\ /\_____\\ `\___x___/      \ \_\ \ \_\ \_\ \_\ \____\\ \_\
        \/_/\/_/ \/_____/ '\/__//__/        \/_/  \/_/\/_/\/_/\/____/ \/_/
       By Kyleisntwild                                                 v2.0

    Thanks to:
       Seroko for all his help!
       ZaSz for his awesome reflection tut.
       Vilon for proof reading and various fixes.
       Lancerawks aka Lance for his YakPwner script.
       Runescapian and The Cnr Sport for their Ess Mining script.
       Method for helping me with using reflection for experience tracking.

       Only for use at : [url]http://www.villavu.com[/url]

    ************************************************************************}


    var
    Attempt, Fail, xp, exp: Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      CurrentPlayer := 0;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Players[0].Strings[0] := 'uard';  // NPC to pickpocket
      Players[0].Integers[0] := 30;  // Amount of Health to eat at  
      // Food Options : cakes, salmon, lobster, swordfish, monkfish, shark
    end;


    {******** Setup SMART ********}
    procedure SetupSMART;
    begin
      Smart_Members := true;
      Smart_Signed := true;
      Smart_Server := 100;
      Smart_SuperDetail := false;
     end;

    {******** Find Randoms ********}
    procedure FindRandoms;
    begin
      FindNormalRandoms;
      R_FindRandoms;
    end;

    {******** No Ban Hamma! ********}
    procedure AntiBan;
    begin
      if (not (LoggedIn)) then
        Exit;
      case Random(60) of
        0: RandomRClick;
        1: GameTab(1 + Random(12));
        2: PickUpMouse;
        3: RandomMovement;
        4: BoredHuman;
      end;
    end;

    {******** Disguise Title ********}
    //Thanks to Seroko!
    procedure UpdateDisguise;
    begin
      Disguise(Players[CurrentPlayer].name + ' has had a ' + IntToStr(Round(fail/attempt*100)) + '% fail rate and has gained ' + IntToStr(GetMySkill(17, false) - xp) + ' exp!');
    end;

    {******** Proggy ********}
    // Thanks to Runescapian and The Cnr Sport
    procedure Report;
    begin
      exp := GetMySkill(17, false) - xp;
      ClearReport;
      SRLRandomsReport;
      addtoreport('===========================================');
      addtoreport('|                KIW Thief                |');
      addtoreport('===========================================');
      addtoreport('|' + padr('Run Time: '+timerunning+'',35) +'|');
      Addtoreport('|' + padr('Pickpocket Attempts: '+inttostr(Attempt)+'' , 35)+'|');
      Addtoreport('|' + padr('Pickpocket Fails: '+inttostr(Fail)+'' , 35)+'|');
      Addtoreport('|' + padr('EXP Gained: '+inttostr(exp)+'' , 35)+'|');
      addtoreport('===========================================');
      addtoreport('|             By KyleIsntWild             |');
      addtoreport('===========================================');
      Changereportwidth(400);
      UpdateDisguise;
    end;

    {******** End Script ********}
    // Thanks to Lance
    procedure Terminate(Reason : String);
    begin
      writeln('Ending script. Reason:' + Reason);
      Report;
      Logout;
      TerminateScript;
    end;
     
    {******** Check HP and Eat ********}
    // Thanks to Seroko
    procedure CheckHP;
    var
     HP: integer;
     FoodIDs, ISlots : TIntegerArray ;
    begin
      HP := SmartGetFieldArrayInt(0, CurrentLevels, 3);
      FoodIDs := [1896, 1894, 1892, 330, 386, 7947, 374, 380]
       if (HP < Players[CurrentPlayer].Integers[0]) and (InventoryContainsMulti(FoodIDs, ISlots)) then
    begin
        MouseItem(ISlots[0],true);
        Writeln('Eating.');
    end else
       if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
        Terminate('Out of food');
    end;

    {******** Find and thieve NPC ********}
    // Thanks to Seroko
    procedure FindnThieveNPC;
    var
      N, P: TNPC;
      T: TPoint;
    begin
      repeat
      FindRandoms;
        case GetAnimation of
          -1: begin
            if FindNPC(Players[0].Strings[0], N) then
            begin
              if not TileOnMS(N.Tile, 0) then
                WalkToTile(N.Tile, 1, 0);
              FindNPC(N.NPCType, P);
              T := TileToMS(P.Tile, 0);
              MMouse(P.MS.x, P.MS.y, 5, 5);
              if IsupText(Copy(Players[0].Strings[0], 2, 3)) then
              begin
                Mouse(P.MS.x, P.MS.y, 0, 0, false);
                R_ChooseOption('pocket');
                Writeln('Found NPC. Pickpocketing...');
                Inc(Attempt);
            repeat
                wait(100+random(100));
            until not CharacterMoving;
                Wait(RandomRange(500,1000));
              end;
            end;
            end;
        881: Wait(RandomRange(500, 2000));
        424: begin
            Writeln('Pickpocketing attempt failed. Stunned.');
            Inc(Fail);
            CheckHP;
            AntiBan;
            Wait(RandomRange(4500, 5000));
          end;
        end;
        Report;
      Until(false);
    end;
     
    begin
     SetupSMART;
     SetupSRL;
     SetupReflection;
     ClearDebug;
     DeclarePlayers;
     if not LoggedIn then LogInPlayer;
     wait(1000);
     xp := GetMySkill(17, false);
     Attempt := 0;
     Fail := 0;
     SetAngle(True);
     FindRandoms;
     SetRun(true);
     FindnThieveNPC;
    end.

    As you can see, mostly reflection. IMO reflection is far superior than color so I will be making all of my scripts with it. If you think its too easy or something, I don't care.

    First run (4 lobbies and 30 thieving on Warrior Women in Ard) :

    ===========================================
    | KIW Thief |
    ===========================================
    |Run Time: 16 Minutes and 29 Seconds|
    |Pickpocket Attempts: 141 |
    |Pickpocket Fails: 42 |
    |EXP Gained: 2002 |
    ===========================================
    | By KyleIsntWild |
    ===========================================

    I also just noticed that I never call the Antiban procedure lol. I'll get that fixed up later.

    Please post comments and criticism

    Thanks
    Last edited by kyleisntwild; 08-11-2009 at 01:47 AM. Reason: v2 fix

  2. #2
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Program KIWthief;
      {.include srl/srl/misc/smart.scar}
      {.include srl/srl.scar}
      {.include srl/srl/reflection/reflection.scar}

    {**********************************************************************
     __  __   ______   __      __      ______  __                     ___
    /\ \/\ \ /\__  _\ /\ \  __/\ \    /\__  _\/\ \      __          /'___\
    \ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \   \/_/\ \/\ \ \___ /\_\     __ /\ \__/
     \ \ , <    \ \ \  \ \ \ \ \ \ \     \ \ \ \ \  _ `\/\ \  /'__`\ \ ,__\
      \ \ \\`\   \_\ \__\ \ \_/ \_\ \     \ \ \ \ \ \ \ \ \ \/\  __/\ \ \_/
       \ \_\ \_\ /\_____\\ `\___x___/      \ \_\ \ \_\ \_\ \_\ \____\\ \_\
        \/_/\/_/ \/_____/ '\/__//__/        \/_/  \/_/\/_/\/_/\/____/ \/_/
       By Kyleisntwild                                                 v1.0

    Thanks to:
       ZaSz for his awesome reflection tut.
       Vilon for proof reading and various fixes.
       Lancerawks aka Lance for his YakPwner script.
       Runescapian and The Cnr Sport for their Ess Mining script.
       Method for helping me with using reflection for experience tracking.

       Only for use at : [url]http://www.villavu.com[/url]

    ************************************************************************}


    Const
     NPC = 'woman'; //NPC name

    Type
     TVariable = Record
      FoodType: String;
     End;

    Var
     Attempt, Fail, xp, Exp: Integer;
     Variable: Array [0..0] Of TVariable;

     {******** Player Setup ********}
    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      CurrentPlayer := 0;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Variable[0].FoodType := 'lobster';
      // Options: lobster, swordfish, monkfish, shark
    End;

    {******** Setup Smart ********}
    Procedure SetupSMART;
    Begin
      Smart_Members := True;
      Smart_Signed := True;
      Smart_Server := 100;
      Smart_SuperDetail := False;
    End;

      {******** Item IDs ********}
      // Thanks to Lance for this
    Function ItemID(i: String; inv: Boolean): Integer;
    Begin
      Case LowerCase(i) Of
       'shark': Result := 385;
       'monkfish': Result := 7946;
       'swordfish': Result := 373;
       'lobster': Result := 379;
      End;
      If inv Then
      Begin
        Result := Result + 1;
      End;
    End;

      {******** Proggy ********}
      // Thanks to Runescapian and The Cnr Sport
    Procedure Report;
    Begin
      Exp := GetMySkill(17, False) - xp;
      ClearReport;
      Changereportwidth(400);
      SRLRandomsReport;
      addtoreport('===========================================');
      addtoreport('|                KIW Thief                |');
      addtoreport('===========================================');
      addtoreport('|' + padr('Run Time: ' + timerunning + '', 35) + '|');
      Addtoreport('|' + padr('Pickpocket Attempts: ' + IntToStr(Attempt) + '',
        35) + '|');
      Addtoreport('|' + padr('Pickpocket Fails: ' + IntToStr(Fail) + '', 35) + '|');
      Addtoreport('|' + padr('EXP Gained: ' + IntToStr(Exp) + '', 35) + '|');
      addtoreport('===========================================');
      addtoreport('|             By KyleIsntWild             |');
      addtoreport('===========================================');
    End;

      {******** End Script ********}
      // Thanks to Lance for this
    Procedure Terminate(Reason: String);
    Begin
      Writeln('Ending script. Reason:' + Reason);
      Report;
      Logout;
      TerminateScript;
    End;

    {******** No Ban Hamma! ********}
    Procedure AntiBan;
    Begin
      If (not (LoggedIn)) Then Exit;
      Case Random(60) Of
       0: RandomRClick;
       1: GameTab(1 + Random(12));
       2: PickUpMouse;
       3: RandomMovement;
       4: BoredHuman;
      End;
    End;

    {******** No Randoms Por Favor ********}
    Procedure FindRandoms;
    Begin
      FindNormalRandoms;
      R_FindRandoms;
    End;

      {******** Check HP and Eat ********}
      // Thanks to Lance for this
    Procedure HPCheck;
     Var
      slot: TIntegerArray;
      B: TBox;
      I: Integer;
    Begin
      If not LoggedIn Then Exit;
      FindRandoms;
      If HpPercent < 50 Then
      Begin
        Writeln('Eating');
        GameTab(5);
        Repeat
          If InventoryContains(ItemID(Variable[CurrentPlayer].FoodType, True), slot) Then
          Begin
            For i := 0 To High(slot) Do
            Begin
              B := InvBox(slot[i]);
              MouseBox(B.x1 + 15, B.y1 + 15, B.x2 - 15, B.y2 - 15, 1);
              Wait(800 + RandomRange(100, 300));
              If HpPercent > 70 Then
              Begin
                Exit;
              End;
            End;
          End Else
          Begin
            Terminate('Out of food');
          End;
        Until (HpPercent > 70)
        End;
    End;

    {******** Find and thieve NPC ********}
    Procedure FindnThieveNPC;
     Var
      N, P: TNPC;
      T: TPoint;
    Begin
      Repeat
        If (GetAnimation = -1) Then // If no animation
        Begin
          If FindNPC(NPC, N) Then
          Begin
            If not TileOnMS(N.Tile, 0) Then WalkToTile(N.Tile, 1, 0);
            FindNPC(N.NPCType, P);
            T := TileToMS(P.Tile, 0);
            Mouse(T.x, T.y, 5, 5, False);
            ChooseOption('pocket');
            Writeln('Found NPC. Pickpocketing...');
            Inc(Attempt);
            wait(2000 + Random(100));
          End;
        End Else If (GetAnimation = 881) Then // If pickpocketing
        Begin
          wait(2000 + Random(100));
          FindRandoms;
        End Else If (GetAnimation = 397) Then // If stunned
        Begin
          Writeln('Pickpocketing attempt failed. Stunned.');
          Inc(Fail);
          HPCheck;
          wait(4000 + Random(2000));
          FindRandoms;
        End;
        Report;
      Until (False);
    End;

    {******** Main Loop ********}
    Begin
      SetupSMART;
      SetupSRL;
      SetupReflection;
      ClearDebug;
      DeclarePlayers;
      If not LoggedIn Then LogInPlayer;
      wait(2000);
      xp := GetMySkill(17, False);
      Attempt := 0;
      Fail := 0;
      SetAngle(True);
      FindRandoms;
      SetRun(True);
      FindnThieveNPC;
    End.

    Altered standards if you require.

    Looking good, as you stated AntiBan isnt called.

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  3. #3
    Join Date
    Aug 2007
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by rogeruk View Post
    SCAR Code:
    Program KIWthief;
      {.include srl/srl/misc/smart.scar}
      {.include srl/srl.scar}
      {.include srl/srl/reflection/reflection.scar}

    {**********************************************************************
     __  __   ______   __      __      ______  __                     ___
    /\ \/\ \ /\__  _\ /\ \  __/\ \    /\__  _\/\ \      __          /'___\
    \ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \   \/_/\ \/\ \ \___ /\_\     __ /\ \__/
     \ \ , <    \ \ \  \ \ \ \ \ \ \     \ \ \ \ \  _ `\/\ \  /'__`\ \ ,__\
      \ \ \\`\   \_\ \__\ \ \_/ \_\ \     \ \ \ \ \ \ \ \ \ \/\  __/\ \ \_/
       \ \_\ \_\ /\_____\\ `\___x___/      \ \_\ \ \_\ \_\ \_\ \____\\ \_\
        \/_/\/_/ \/_____/ '\/__//__/        \/_/  \/_/\/_/\/_/\/____/ \/_/
       By Kyleisntwild                                                 v1.0

    Thanks to:
       ZaSz for his awesome reflection tut.
       Vilon for proof reading and various fixes.
       Lancerawks aka Lance for his YakPwner script.
       Runescapian and The Cnr Sport for their Ess Mining script.
       Method for helping me with using reflection for experience tracking.

       Only for use at : [url]http://www.villavu.com[/url]

    ************************************************************************}


    Const
     NPC = 'woman'; //NPC name

    Type
     TVariable = Record
      FoodType: String;
     End;

    Var
     Attempt, Fail, xp, Exp: Integer;
     Variable: Array [0..0] Of TVariable;

     {******** Player Setup ********}
    Procedure DeclarePlayers;
    Begin
      HowManyPlayers := 1;
      CurrentPlayer := 0;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Variable[0].FoodType := 'lobster';
      // Options: lobster, swordfish, monkfish, shark
    End;

    {******** Setup Smart ********}
    Procedure SetupSMART;
    Begin
      Smart_Members := True;
      Smart_Signed := True;
      Smart_Server := 100;
      Smart_SuperDetail := False;
    End;

      {******** Item IDs ********}
      // Thanks to Lance for this
    Function ItemID(i: String; inv: Boolean): Integer;
    Begin
      Case LowerCase(i) Of
       'shark': Result := 385;
       'monkfish': Result := 7946;
       'swordfish': Result := 373;
       'lobster': Result := 379;
      End;
      If inv Then
      Begin
        Result := Result + 1;
      End;
    End;

      {******** Proggy ********}
      // Thanks to Runescapian and The Cnr Sport
    Procedure Report;
    Begin
      Exp := GetMySkill(17, False) - xp;
      ClearReport;
      Changereportwidth(400);
      SRLRandomsReport;
      addtoreport('===========================================');
      addtoreport('|                KIW Thief                |');
      addtoreport('===========================================');
      addtoreport('|' + padr('Run Time: ' + timerunning + '', 35) + '|');
      Addtoreport('|' + padr('Pickpocket Attempts: ' + IntToStr(Attempt) + '',
        35) + '|');
      Addtoreport('|' + padr('Pickpocket Fails: ' + IntToStr(Fail) + '', 35) + '|');
      Addtoreport('|' + padr('EXP Gained: ' + IntToStr(Exp) + '', 35) + '|');
      addtoreport('===========================================');
      addtoreport('|             By KyleIsntWild             |');
      addtoreport('===========================================');
    End;

      {******** End Script ********}
      // Thanks to Lance for this
    Procedure Terminate(Reason: String);
    Begin
      Writeln('Ending script. Reason:' + Reason);
      Report;
      Logout;
      TerminateScript;
    End;

    {******** No Ban Hamma! ********}
    Procedure AntiBan;
    Begin
      If (not (LoggedIn)) Then Exit;
      Case Random(60) Of
       0: RandomRClick;
       1: GameTab(1 + Random(12));
       2: PickUpMouse;
       3: RandomMovement;
       4: BoredHuman;
      End;
    End;

    {******** No Randoms Por Favor ********}
    Procedure FindRandoms;
    Begin
      FindNormalRandoms;
      R_FindRandoms;
    End;

      {******** Check HP and Eat ********}
      // Thanks to Lance for this
    Procedure HPCheck;
     Var
      slot: TIntegerArray;
      B: TBox;
      I: Integer;
    Begin
      If not LoggedIn Then Exit;
      FindRandoms;
      If HpPercent < 50 Then
      Begin
        Writeln('Eating');
        GameTab(5);
        Repeat
          If InventoryContains(ItemID(Variable[CurrentPlayer].FoodType, True), slot) Then
          Begin
            For i := 0 To High(slot) Do
            Begin
              B := InvBox(slot[i]);
              MouseBox(B.x1 + 15, B.y1 + 15, B.x2 - 15, B.y2 - 15, 1);
              Wait(800 + RandomRange(100, 300));
              If HpPercent > 70 Then
              Begin
                Exit;
              End;
            End;
          End Else
          Begin
            Terminate('Out of food');
          End;
        Until (HpPercent > 70)
        End;
    End;

    {******** Find and thieve NPC ********}
    Procedure FindnThieveNPC;
     Var
      N, P: TNPC;
      T: TPoint;
    Begin
      Repeat
        If (GetAnimation = -1) Then // If no animation
        Begin
          If FindNPC(NPC, N) Then
          Begin
            If not TileOnMS(N.Tile, 0) Then WalkToTile(N.Tile, 1, 0);
            FindNPC(N.NPCType, P);
            T := TileToMS(P.Tile, 0);
            Mouse(T.x, T.y, 5, 5, False);
            ChooseOption('pocket');
            Writeln('Found NPC. Pickpocketing...');
            Inc(Attempt);
            wait(2000 + Random(100));
          End;
        End Else If (GetAnimation = 881) Then // If pickpocketing
        Begin
          wait(2000 + Random(100));
          FindRandoms;
        End Else If (GetAnimation = 397) Then // If stunned
        Begin
          Writeln('Pickpocketing attempt failed. Stunned.');
          Inc(Fail);
          HPCheck;
          wait(4000 + Random(2000));
          FindRandoms;
        End;
        Report;
      Until (False);
    End;

    {******** Main Loop ********}
    Begin
      SetupSMART;
      SetupSRL;
      SetupReflection;
      ClearDebug;
      DeclarePlayers;
      If not LoggedIn Then LogInPlayer;
      wait(2000);
      xp := GetMySkill(17, False);
      Attempt := 0;
      Fail := 0;
      SetAngle(True);
      FindRandoms;
      SetRun(True);
      FindnThieveNPC;
    End.

    Altered standards if you require.

    Looking good, as you stated AntiBan isnt called.
    Cool thanks

    I was thinking of calling the Antiban when the animation is pickpocketing and when its stunned. Would that be too much? Maybe just when stunned... that would make more sense I guess.

  4. #4
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Nice for a first script.

    SCAR Code:
    end else
          begin
            Terminate('Out of food');
          end;

    You don't need the begin..end nest there, unless you have more than one line of code. An if..then statement will do only the first line of code, unless a begin..end nest is used. So, when you only want it to do one line, a begin..end is not needed.

    As for the AntiBan, with a thieving script, to be honest, I don't know how much it is actually needed, considering you're always moving the mouse. I would suggest, for an antiban, have the character eat when they are stunned. I know when I do thieving in RS I always eat a slice of cake or two when I'm stunned.

    Anyway, just a thought.

    I think it's pretty good for a first script, and I think you can do much better.

    Cheers!

  5. #5
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Human-like id prob go with AntiBan during the stun. When im pickpocketing if i success i dont do anything just right click again, if i stun ill check my theiv xp / friends list etc.

    Thats my opinion.

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  6. #6
    Join Date
    Feb 2007
    Posts
    211
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PM'd and helping We'll sort this out
    Current Project: Catching up on what I missed, re-writing some old includes I done in the past.
    Upcoming Project: Open For Suggestions

  7. #7
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now, I know you said that you'd be using reflection, but you should at least attempt to make a color script like this. Color doesn't go outdated as quickly :P.

    Nice as a first script though.

    ~Sandstorm

  8. #8
    Join Date
    Aug 2007
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Now, I know you said that you'd be using reflection, but you should at least attempt to make a color script like this. Color doesn't go outdated as quickly :P.

    Nice as a first script though.

    ~Sandstorm
    Why? I honestly don't see the point. Reflection is way more accurate and precise.

    You say color doesn't get outdated as quickly... which is true I guess. But Jagex is making graphics changes all the time now. And updating reflection is easier for me than updating a bunch of bitmaps and whatnot. The devs are good about updating the hooks too, its not like my script is broken forever once Jagex updates...

    I would much rather use a shorter, more precise script that performs with better accuracy than one that is longer and less accurate just so I can auto for the day or so that the hooks are outdated.

  9. #9
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by kyleisntwild View Post
    Why? I honestly don't see the point. Reflection is way more accurate and precise.

    You say color doesn't get outdated as quickly... which is true I guess. But Jagex is making graphics changes all the time now. And updating reflection is easier for me than updating a bunch of bitmaps and whatnot. The devs are good about updating the hooks too, its not like my script is broken forever once Jagex updates...

    I would much rather use a shorter, more precise script that performs with better accuracy than one that is longer and less accurate just so I can auto for the day or so that the hooks are outdated.
    Wonderfully said. <3

    Rep +

  10. #10
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by kyleisntwild View Post
    Why? I honestly don't see the point. Reflection is way more accurate and precise.

    You say color doesn't get outdated as quickly... which is true I guess. But Jagex is making graphics changes all the time now. And updating reflection is easier for me than updating a bunch of bitmaps and whatnot. The devs are good about updating the hooks too, its not like my script is broken forever once Jagex updates...

    I would much rather use a shorter, more precise script that performs with better accuracy than one that is longer and less accurate just so I can auto for the day or so that the hooks are outdated.
    Oh, I agree with you. Whenever I script for runescape nowadays I use reflection. I'm just saying, I, personally, think it's good to learn color first. That way when you get to something reflection can't handle (not often, but I find it DOES happen every so often), it comes in handy.

    I was in a hurry last post, lol.

    ~Sandstorm

  11. #11
    Join Date
    Aug 2007
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sandstorm View Post
    Oh, I agree with you. Whenever I script for runescape nowadays I use reflection. I'm just saying, I, personally, think it's good to learn color first. That way when you get to something reflection can't handle (not often, but I find it DOES happen every so often), it comes in handy.

    I was in a hurry last post, lol.

    ~Sandstorm
    No worries.

    Quote Originally Posted by Seroko View Post
    PM'd and helping We'll sort this out
    Thank you soo much!
    This guy has helped me basically rewrite the entire script. Everything is working great atm.

    I was going to toss this into the FFA section so others can use it too but I saw NCDS's NatThiever. His looks better than mine, and was recently updated, so I don't think mine is needed

    Anyways, below (and attached) is v2. Seroko guided me step by step on the tricky thieving and eating procedures and I learned a ton. He is awesome

    This script will thieve and NPC you want. Only problem is, it only has stun detection for Warrios and Guards atm lol (every npc has a different stun animation I guess). It eats a few types of food and many more can be added easily.

    v2:
    SCAR Code:
    program KIWthief;
    {.include srl/srl/misc/smart.scar}
    {.include srl/srl.scar}
    {.include srl/srl/reflection/reflection.scar}

    {**********************************************************************
     __  __   ______   __      __      ______  __                     ___  
    /\ \/\ \ /\__  _\ /\ \  __/\ \    /\__  _\/\ \      __          /'___\
    \ \ \/'/'\/_/\ \/ \ \ \/\ \ \ \   \/_/\ \/\ \ \___ /\_\     __ /\ \__/
     \ \ , <    \ \ \  \ \ \ \ \ \ \     \ \ \ \ \  _ `\/\ \  /'__`\ \ ,__\
      \ \ \\`\   \_\ \__\ \ \_/ \_\ \     \ \ \ \ \ \ \ \ \ \/\  __/\ \ \_/
       \ \_\ \_\ /\_____\\ `\___x___/      \ \_\ \ \_\ \_\ \_\ \____\\ \_\
        \/_/\/_/ \/_____/ '\/__//__/        \/_/  \/_/\/_/\/_/\/____/ \/_/
       By Kyleisntwild                                                 v2.0

    Thanks to:
       Seroko for all his help!
       ZaSz for his awesome reflection tut.
       Vilon for proof reading and various fixes.
       Lancerawks aka Lance for his YakPwner script.
       Runescapian and The Cnr Sport for their Ess Mining script.
       Method for helping me with using reflection for experience tracking.

       Only for use at : [url]http://www.villavu.com[/url]

    ************************************************************************}


    var
    Attempt, Fail, xp, exp: Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      CurrentPlayer := 0;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';
      Players[0].Active := True;
      Players[0].Strings[0] := 'uard';  // NPC to pickpocket
      Players[0].Integers[0] := 30;  // Amount of Health to eat at  
      // Food Options : cakes, salmon, lobster, swordfish, monkfish, shark
    end;


    {******** Setup SMART ********}
    procedure SetupSMART;
    begin
      Smart_Members := true;
      Smart_Signed := true;
      Smart_Server := 100;
      Smart_SuperDetail := false;
     end;

    {******** Find Randoms ********}
    procedure FindRandoms;
    begin
      FindNormalRandoms;
      R_FindRandoms;
    end;

    {******** No Ban Hamma! ********}
    procedure AntiBan;
    begin
      if (not (LoggedIn)) then
        Exit;
      case Random(60) of
        0: RandomRClick;
        1: GameTab(1 + Random(12));
        2: PickUpMouse;
        3: RandomMovement;
        4: BoredHuman;
      end;
    end;

    {******** Disguise Title ********}
    //Thanks to Seroko!
    procedure UpdateDisguise;
    begin
      Disguise(Players[CurrentPlayer].name + ' has had a ' + IntToStr(Round(fail/attempt*100)) + '% fail rate and has gained ' + IntToStr(GetMySkill(17, false) - xp) + ' exp!');
    end;

    {******** Proggy ********}
    // Thanks to Runescapian and The Cnr Sport
    procedure Report;
    begin
      exp := GetMySkill(17, false) - xp;
      ClearReport;
      Changereportwidth(400);
      SRLRandomsReport;
      addtoreport('===========================================');
      addtoreport('|                KIW Thief                |');
      addtoreport('===========================================');
      addtoreport('|' + padr('Run Time: '+timerunning+'',35) +'|');
      Addtoreport('|' + padr('Pickpocket Attempts: '+inttostr(Attempt)+'' , 35)+'|');
      Addtoreport('|' + padr('Pickpocket Fails: '+inttostr(Fail)+'' , 35)+'|');
      Addtoreport('|' + padr('EXP Gained: '+inttostr(exp)+'' , 35)+'|');
      addtoreport('===========================================');
      addtoreport('|             By KyleIsntWild             |');
      addtoreport('===========================================');
      UpdateDisguise;
    end;

    {******** End Script ********}
    // Thanks to Lance
    procedure Terminate(Reason : String);
    begin
      writeln('Ending script. Reason:' + Reason);
      Report;
      Logout;
      TerminateScript;
    end;
     
    {******** Check HP and Eat ********}
    // Thanks to Seroko
    procedure CheckHP;
    var
     HP: integer;
     FoodIDs, ISlots : TIntegerArray ;
    begin
      HP := SmartGetFieldArrayInt(0, CurrentLevels, 3);
      FoodIDs := [1896, 1894, 1892, 330, 386, 7947, 374, 380]
       if (HP < Players[CurrentPlayer].Integers[0]) and (InventoryContainsMulti(FoodIDs, ISlots)) then
        MouseItem(ISlots[0],true)
        Writeln('Eating.');
    else
       if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
        Terminate('Out of food');
    end;

    {******** Find and thieve NPC ********}
    // Thanks to Seroko
    procedure FindnThieveNPC;
    var
      N, P: TNPC;
      T: TPoint;
    begin
      repeat
      FindRandoms;
        case GetAnimation of
          -1: begin
            if FindNPC(Players[0].Strings[0], N) then
            begin
              if not TileOnMS(N.Tile, 0) then
                WalkToTile(N.Tile, 1, 0);
              FindNPC(N.NPCType, P);
              T := TileToMS(P.Tile, 0);
              MMouse(P.MS.x, P.MS.y, 5, 5);
              if IsupText(Copy(Players[0].Strings[0], 2, 3)) then
              begin
                Mouse(P.MS.x, P.MS.y, 0, 0, false);
                R_ChooseOption('pocket');
                Writeln('Found NPC. Pickpocketing...');
                Inc(Attempt);
            repeat
                wait(100+random(100));
            until not CharacterMoving;
                Wait(RandomRange(500,1000));
              end;
            end;
            end;
        881: Wait(RandomRange(500, 2000));
        397, 424: begin
            Writeln('Pickpocketing attempt failed. Stunned.');
            Inc(Fail);
            CheckHP;
            AntiBan;
            Wait(RandomRange(4500, 5000));
          end;
        end;
        Report;
      Until(false);
    end;
     
    begin
     SetupSMART;
     SetupSRL;
     SetupReflection;
     ClearDebug;
     DeclarePlayers;
     if not LoggedIn then LogInPlayer;
     wait(1000);
     xp := GetMySkill(17, false);
     Attempt := 0;
     Fail := 0;
     SetAngle(True);
     FindRandoms;
     SetRun(true);
     FindnThieveNPC;
    end.


    My proggy:
    Code:
    ===========================================
    |                KIW Thief                |
    ===========================================
    |Run Time: 24 Minutes and 28 Seconds|
    |Pickpocket Attempts: 269           |
    |Pickpocket Fails: 49               |
    |EXP Gained: 3588                   |
    ===========================================
    |             By KyleIsntWild             |
    ===========================================
    Seroko's prog (beat me by 10 mins lol):
    Code:
    |Run Time: 34 Minutes and 42 Seconds|
    |Pickpocket Attempts: 444           |
    |Pickpocket Fails: 136              |
    |EXP Gained: 8471
    We both white screened lol.

    So should run great for Warriors and Guards, if you want to use it for a different NPC, just gotta find the stun animation id and toss it in the thieving procedure

    Added it to first post too. Post any comments or criticisms

  12. #12
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks nice! If you want any more help, feel free to add my MSN.

    Hey321@runescapology.net

    ~Sandstorm

  13. #13
    Join Date
    Nov 2008
    Location
    Arizona
    Posts
    236
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah dude script looks great. I rep you for your reflection statements as I highly agree with you. The only reason i learned color was to start reflection and so i can eventually get SRL Members status. But yeah keep up the good work
    I'm Back.

  14. #14
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice first script, but i prefer color scripts.
    Btw, I found one bug xD
    SCAR Code:
    if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
        Terminate('Out of food');

    it will stay logged in after all food is eaten so it'll looks suspicious
    :P

  15. #15
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by Iroki View Post
    Nice first script, but i prefer color scripts.
    Btw, I found one bug xD
    SCAR Code:
    if (HP < Players[CurrentPlayer].Integers[0]) and not (InventoryContainsMulti(FoodIDs, ISlots)) then
        Terminate('Out of food');

    it will stay logged in after all food is eaten so it'll looks suspicious
    I'm going to guess you just looked at the name of the function instead of the function itself. The code quite clearly logs out the player.

    SCAR Code:
    procedure Terminate(Reason : String);
    begin
      writeln('Ending script. Reason:' + Reason);
      Report;
      Logout;
      TerminateScript;
    end;
    :-)

  16. #16
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Looks, nice and i totally agree with ur comments. , n i guess coming from a java based bot, reflection would be easier than color, i assume?

  17. #17
    Join Date
    Jul 2008
    Location
    Poland
    Posts
    375
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Method View Post
    I'm going to guess you just looked at the name of the function instead of the function itself. The code quite clearly logs out the player.

    SCAR Code:
    procedure Terminate(Reason : String);
    begin
      writeln('Ending script. Reason:' + Reason);
      Report;
      Logout;
      TerminateScript;
    end;
    Yeah, you're right. The name "Terminate" is similar to "TerminateScript", its similar for me :P, and thats why i posted that "I have found a bug".
    :P

  18. #18
    Join Date
    Aug 2009
    Posts
    4
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice script i would use but im not mem no more =\

  19. #19
    Join Date
    Oct 2007
    Location
    http://ushort.us/oqmd65
    Posts
    2,605
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Im glad my ref tut could help

    <3
    I do visit every 2-6 months

  20. #20
    Join Date
    Aug 2007
    Posts
    152
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by ZaSz View Post
    Im glad my ref tut could help

    <3
    Yes ty for your guide Was very helpful.

    I fixed the one tiny error in the first post. I was missing a begin and end thing. I am pretty sure you get an animation of 424 when your stunned by any mob when your not wielding a weapon. So now the script should be compatible with ANY thievable monster as long as you dont equip a weapon.

    Used it yesterday and got to 45 thieving, planning on getting 53 today then the script will be useless to me haha

  21. #21
    Join Date
    Aug 2009
    Location
    Manchester.
    Posts
    10
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    this worked great. forgot proggy will post later.

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
  •