Page 4 of 4 FirstFirst ... 234
Results 76 to 95 of 95

Thread: [Aerolib] Creating your first script

  1. #76
    Join Date
    Sep 2017
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Hi, i'm getting this error while trying to run this script:
    Code:
    program new;
    //{$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}
    
    var
      OurWords: String;
    
    Procedure PlayerSetup;
    var
      AlsoOurWords: string;
    
    begin
      Me.Active := True;
      Me.Name := '';
      Me.Pass := '';
      Me.Member := True;
    end;
    
    Procedure LetsDoStuff;
    var
      pnt:Tpoint;
    begin
      pnt := [648, 183];
      HumanMMouse(pnt, 5, 5);
    
    end;
    
    begin
      initAL;
      PlayerSetup;
      if (not isLoggedIn()) then
        loginPlayer(false);
      OurWords := 'Hello World!';
      Writeln(OurWords);
      OurWords := 'Goodbye World!';
      Writeln(OurWords);
      LetsDoStuff;
    end.
    smnA7gS.png
    It will run with smart but I don't want to use it. Help please?
    Last edited by Helvetin16; 09-02-2017 at 08:58 PM.

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

    Default

    Quote Originally Posted by Helvetin16 View Post
    Hi, i'm getting this error while trying to run this script:
    Code:
    program new;
    //{$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}
    
    var
      OurWords: String;
    
    Procedure PlayerSetup;
    var
      AlsoOurWords: string;
    
    begin
      Me.Active := True;
      Me.Name := '';
      Me.Pass := '';
      Me.Member := True;
    end;
    
    Procedure LetsDoStuff;
    var
      pnt:Tpoint;
    begin
      pnt := [648, 183];
      HumanMMouse(pnt, 5, 5);
    
    end;
    
    begin
      initAL;
      PlayerSetup;
      if (not isLoggedIn()) then
        loginPlayer(false);
      OurWords := 'Hello World!';
      Writeln(OurWords);
      OurWords := 'Goodbye World!';
      Writeln(OurWords);
      LetsDoStuff;
    end.
    smnA7gS.png
    It will run with smart but I don't want to use it. Help please?
    You're not running Simba 1.2 RC-6 as I very specifically mentioned must be used to run the newest AeroLib. Check out this post for more information.

    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..."


  3. #78
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by Helvetin16 View Post
    Stuff
    Quote Originally Posted by Flight View Post
    Stuff
    Have updated the guide with Simba 2.0 installation instructions.

  4. #79
    Join Date
    Sep 2017
    Posts
    7
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    What should I do? I created object, but it is moving so the script missclicks a lot on him. Is there a way to make the script wait untill the npc has stopped moving? Or make the clicks more accurate?
    Code:
    program new;
    //{$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}
    
    var
     Guy: TMSObject;
    
    Procedure PlayerSetup;
    begin
      Me.Active := True;
      Me.Name := '';
      Me.Pass := '';
      Me.Member := True;
    
      Guy.create('Talk', ['-to'], [createCol(2106205, 12, 0.09, 0.33)], 50, 0, 0, 0);
    end;
    
    Procedure FindGuy;
    var
      pnt:tpoint;
    begin
      if Guy.Find(pnt) then
        FastClick(Mouse_left);
    
    end;
    
    begin
      initAL;
      PlayerSetup;
      FindGuy;
    end.
    Last edited by Helvetin16; 09-05-2017 at 06:43 PM.

  5. #80
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by Helvetin16 View Post
    What should I do? I created object, but it is moving so the script missclicks a lot on him. Is there a way to make the script wait untill the npc has stopped moving? Or make the clicks more accurate?
    Code:
    program new;
    //{$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}
    
    var
     Guy: TMSObject;
    
    Procedure PlayerSetup;
    begin
      Me.Active := True;
      Me.Name := '';
      Me.Pass := '';
      Me.Member := True;
    
      Guy.create('Talk', ['-to'], [createCol(2106205, 12, 0.09, 0.33)], 50, 0, 0, 0);
    end;
    
    Procedure FindGuy;
    var
      pnt:tpoint;
    begin
      if Guy.Find(pnt) then
        FastClick(Mouse_left);
    
    end;
    
    begin
      initAL;
      PlayerSetup;
      FindGuy;
    end.
    GIve this code a try. I have added an explanation to each line. Is untested so not sure if it will work xD

    Simba Code:
    program new;
    {$i AeroLib/AeroLib.Simba}

    var
      Guy:TMSObject;

    function FindTheGuy:boolean;
    var
      pnts:TpointArray;
      i, Col, x, y:integer;
    label TryAgain; //Creates a label so we can navigate back to a point if required.
    begin
      TryAgain: //Is the label that we navigate back to if our NPC is moving so we can try again.
      Result := false; // Sets the function result to false, so if we cannot find the NPC it returns false.
      if Guy.findAll(10, MSCP, pnts) then  //Trying to find all Guy(s) and store them in a TPointArray.
        for i := 0 to high(pnts) do //Begin the loop through the Guy(s)
        begin
          Col := GetColor(pnts[i].x, pnts[i].y); //gets the color of the guy we are looking at.
          wait(randomrange(400, 600)); //waits a short period of time.
          if FindColor(x, y, Col, pnts[i].x - 3, pnts[i].y - 3, pnts[i].x + 3, pnts[i].y + 3) then //Checks to see if that same color is still found at the co-ordinates (6x6 box)
          begin
            MissMouse(pnts[i], 3, 3); // If the color was still found, it means the object isnt moving so we now attempt to click.
            if WaitUpTextMulti(Guy.UpText, 500) then  //wait for the uptext to match.
            begin
              FastClick(MOUSE_LEFT);  //Click him then exit the function, returning a true boolean.
              exit(true);
            end;
          end else
            GoTo TryAgain; //The color was no longer found at the co-ordinates, meaning our object had moved, so it tells the script to go back to our label we declared at the beginning of the function.
        end;
    end;

    begin
      InitAL;
      Guy.create('Talk', ['-to'], [createCol(2106205, 12, 0.09, 0.33)], 50, 0, 0, 0);
      if FindTheGuy then
        writeln('Found and clicked the guy!');
    end.

  6. #81
    Join Date
    Oct 2017
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    So I am just starting to get into scripting. I read your guide and made the powerminer, and i want to try my own but for woodcutting then to bank the logs. but there is also one thing I am interested in. How would you make a script or what would the lines be to make a move mouse in an x y direction on key press?

  7. #82
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by KindredLamar View Post
    So I am just starting to get into scripting. I read your guide and made the powerminer, and i want to try my own but for woodcutting then to bank the logs. but there is also one thing I am interested in. How would you make a script or what would the lines be to make a move mouse in an x y direction on key press?
    Think that would be more Windows macro. I am not sure though. Have only used Simba for automation personally.

  8. #83
    Join Date
    Oct 2017
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Code:
    function OnEvent(event, arg)
        OutputLogMessage("event = %s, arg = %d\n", event, arg)
        if (event == "PROFILE_ACTIVATED") then
            EnablePrimaryMouseButtonEvents(true)
        elseif event == "PROFILE_DEACTIVATED" then
            ReleaseMouseButton(2)  -- to prevent it from being stuck on
        end
        if (event == "MOUSE_BUTTON_PRESSED" and arg == 4) then
            recoilx2 = not recoilx2
            spot = not spot
        end
       if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilx2) then
            if recoilx2 then
                repeat
                    --Sleep(8)
                    Sleep(8)
                    MoveMouseRelative(0, 2)
                until not IsMouseButtonPressed(1)
            end
        end
    
       
     if (event == "MOUSE_BUTTON_PRESSED" and arg == 5) then
            recoilx4 = not recoilx4
            spot = not spot
        end
       if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoilx4) then
            if recoilx4 then
                repeat
                    --Sleep(8)
                    Sleep(8)
                    MoveMouseRelative(0, 6)
                    Sleep(8)
                    MoveMouseRelative(8, 0)
                    Sleep(8)
                    MoveMouseRelative(-8, 0)
    			Sleep(8)
    			MoveMouseRelative(0, 6)
                until not IsMouseButtonPressed(1)
            end
        end
    end
    I guess something along the lines of this, but I want it in simba.
    would i need some sort of extra plugin or what not to allow that to happen. Because if we can get simba to move the mouse on play and what not, why couldnt there be a way to get it to move on key press. idk if this is even where I should be asking, but I see your guides are very informative and since I am new I cant directly pm you. If this is against the rules I will go ahead and delete it but I am just trying to learn ya know.

  9. #84
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

  10. #85
    Join Date
    Jan 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Hi
    In rs3 you can use a build in function "bankScreen.open(BANK_CHEST_DUEL)" to open bank chest meaning you don't have to use ACA[AutocolorAid] to create an object. Does osrs also have a build in function?

  11. #86
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by mikargo View Post
    Hi
    In rs3 you can use a build in function "bankScreen.open(BANK_CHEST_DUEL)" to open bank chest meaning you don't have to use ACA[AutocolorAid] to create an object. Does osrs also have a build in function?
    Not that I have seen. It is easy to create a function though. Most colours would be standard in game so you can always look at other scripts that use a specific bank and find the colours from them.

  12. #87
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by mikargo View Post
    Hi
    In rs3 you can use a build in function "bankScreen.open(BANK_CHEST_DUEL)" to open bank chest meaning you don't have to use ACA[AutocolorAid] to create an object. Does osrs also have a build in function?
    from SRL OSR include

    https://github.com/SRL/SRL/blob/a4e8...een.simba#L321

  13. #88
    Join Date
    Jan 2016
    Posts
    8
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    Quote Originally Posted by Dan the man View Post
    Not that I have seen. It is easy to create a function though. Most colours would be standard in game so you can always look at other scripts that use a specific bank and find the colours from them.
    yeah. Just created a bank object. for some reason my mouse goes always to the same pixel 250,274. Compass is facing south, clan wars bank chest. camera is zoomed all the way in
    Am i missing something?

    Code:
    program new;
    //{$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}
    
    var
      BankObject: TMSObject;
    
    procedure OpenBank;
    
    var
      BankPoint:TPoint;
    begin
      BankObject.create('Bank Chest', ['ank chest', 'Bank', 'chest', 'ank c'], [createCol(2896192, 18, 0.23, 0.84)], 80, 0, 0, 0);
      if BankObject.find(BankPoint) then
        begin
        wait(randomrange(100, 1050));
        openBankPoint(BankPoint, true);
        end;
    end;
    
    begin
      initAL;
      OpenBank;
    end.
    Last edited by mikargo; 12-03-2017 at 03:58 PM.

  14. #89
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by mikargo View Post
    yeah. Just created a bank object. for some reason my mouse goes always to the same pixel 250,274. Compass is facing south, clan wars bank chest. camera is zoomed all the way in
    Am i missing something?

    Code:
    program new;
    //{$DEFINE SMART}
    {$i AeroLib/AeroLib.Simba}
    
    var
      BankObject: TMSObject;
    
    procedure OpenBank;
    
    var
      BankPoint:TPoint;
    begin
      BankObject.create('Bank Chest', ['ank chest', 'Bank', 'chest', 'ank c'], [createCol(2896192, 18, 0.23, 0.84)], 80, 0, 0, 0);
      if BankObject.find(BankPoint) then
        begin
        wait(randomrange(100, 1050));
        openBankPoint(BankPoint, true);
        end;
    end;
    
    begin
      initAL;
      OpenBank;
    end.
    It shouldn't move your mouse to the same pixel each time; OpenBankPoint has a random variation of 5 on the x and y axis when it moves the mouse to the bank point. If you want more variation, you can handle the banking yourself as part of your procedure to add more randomization to it.

  15. #90
    Join Date
    Dec 2016
    Location
    Michigan, USA
    Posts
    38
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Just popping in to say: very nice and thorough tutorial, I'm learning!

  16. #91
    Join Date
    Jan 2017
    Posts
    5
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    So My current issue is when i try and log in it will just click between username and password and never type anything in.
    Last edited by Pandemic2all; 06-06-2018 at 12:30 AM.

  17. #92
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by Pandemic2all View Post
    So My current issue is when i try and log in it will just click between username and password and never type anything in.
    Paste your script, but remove your username & password from the script.

  18. #93
    Join Date
    Oct 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Hi, thank you very much for writing this guide. I'm currently reading the portion on writing your first script, and got to the part where it says "Follow the above guide until you have found a nice color for our rocks (remember to set the CTS on ACA2 to 2)." I would very much like to learn how to use ACA but I am not seeing where this guide is. Sorry in advance if it's actually in plain sight and I am just bad at finding things. Thank you again.

  19. #94
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Quote Originally Posted by Demore View Post
    Hi, thank you very much for writing this guide. I'm currently reading the portion on writing your first script, and got to the part where it says "Follow the above guide until you have found a nice color for our rocks (remember to set the CTS on ACA2 to 2)." I would very much like to learn how to use ACA but I am not seeing where this guide is. Sorry in advance if it's actually in plain sight and I am just bad at finding things. Thank you again.
    wrote this guide a while ago so not sure what I was referring too haha.

    It is fairly simple to use.

    Download the application, open it and target the runescape window.

    Once you see the Runescape window in the window panel, make sure CTS is set to 2:



    From there, you simply click on colours that you wish to find in the panel, ensuring that you click on similar colours.
    You can check the colours by clicking the mark best color button, and any pixels that fall within the color and tolerance will be filled red.



    Once you have all of your colours, simple note down the following values:
    Color
    HSI Tol
    Hue Mod
    Sat Mod

    When working with CTS2 colours, you would use the values in this order: Col, Tol, Hue, Sat.
    For example, here is our rock with the above colours:
    Simba Code:
    TinRock.create('Mine Rocks', ['ine rocks', 'Mine', 'rock', 'ine r'], [createCol(6905436, 18, 0.06, 0.13)], 50, 0, 0, 0)

    Hope this helps

  20. #95
    Join Date
    Oct 2018
    Posts
    2
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thank you, this helps a lot!

Page 4 of 4 FirstFirst ... 234

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
  •