Results 1 to 13 of 13

Thread: Help on script, How to?

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

    Default Help on script, How to?

    How would i make a new checking thing such as mouse speed on the top, an option for people?

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Simba Code:
    Const
     Speed       = 30;       //How fast to move mouse. (I THINK lower is faster?)

    Then after your SetupSRL; line put
    Simba Code:
    MouseSpeed:=Speed;

  3. #3
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Okay that kinda helped, Now im adding a factor of an option kind of for to choose like mining ore, copper or iron.

    I have the thing at the top setup correct, i get no errors when i start. But after looking at the inventory it just sits there and doesnt look for colors!

  4. #4
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by laakerules View Post
    Okay that kinda helped, Now im adding a factor of an option kind of for to choose like mining ore, copper or iron.

    I have the thing at the top setup correct, i get no errors when i start. But after looking at the inventory it just sits there and doesnt look for colors!
    If you could post your script in [.simba] [/simba] tags I'd be glad to help.

  5. #5
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Simba Code:
    program CaffinatedKiller;

    {$DEFINE SMART}
    {$i SRL\SRL.scar}
    {$i SRL/SRL/skill/fighting.scar}


    ///////////////////////////////////
    //start setup
    ///////////////////////////////////

    const

    //change to the smart world you want. Having the same world in all your scripts allows you to change scripts without smart restarting.
      SWorld = 35;

    //Speed of your mouse, higher is faster.
      MSpeed = 9; //9-13 are recommended, you can go higher/lower if you want

    //Put Gaurd, Yak, Hill Giant, Moss Giant, or Cow
      AttackOption = 'Gaurd';

    //This is the antiban chance.. the higher the number, the less likely it will do an antiban
      RandAmount = 20; //15-40 are recommended, you can go higher/lower if you want


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

      With Players[0] Do
      Begin
        Name        := '';  //Player username.
        Pass        := '';  //Player password.
        Nick        := '';  //Player nickname - 3-4 letters of Player username.
        Active      := True;
      End;

    End;
    ///////////////////////////////////
    //end setup
    ///////////////////////////////////


    procedure SetupChar;

    begin

    SetAngle(True);
    MakeCompass('N');
    Retaliate(True);
    end;


    procedure MSI_RandomFKey;
    var
      i, randInt, randKey, currTab: Integer;
      keys: array[0..4] of Word;
    begin
      currTab := GetCurrentTab(); // Get the current tab player is on

      keys[0] := VK_F1;
      keys[1] := VK_F2;
      keys[2] := VK_F3;
      keys[3] := VK_F4;
      keys[4] := VK_F5;

      randInt := Random(6);

      case randInt of
        0..4:
          begin
            KeyDown(keys[randInt]);
            wait(35+random(85));
            KeyUp(keys[randInt]);
          end;

        else
          for i := 1 to 3 do
          begin
            randKey := Random(5);
            KeyDown(keys[randKey]);
            wait(35+random(85));
            KeyUp(keys[randKey]);
          end;
      end;
      wait(75+random(100));
      GameTab(currTab); // Reset to starting tab
    end;

    //random antibans to use
    procedure GAntiBan;
    begin
      writeln('Choosing random antiban');
      case random(11) of
        0 : begin
            writeln('Random click selected');
            RandomRClick;
            end;
        1 : begin
            writeln('Random movement selected');
            RandomMovement;
            end;
        2 : begin
            writeln('Hover skill strength');
            HoverSkill(skill_strength,false);
            end;
        3 : begin
            writeln('Prayer tab selected');
            GameTab(27);
            Wait(randomrange(400,800));
            end;
        4 : begin
            writeln('Random Angle selected');
            RandomAngle(True);
            end;
        5 : begin
            writeln('Random Fkey selected');
            MSI_RandomFKey;
            end;
        6 : begin
            writeln('Hover Skill (HP) selected');
            HoverSkill(skill_hitpoints,false);
            Wait(randomrange(300,600));
            end;
        7 : begin
            writeln('Game Tab stats selected');
            GameTab(23);
            end;
        8 : begin
            writeln('Pickup Mouse selected');
            PickUpMouse;
            end;
        9 : begin
            writeln('Random wait selected');
            Wait(randomrange(1000,2000));
            end;
        10 : begin
            writeln('Hover Skill attack selected');
            HoverSkill('attack',false);
            end;
      end;
    Wait(randomrange(500,1000));
    end;

    //thanks flight! and home!
    Function Eat(What: String): Boolean;
      var
        I: Integer;
    begin
      Result := False;
        If Not LoggedIn then Exit;
        if (HPPercent < 50) then
      If InvEmpty then Logout
      else
        for i := 1 to 28 do
        begin
          InvMouse(I, 3);
          if IsUpText(What) then
          begin
            ClickMouse2(True);
            Wait(RandomRange(350, 525));
              Result := True;
            Exit;
          end else
            Continue;
        end;
    end;

    //from flight, thanks!
    Function FindObjSimple_F(Colors: TIntegerArray; TheUpText: TStringArray; midx, midy: integer): Boolean;
      Var
        T,i,X,Y: Integer;
        TPA: TPointArray;
        ATPA: Array of TPointArray;
      Begin
        MarkTime(T);
        Repeat
          SetArrayLength(ATPA, Length(Colors));
          for i := 0 to High(Colors) do
            FindColorsSpiralTolerance(midx, midy, ATPA[i], Colors[i], MSX1, MSY1, MSX2, MSY2, 5);
          TPA := MergeATPA(ATPA);
          ATPA := TPAtoATPAEx(TPA, 15, 15);
          SortATPAFrom(ATPA, Point(MSCX, MSCY));
          if (Length(ATPA) = 0) then
            Exit;

          MiddleTPAEx(ATPA[0], x, y);

          if (TimeFromMark(T) > 5000) then
            Exit;

          MMouse(x, y, 10, 10);
          Wait(randomrange(75,150));
          If(IsUpTextMultiCustom(TheUpText)) then
          begin
            ClickMouse2(True);
            if DidRedClick then
            begin
              Result := True;
              Break;
            end;
          end;
        Until(Result)
      end;

    //used to add chatbox text after 'someone else is fighting that' so it doesn't loop
    procedure GetOutF;
    begin
      case random(2) of
        0 : begin
            KeyDown(VK_Tab);
            wait(35+random(100));

            wait(35+random(100));
            KeyUp(VK_Tab);
            wait(25+random(70));

            wait(35+random(100));
            end;
        1 : begin
            ExamineInv;
            end;
      end;
    end;

    //only used in below case
    procedure GMoveMouse;
    begin
      case random(4) of
        0 : begin
            mMouse(5,25,10,20);
            end;
        1 : begin
            mMouse(250,150,40,40);
            end;
        2 : begin
            mMouse(505,350,50,50);
            end;
        3 : begin
            mMouse(30,315,20,40);
            end;
      end;
    end;



    //Less likely to use one of the GAntiBan's
    Procedure RAntiBan;
    begin
      Wait(randomrange(350,500));
      case random(RandAmount) of
        0 : begin
              writeln('Random Wait AntiBan');
              Wait(randomrange(1100,2500));
            end;
        1 : begin
              GAntiBan;
            end;
        2 : begin
              writeln('pickup mouse / GMoveMouse');
              PickUpMouse;
              Wait(randomrange(25,100));
              GMoveMouse;
              Wait(randomrange(250,300));
            end;
        3 : begin
              writeln('Double GMoveMouse');
              GMoveMouse;
              Wait(randomrange(45,100));
              GMoveMouse;
            end;
      end;
    end;



    //Attacking, Based From Grats
    procedure Attacking;
    var
    sX,sY: Integer;
    label
    fighting;
    begin
    begin
      if AttackOption = 'Yak' then
      if FindObjSimple_F([4869718, 1908774], ['ttck','Yak'], MSCX, MSCY) then
      writeln('Killing Yak!');
      fighting:
      While IsMoving do
        wait(1);
        FindNormalRandoms;
      wait(randomrange(1400,2000));
      if FindBlackChatMessage('omeone else is fighting') then
      begin
        writeln('Someone else is controlling the population of this yak!');
        case random(4) of
        0 : begin
              sX := MSX1;
              sY := MSY1;
            end;
        1 : begin
              sX := MSX1;
              sY := MSY2;
            end;
        2 : begin
              sX := MSX2;
              sY := MSY1;
            end;
        3 : begin
              sX := MSX2;
              sY := MSY2;
            end;
        end;
        if AttackOption = 'Yak' then
        if  FindObjSimple_F([4869718, 1908774], ['ttck','Yak'], MSCX, MSCY) then
          GetOutF;
          goto fighting;
      end else
      begin
        if InFight then
        begin
          repeat
          FindNormalRandoms;
          writeln('fighting...');
          Eat('Eat');
          RAntiBan;
          until (not InFight) or (not LoggedIn)
        end;
        writeln('Another Yak down, billions to go');
        wait(randomrange(200,400));
      end;
    end;
    begin
      if AttackOption = 'Gaurd' then
        FindObjSimple_F([3491141, 2851467], ['ttck','uard (level: 21)'], MSCX, MSCY);
      writeln('Attacking Gaurd!');
      fighting:
      While IsMoving do
        wait(1);
        FindNormalRandoms;
      wait(randomrange(1400,2000));
      if FindBlackChatMessage('omeone else is fighting') then
      begin
        writeln('Another Pimp is taking out this hoe!');
        case random(4) of
        0 : begin
              sX := MSX1;
              sY := MSY1;
            end;
        1 : begin
              sX := MSX1;
              sY := MSY2;
            end;
        2 : begin
              sX := MSX2;
              sY := MSY1;
            end;
        3 : begin
              sX := MSX2;
              sY := MSY2;
            end;
        end;
        if AttackOption = 'Gaurd' then
        FindObjSimple_F([3491141, 2851467], ['ttck','uard (level: 21)'], MSCX, MSCY);
          GetOutF;
          goto fighting;
      end else
      begin
        if InFight then
        begin
          repeat
          FindNormalRandoms;
          writeln('fighting...');
          Eat('Eat');
          until (not LoggedIn)
        end;
        writeln('One poor imisult of a gaurd is now Dead, Attacking another');
        wait(randomrange(200,400));
      end;
    end;
    end;


    //script startup
    procedure Startup;
    begin
      Smart_Server := SWorld;
      Smart_Members:= true;
      Smart_Signed := true;
      Smart_SuperDetail := false;
      SetupSRL;
      DeclarePlayers;
      LogInPlayer;
      MouseSpeed := MSpeed;
      wait(100+random(100));
    end;


    begin
      Startup;
      SetupChar;
      repeat
      FindNormalRandoms;
      until not LoggedIn
      writeln('stopping script');
    TerminateScript;
    end.

    There it is, thats the only part im stuck on is adding the choice of NPC. Havent added the other NPC's yet just Yak and Gaurd.

  6. #6
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    You forgot to put tags around it.
    It looks big now! You need to highlight your script and click the button on the forums for simba tags around it. Then it looks nice.

    E: yay you did it.
    Check out my powerminer linked in my signature to see how to have each player mine a different kind of rock.

  7. #7
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lol ya sorry, the guy above said to put a . infront of the first simba so that messed me up. Which one is the powerminer?

  8. #8
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

  9. #9
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That kind of helped me but didn't. What im looking for is how to make an option in the begining like

    AttackOption = Gaurd;

    That would mean they want to attack the gaurd. Then down farther in the script have the color's for Simba to look for in the game screen. It works perfect if i have one thing. Like just have gaurds then it only looks for gaurds.
    But when i implement 2 NPC's it just stays on the inventory icon, so if i add the

    if AttackOption = 'Gaurd' then



    It does nothing, but if i just have the


    if FindObjSimple_F([4869718, 1908774], ['ttck','Yak'], MSCX, MSCY) then




    It works perfectly! :9

  10. #10
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OMG never mind! Stupid rookie mistake found it, i forgot to add in the bottom for it to do the Attacking Procedure!

  11. #11
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by laakerules View Post
    That kind of helped me but didn't. What im looking for is how to make an option in the begining like

    AttackOption = Guard;

    That would mean they want to attack the gaurd. Then down farther in the script have the color's for Simba to look for in the game screen. It works perfect if i have one thing. Like just have gaurds then it only looks for gaurds.
    But when i implement 2 NPC's it just stays on the inventory icon, so if i add the

    if AttackOption = 'Guard' then



    It does nothing, but if i just have the


    if FindObjSimple_F([4869718, 1908774], ['ttck','Yak'], MSCX, MSCY) then




    It works perfectly! :9

    Corrected your spelling.

  12. #12
    Join Date
    Dec 2011
    Posts
    1,162
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Now it is just attacking 2 since i have the 2 different monsters. how would i get it stuck in a loop once it has decided that it is gaurds.

  13. #13
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    //Attacking, Based From Grats
    procedure Attacking;
    var
    sX,sY: Integer;
    label
    fighting;
    begin
    repeat
    begin
      if AttackOption = 'Yak' then
      if FindObjSimple_F([4869718, 1908774], ['ttck','Yak'], MSCX, MSCY) then
      writeln('Killing Yak!');
      fighting:
      While IsMoving do
        wait(1);
        FindNormalRandoms;
      wait(randomrange(1400,2000));
      if FindBlackChatMessage('omeone else is fighting') then
      begin
        writeln('Someone else is controlling the population of this yak!');
        case random(4) of
        0 : begin
              sX := MSX1;
              sY := MSY1;
            end;
        1 : begin
              sX := MSX1;
              sY := MSY2;
            end;
        2 : begin
              sX := MSX2;
              sY := MSY1;
            end;
        3 : begin
              sX := MSX2;
              sY := MSY2;
            end;
        end;
        if AttackOption = 'Yak' then
        if  FindObjSimple_F([4869718, 1908774], ['ttck','Yak'], MSCX, MSCY) then
          GetOutF;
          goto fighting;
      end else
      begin
        if InFight then
        begin
          repeat
          FindNormalRandoms;
          writeln('fighting...');
          Eat('Eat');
          RAntiBan;
          until (not InFight) or (not LoggedIn)
        end;
        writeln('Another Yak down, billions to go');
        wait(randomrange(200,400));
      end;
    end;
    until(OutOfFood);
    begin
      if AttackOption = 'Gaurd' then
        FindObjSimple_F([3491141, 2851467], ['ttck','uard (level: 21)'], MSCX, MSCY);
      writeln('Attacking Gaurd!');
      fighting:
      While IsMoving do
        wait(1);
        FindNormalRandoms;
      wait(randomrange(1400,2000));
      if FindBlackChatMessage('omeone else is fighting') then
      begin
        writeln('Another Pimp is taking out this hoe!');
        case random(4) of
        0 : begin
              sX := MSX1;
              sY := MSY1;
            end;
        1 : begin
              sX := MSX1;
              sY := MSY2;
            end;
        2 : begin
              sX := MSX2;
              sY := MSY1;
            end;
        3 : begin
              sX := MSX2;
              sY := MSY2;
            end;
        end;
        if AttackOption = 'Gaurd' then
        FindObjSimple_F([3491141, 2851467], ['ttck','uard (level: 21)'], MSCX, MSCY);
          GetOutF;
          goto fighting;
      end else
      begin
        if InFight then
        begin
          repeat
          FindNormalRandoms;
          writeln('fighting...');
          Eat('Eat');
          until (not LoggedIn)
        end;
        writeln('One poor imisult of a gaurd is now Dead, Attacking another');
        wait(randomrange(200,400));
      end;
    end;
    end;

    Make an OutOfFood function that would return true if there is no more food.
    Last edited by Yanhua; 12-22-2011 at 04:35 AM.

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
  •