Results 1 to 7 of 7

Thread: Imagine-PS auto fighter

  1. #1
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default Close please

    Hi guys I am trying create my first auto fighter, this is far beyond my skill because of the complexity. If anyone could kindly help me structure this code and maybe suggestions to on functions that should be used to do this.

    First things first no need to worry about loot, on this server they have a drop catcher that picks up the loot. The only thing with this every so often I need to bank the loot so invo isnt full.

    The boss is Rage Vorago, and has two different forms. For the entire fight soul split and turmoil need to be used. When health drops to about 60 hp eat click the monkey bandage (restores hp around 80hp per click- usable about every 5-6 secs). Then around every hour or so ::bank commands to bank all items. After it should withdraw a couple prayer pots and a super set.

    Pretty simple other than that I would just start the script next to the monster and otherwise if it cant find the monster do nothing.

    This is what I have so far, the eating and prayer. Pretty good method for health and prayer imho on this server, however I still have alot of work to do and alot of optimization, feel free to help me along the way! This is my training here.

    Code:
    program VoragoFighter;
    const
      STOP_KEY = 113; // F2 to exit
    
    Procedure GetHealth;
    var
      x,y:Integer;
    begin
    //looks at health orb for yellow or orange color
      if FindColorTolerance(x, y, 2070783, 721, 28, 742, 41, 40) or findcolortolerance(x, y,65535, 721, 28, 742, 41, 40) then
    //if found it will eat the monkey bandage
      begin
    //located at top left invo slot
        movemouse(579,230);
        wait(200);
        clickmouse(579,230,1);
        wait(5000);
      end;
    end;
    
    Procedure GetPrayer;
    var
      x,y,xi,yi:Integer;
    begin
    //looks at prayer orb for yellow or orange color
      FindColorTolerance(xi, yi, 6897067, 603, 250, 730, 326, 40);//super pot
    //if found it will sip on the the 5 super pots in invo
      if FindColorTolerance(x, y, 2070783, 737, 67, 758, 80, 40) or findcolortolerance(x, y,65535, 737, 67, 758, 80, 40) then
      begin
        movemouse(658,188);
        wait(200);
        clickmouse(658,188,1);
        movemouse(xi,yi);
        wait(200);
        clickmouse(xi,yi,1);
      end;
    end;
    
    Procedure GetStage; // 1st phase or 2nd phase
    var
      x,y,xi,yi:Integer;
    begin
    
      if FindColorTolerance(x, y, 12561819, 63, 85, 391, 314, 5) then //1st phase
      begin
        movemouse(x,y);
        wait(700);
        clickmouse(x,y,1);
        GetHealth();
        GetPrayer();
        wait(500);
      end;
    
      if findcolortolerance(x, y, 5121950, 63, 85, 391, 314, 5) then //2nd phase
        begin
        movemouse(x,y);
        wait(700);
        clickmouse(x,y,1);
        GetHealth();
        GetPrayer();
        wait(500);
        end; //still work to do for this stage, equip omen's maul when almost dead, and then switch back to the sword and shield
    
    end;
    
    begin
      while not(isKeyDown(STOP_KEY)) do
      GetStage();
    end.
    Last edited by imalama101; 05-02-2018 at 03:19 PM.

  2. #2
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Updated code

  3. #3
    Join Date
    Jul 2014
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    I've seen this post for a few days now and am not entirely sure what you're asking for but I'll try to give my best answer...

    If you are not using an include Aerolib is highly recommended and most features work on RSPS' it comes with some useful functions and there are many tutorials.

    For teleporting to the bank you can use something like this:
    Simba Code:
    procedure TeleBank;
    begin
      SendKeys('::bank', randomrange(100, 250), 30);
      wait(350);
      PressKey(13); // The Enter key to send text
    end;
    But first in order to teleport to the bank we need to see if the inventory is full.
    Simba Code:
    procedure MineRockUntilFull;
    begin
      repeat
        MineRock;
        wait(randomrange(4000, 12000));
      until getInvCount() >= 24;
    end;
    The reason I checked to see if the inventory was over 24, and if so stop the loop, is because Aerolib has trouble detecting the last two slots of the RSPS I'm using and because it is inefficient (in my case) if my bot begins mining just for 4 more ore then has to wait another 4-12 seconds.

    Another way would be seeing if potions are empty by finding the amount of DTM in inventory or you could even mouse over them individually and use:
    Simba Code:
    if IsUpText('Use Empty Vial') then
    begin
    TeleBank;
    end;
    As for organizing your code and figuring out what procedures and functions you need it comes by practice and there generally isn't a wrong way to do it but different ways can cause hard to read code and many extra lines of code. A very common way to figure out what you might need is by doing what is called Psedocode. Many people have different opinions about it but some beginner programmers find it easier to get their thoughts organized on paper. Basically this just means grab a piece of paper and start very basically writing your code for example some Psedocode for a basic fighter bot might be:
    Simba Code:
    program fighter
    var x, y
    procedure findEnemy
        if color == enemyColor && uptext == 'Attack Goblin' then
         click goblin to attack
        end
    end

    procedure checkhp
    if hp < 60 then
        if findDTM(shark) then
           click shark wait and check hp again
        else
           tele home / end script
    end

    procedure gobank
    ...
    end

    begin
        findEnemy
        checkhp
        checkinventory
        gobank
    end;
    Just be rough and scribble something out, it might help you get your ideas arranged how you would like.

    If you have any questions feel free to PM me, reply to this post, or contact the wonderful people on Discord!

  4. #4
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by stocky8 View Post
    I've seen this post for a few days now and am not entirely sure what you're asking for but I'll try to give my best answer...

    If you are not using an include Aerolib is highly recommended and most features work on RSPS' it comes with some useful functions and there are many tutorials.

    For teleporting to the bank you can use something like this:
    Simba Code:
    procedure TeleBank;
    begin
      SendKeys('::bank', randomrange(100, 250), 30);
      wait(350);
      PressKey(13); // The Enter key to send text
    end;
    But first in order to teleport to the bank we need to see if the inventory is full.
    Simba Code:
    procedure MineRockUntilFull;
    begin
      repeat
        MineRock;
        wait(randomrange(4000, 12000));
      until getInvCount() >= 24;
    end;
    The reason I checked to see if the inventory was over 24, and if so stop the loop, is because Aerolib has trouble detecting the last two slots of the RSPS I'm using and because it is inefficient (in my case) if my bot begins mining just for 4 more ore then has to wait another 4-12 seconds.

    Another way would be seeing if potions are empty by finding the amount of DTM in inventory or you could even mouse over them individually and use:
    Simba Code:
    if IsUpText('Use Empty Vial') then
    begin
    TeleBank;
    end;
    As for organizing your code and figuring out what procedures and functions you need it comes by practice and there generally isn't a wrong way to do it but different ways can cause hard to read code and many extra lines of code. A very common way to figure out what you might need is by doing what is called Psedocode. Many people have different opinions about it but some beginner programmers find it easier to get their thoughts organized on paper. Basically this just means grab a piece of paper and start very basically writing your code for example some Psedocode for a basic fighter bot might be:
    Simba Code:
    program fighter
    var x, y
    procedure findEnemy
        if color == enemyColor && uptext == 'Attack Goblin' then
         click goblin to attack
        end
    end

    procedure checkhp
    if hp < 60 then
        if findDTM(shark) then
           click shark wait and check hp again
        else
           tele home / end script
    end

    procedure gobank
    ...
    end

    begin
        findEnemy
        checkhp
        checkinventory
        gobank
    end;
    Just be rough and scribble something out, it might help you get your ideas arranged how you would like.

    If you have any questions feel free to PM me, reply to this post, or contact the wonderful people on Discord!
    Hey thanks for the response! I have actually managed to complete this script all in pascal, it looks way different than the posted one now. I have learned a great amount of knowledge already, amazingly. I have no idea what includes do or even what aerolib is, this is great new leanings. However, imagine-ps game interface is a bit different than 07. There is a couple more tabs, and the health and prayer orbs are on the opposite side of the compass. How would this effect functionality, is there a work around for this case? Also I know smart doesn't work for RSPS dont you need smart to use aerolib?

    Thanks in advance, after seeing this im all for switching over to aerolib for functionality. However I have a working script in basic simba with just colors and bitmaps(I was able to successfully run my un-posted fighter for 12 hours straight no hiccups.

  5. #5
    Join Date
    Jul 2014
    Posts
    16
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Awesome! I'm glad you got it running. I personally have been using Aerolib lately for a Private server I play on but of course it is not required and I only use such a small part of it. Aerolib does not require SMART and I haven't even been able to find a way to successfully run SMART with an RSPS.

  6. #6
    Join Date
    Jul 2007
    Posts
    70
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by stocky8 View Post
    Awesome! I'm glad you got it running. I personally have been using Aerolib lately for a Private server I play on but of course it is not required and I only use such a small part of it. Aerolib does not require SMART and I haven't even been able to find a way to successfully run SMART with an RSPS.
    I'd really like to figure out how to handle game text for condition checking, it would make my scripts 100times more efficient. Iv had little luck since aerolib isn't working for me.

  7. #7
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by imalama101 View Post
    I'd really like to figure out how to handle game text for condition checking, it would make my scripts 100times more efficient. Iv had little luck since aerolib isn't working for me.
    Simba has built-in functions for that. http://docs.villavu.com/simba/scriptref/ocr.html. Should work on most private servers.
    I've written some RSPS scripts, so maybe you can look through them and see how I handled text.
    https://villavu.com/forum/showthread...82#post1363582
    https://villavu.com/forum/showthread...63#post1384863
    https://villavu.com/forum/showthread.php?t=118186

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
  •