Results 1 to 12 of 12

Thread: Working on my first script,need help with finding objects.

  1. #1
    Join Date
    Apr 2015
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default Working on my first script,need help with finding objects.

    Hello guys, I never been programming in my life,but I decided to learn. I need to find/climb ladders,but not sure how to do this. I tried using "FindColorSpiralTolerance",but it seems it doesn't work with "HumanMMouse",cause it requires Tpoint. I tried creating var x, y = Integer; But it doesnt work that way.
    I also thought about using "findMSObjectSimple",but what the hell is "cols: TIntegerArray" and how can i find it? :/ Or maybe you know even better ways to find ladder? Thanks for your time o/

    Simba Code:
    procedure UseLadder

    var
    x, y : Integer;
    begin
        WriteLn('Looking for ladder');
        if(FindColorSpiralTolerance(x, y, 2576744, 29, 33, 466, 300, 6)) then
          begin
            WriteLn('Ladder found');
            HumanMMouse([point(x,y)], 5, 5);
              fastClick(mouse_Right);
              Wait(200 + random(400));
            ChooseOption('imb-up');
              WriteLn('Up');
              Wait(100 + random(400));
           end;
    end;

  2. #2
    Join Date
    Sep 2014
    Location
    the Netherlands
    Posts
    136
    Mentioned
    7 Post(s)
    Quoted
    61 Post(s)

    Default

    Simba Code:
    HumanMMouse([x, y], 5, 5);

    This should do the trick. It's been a while, so let me know if it doesn't work.
    Weird though, I remember just using HumanMMouse(x, y, 3, 3);
    Last edited by iEatApplez; 05-07-2015 at 12:15 AM.
    Previously known as; Annonymus.

  3. #3
    Join Date
    Sep 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    13 Post(s)

    Default

    If it asked for a Tpointarray instead of a Tpoint, the brackets are usually for arrays.
    Simba Code:
    HumanMMouse(point(x, y), 5, 5);



    "cols: TIntegerArray"
    An array of colors that you'd want it to look for, something like :
    Simba Code:
    findMSObjectSimple([color1, color2, color3], ['uptext1', 'uptext2'])
    Last edited by woo hoo; 05-07-2015 at 12:25 AM.

  4. #4
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Quote Originally Posted by woo hoo View Post
    If it asked for a Tpointarray instead of a Tpoint, the brackets are usually for arrays.
    Simba Code:
    HumanMMouse(point(x, y), 5, 5);




    An array of colors that you'd want it to look for, something like :
    Simba Code:
    findMSObjectSimple([color1, color2, color3], ['uptext1', 'uptext2'])
    In addition to this information let me point out a few basics. An array of anything will be kept in brackets []. He's a few examples:
    Simba Code:
    procedure funWithArrays;
    var
      Point_A    : TPoint;
      SomePoints : TPointArray;
      Integer_A  : Integer;
      SomeInts   : TIntegerArray;
    begin
      Point_A := Point(150, 375); // Points consist of X/Y coordinates, so this point has a X value of 150 and Y value of 375
      SomePoints := [Point(300, 195), Point(23545, 52125), Point(9248, 458)]; // This 'array of points' contains 3 points

      Integer_A := 9001;
      SomeInts := [1301, 4, 49, 3245328]; // An 'array of integers' containing 4 integers
    end;

    And you see that 'HumanMMouse' requires a TPoint in the first parameter you'll need to use a single TPoint, so you had the right idea to make a TPoint out of the X/Y values from FindColorSpiralTolerance but you tried to input that as an array of TPoints. Simply take away the brackets like so:
    Simba Code:
    HumanMMouse(point(x,y), 5, 5);

    Using an alternative method you could try your hand at using what's called a TMSObject but you'll need to learn a little bit about how to create & utilize those. I'd recommend you take a look at this thread to get a little more info on them.

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  5. #5
    Join Date
    Apr 2015
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Thank you,guys,for fast and very usefull replies. It worked really nice !
    Last edited by xujnea; 05-07-2015 at 01:02 PM.

  6. #6
    Join Date
    Apr 2015
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Now I got stuck with chatting to npc. Im using simple "HumanMMouse" and i pick colours from chatbox for failsafes. But maybe there is more efficient or better way to do that? o/

  7. #7
    Join Date
    Aug 2014
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Quote Originally Posted by xujnea View Post
    Hello guys, I never been programming in my life,but I decided to learn. I need to find/climb ladders,but not sure how to do this. I tried using "FindColorSpiralTolerance",but it seems it doesn't work with "HumanMMouse",cause it requires Tpoint. I tried creating var x, y = Integer; But it doesnt work that way.
    I also thought about using "findMSObjectSimple",but what the hell is "cols: TIntegerArray" and how can i find it? :/ Or maybe you know even better ways to find ladder? Thanks for your time o/

    Simba Code:
    procedure UseLadder

    var
    x, y : Integer;
    begin
        WriteLn('Looking for ladder');
        if(FindColorSpiralTolerance(x, y, 2576744, 29, 33, 466, 300, 6)) then
          begin
            WriteLn('Ladder found');
            HumanMMouse([point(x,y)], 5, 5);
              fastClick(mouse_Right);
              Wait(200 + random(400));
            ChooseOption('imb-up');
              WriteLn('Up');
              Wait(100 + random(400));
           end;
    end;
    Hey there! I had some problems finding objects too but today I figured I could do something. I guess you're using lape reflection for 07 rs and this is how i did it in a script I am making:

    Code:
    procedure FindLectern;
    begin
    if lectern.Find(objGame, 'Lectern', 20) then
      begin
        if not lectern.IsOnMS then Reflect.Tiles.RotateCameraToTile(lectern.GetTile);
        lectMSPt := Reflect.Tiles.TileToMS(lectern.GetTile);
        x1 := lectMSPt.X - 15; //Made some kind of box which centre point is lectern tile ms point
        y1 := lectMSPt.Y - 15;
        x2 := lectMSPt.X + 10;
        y2 := lectMSPt.Y + 10;
        if x1 <= 0 then x1 := 2; //if box parameters passes 0 it gives error so when it's 0 or below it goes back to 2 (needs to be fixed a bit)
        if y1 <= 0 then y1 := 2;
        if FindColorSpiralTolerance(x, y, 3294041, x1, y1, x2, y2, 15) then //searched for specific color of an object in that box i made earlier
        begin
          truePt.X := x; //truePt - point where color was found (which should be on object you want to find)
          truePt.Y := y;
          Reflect.Mouse.Move(truePt, 0, 0);
          if Reflect.Text.IsUpText('Study Lectern') then //checks if there is right uptext and clicks if it's true
          begin
            Reflect.Mouse.Click(mouse_right);
            Reflect.Text.ChooseOption('Study Lectern');
          end;
        end;
        end;
      end;
    end;
    Hope it helps you in some way, if you don't understand something you can allways pm or quote Have fun scripting

    if you were wondering how you can assign seperate integers to TPoint you can do it like this

    Code:
    procedure Points;
    var
      x, y, : integer;
      somePoint : TPoint;
    begin
      x := 10;
      y := 20;
      somePoint.x := x;
      somePoint.y := y;
      Writeln(somePoint);
    end;
    ^ This will output: Point(20, 10) and values of x and y will be assigned to somePoint. There may be other ways to do that but I found that way by myself
    Last edited by Verfy; 05-07-2015 at 07:25 PM.

  8. #8
    Join Date
    Apr 2015
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Thanks for replies o/ BTW,I bumped into other problem and I noticed most of script has is too. I dont want to creat new thread,so I'll write it here. How can you make random camera moves while walking ? Cause it looks really obvious... I tried this,but didn't had much luck lol. Maybe you have better ideas?

    Code:
    procedure RandomCam
    
    var
    RC : timer;
    
    begin
    RC.start
      begin
        if(RC.timeElapsed > (1000 * (random(6)))) then
          begin
          WriteLn('Performing antiban');
          case random(8) of
            0: RandomKeys0; // Just random camera movement.
            1: RandomKeys1;
            2: RandomKeys2;
            3: RandomKeys3;
            4: hoverSkill('random', false);
            5: RandomKeys4;
            6: RandomKeys5;
            7: RandomKeys6;
            8: RandomKeys7;
          end;
          end;
      end;
    end;

  9. #9
    Join Date
    Sep 2006
    Posts
    36
    Mentioned
    0 Post(s)
    Quoted
    13 Post(s)

    Default

    Here is the RSWalker setting that allows usage of procedures while RSWalker is on a path.

    Simba Code:
    RSWalker.onMoveEvent := @insertantibanprocedure;

    Be careful with it, your procedure will be looping until the path is done.

  10. #10
    Join Date
    Sep 2012
    Location
    Netherlands
    Posts
    2,752
    Mentioned
    193 Post(s)
    Quoted
    1468 Post(s)

    Default

    Quote Originally Posted by xujnea View Post
    Thanks for replies o/ BTW,I bumped into other problem and I noticed most of script has is too. I dont want to creat new thread,so I'll write it here. How can you make random camera moves while walking ? Cause it looks really obvious... I tried this,but didn't had much luck lol. Maybe you have better ideas?

    Code:
    procedure RandomCam
    
    var
    RC : timer;
    
    begin
    RC.start
      begin
        if(RC.timeElapsed > (1000 * (random(6)))) then
          begin
          WriteLn('Performing antiban');
          case random(8) of
            0: RandomKeys0; // Just random camera movement.
            1: RandomKeys1;
            2: RandomKeys2;
            3: RandomKeys3;
            4: hoverSkill('random', false);
            5: RandomKeys4;
            6: RandomKeys5;
            7: RandomKeys6;
            8: RandomKeys7;
          end;
          end;
      end;
    end;
    if you are using aerolib you could just call this:
    Simba Code:
    compassMovement(0, 360, false);
    this will move the compass to a random angle between 0 and 360

  11. #11
    Join Date
    Apr 2015
    Posts
    43
    Mentioned
    0 Post(s)
    Quoted
    19 Post(s)

    Default

    Thank you,that helped alot ! And I'm again with another question :S Is there a way to find and react to xp increases,like osbuddy does( Xp drops )? :/

  12. #12
    Join Date
    Apr 2015
    Posts
    112
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by xujnea View Post
    Thank you,that helped alot ! And I'm again with another question :S Is there a way to find and react to xp increases,like osbuddy does( Xp drops )? :/
    With reflection, yes.

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
  •