Results 1 to 11 of 11

Thread: ogLib combat help

  1. #1
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Question ogLib combat help

    Hey everyone currently working on an oglib pest control script (first time using ogLib).

    I've got mostly everything done for it, gets in boat, waits for game to start, walks to portals, etc etc.

    I just cant get the combat down correctly.

    This is what I have right now for combat.
    Simba Code:
    var
     whereToLook: TPoint = [400,300] ;
    function attackPest(model:glModelArray): string;
    var
      tries: integer = 0;
      color: string;
    begin
      repeat
        mouse.click(whereToLook.closest(model)[0].randomizePointEllipse(5));
        color := mouse.getClick();


        if (color = 'red') then
          begin
            result := 'Attacking...';
            break;
          end;

        if (color = 'yellow') then
          begin
            writeLn('Missclicked, retrying...');
            tries := tries + 1;
          end;
      until (tries > 3);
      tries := 0;
    end;
    procedure insidePestControlLoop();
    var
      didWeStartGame: boolean;
      closestPest: TPoint;
      resultOfAttack: string;

    begin

      didWeStartGame := waitForGameToStart();

      if (didWeStartGame) then
        begin
          whereDoWeWalkTo(); //decides where we walk to in a different function
          repeat
            shifter := ogl.getModels(3915285997);
            blackDefiler := ogl.getModels(1731643360);
            ravager := ogl.getModels(3489785670);
            whiteDefiler := ogl.getModels(3330847942);
            splatter := ogl.getModels(547053328);

            if (not ravager.isEmpty() and not tCombat.hasTarget()) then //if we found ravager model and we have no target reticule (the red thing when you attack something)
              begin
                writeLn('Found ravager and were not in combat, attacking');
                attackPest(ravager); //sends the model of ravager to attackPest function
                repeat
                  writeLn('In combat');
                  wait(randomRange(500,700));
                until (not tCombat.hasTarget()); //make it repeat a wait procedure until there is no target reticule
              end
            else if (not splatter.isEmpty() and not tCombat.hasTarget()) then
              begin
                writeLn('Found splatter and were not in combat, attacking');
                attackPest(splatter);
                repeat
                  writeLn('In combat');
                  wait(randomRange(500,700));
                until (not tCombat.hasTarget());
              end
            else if (not blackDefiler.isEmpty() and not tCombat.hasTarget()) then
              begin
                writeLn('Found black defiler and were not in combat, attacking');
                attackPest(blackDefiler);
                repeat
                  writeLn('In combat');
                  wait(randomRange(500,700));
                until (not tCombat.hasTarget());
              end
            else if (not whiteDefiler.isEmpty() and not tCombat.hasTarget()) then
              begin
                writeLn('Found white Defiler and were not in combat, attacking');
                attackPest(whiteDefiler);
                repeat
                  writeLn('In combat');
                  wait(randomRange(500,700));
                until (not tCombat.hasTarget());
              end;
          until (checkForRewardsLady = true);
        end
      else if (not didWeStartGame) then
        begin
          writeLn('Did not start game, terminating...');
          TerminateScript;
        end;
    end;

    The biggest issue im having is since oglib can detect models outside of camera range/agle, the script will currently try to click spots where it is not available to click.
    Is there any way to narrow the search for models down to a certain distance away from a TPoint?
    Also the clicking is sometimes wonky, could use some help with that.

    But the biggest issue im having is the one stated above, making sure the script only clicks on a monster that it can click on (on the visible screen)

    I know i could just make it run to one of the portals, have auto retaliate on and just afk but that seems pretty bot like/too simple. I wanted to try something different since most of my scripts have been sort of simple but I've been trying all day and cant seem to find any good solution.

    Thanks, for any help

  2. #2
    Join Date
    Apr 2015
    Location
    FireFox
    Posts
    528
    Mentioned
    10 Post(s)
    Quoted
    227 Post(s)

    Default

    You could use a tbox maybe? If texture or whatever is in tbox(of screen) then click. Haven't check up on oglib before so this is all just guess work!

    E: Also maybe use the minimap? If their point is inside x then get screen position and click... not sure if that is something you'd want but it's worth a shot if you don't have any others!
    Scripting with ogLib

  3. #3
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Quote Originally Posted by srlMW View Post
    You could use a tbox maybe? If texture or whatever is in tbox(of screen) then click. Haven't check up on oglib before so this is all just guess work!
    I thought of this but couldn't figure how use that as a parameter for ogl.getModels

  4. #4
    Join Date
    Mar 2015
    Posts
    438
    Mentioned
    21 Post(s)
    Quoted
    211 Post(s)

    Default

    The biggest issue im having is since oglib can detect models outside of camera range/agle, the script will currently try to click spots where it is not available to click.
    Is there any way to narrow the search for models down to a certain distance away from a TPoint?
    Also the clicking is sometimes wonky, could use some help with that.

    But the biggest issue im having is the one stated above, making sure the script only clicks on a monster that it can click on (on the visible screen)

    I know i could just make it run to one of the portals, have auto retaliate on and just afk but that seems pretty bot like/too simple. I wanted to try something different since most of my scripts have been sort of simple but I've been trying all day and cant seem to find any good solution.

    Thanks, for any help
    Simba Code:
    if (not ravager[0].isVisible) then
    rotateCamera;

    Try putting this within your attackPest, although you'll have to alter it slightly.
    Last edited by Clutch; 08-01-2015 at 12:42 AM.

  5. #5
    Join Date
    Aug 2012
    Posts
    188
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    Quote Originally Posted by A Bit Poor
    ...
    Use model or texure .isVisible(). It will return if it is visible and clickable in your screen using the interface boundaries.
    you can also use getVisible() with an array to get the ones that are visible!

  6. #6
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Quote Originally Posted by Clutch View Post
    Simba Code:
    if (not ravager[0].isVisible) then
    rotateCamera;

    Try putting this within your attackPest, although you'll have to alter it slightly.

    Quote Originally Posted by Swag Bag View Post
    Use model or texure .isVisible(). It will return if it is visible and clickable in your screen using the interface boundaries.
    you can also use getVisible() with an array to get the ones that are visible!
    Oh shoot alright, I saw that function somewhere just didnt know how it worked exactly tried looking for it in the include and couldn't find it, thanks a lot you two!

  7. #7
    Join Date
    Mar 2014
    Location
    East Coast, USA
    Posts
    291
    Mentioned
    10 Post(s)
    Quoted
    148 Post(s)

    Default

    A ogLib version of pestcontrol would be great! If you need a tester I can assist! (I am good at finding things wrong in the strangest ways) @A Bit Poor;

  8. #8
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Quote Originally Posted by Grimxxdeath223 View Post
    A ogLib version of pestcontrol would be great! If you need a tester I can assist! (I am good at finding things wrong in the strangest ways) @A Bit Poor;
    It's almost complete and I will be posting it into the public sections. If I need testers I will for sure let you know!

  9. #9
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default

    Quote Originally Posted by Adieux View Post
    I thought of this but couldn't figure how use that as a parameter for ogl.getModels
    if pointInBox(glModel.toPoint(), someBounds)

    Also, you may want to offset the model position upwards a bit using glModel.adjustPosition(0,-x). If you need more, just message me - I'm out camping but I'll do my best on a phone. :P.




    Skype: obscuritySRL@outlook.com

  10. #10
    Join Date
    Feb 2012
    Location
    Florida
    Posts
    180
    Mentioned
    14 Post(s)
    Quoted
    101 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    if pointInBox(glModel.toPoint(), someBounds)

    Also, you may want to offset the model position upwards a bit using glModel.adjustPosition(0,-x). If you need more, just message me - I'm out camping but I'll do my best on a phone. :P.
    Thanks for the help Obscurity, I've been using isVisible and it seems to be working alright. Should I be using glModel.toPoint instead? Also, correct me if im wrong does glModel.adjustPosition change the hitboxes of the models?
    for ex: I had to remove attacking torchers from my script because the models for it were causing the script to click on the torchers bottom, and since they're flying it would click the ground under them causing it to miss click, with glModel.adjustPosition I could fix this? If so that would be great

    Edit: enjoy your camping trip!

  11. #11
    Join Date
    Jun 2012
    Posts
    586
    Mentioned
    112 Post(s)
    Quoted
    296 Post(s)

    Default

    Yes, glModel.adjustPosition() will alter the X/Y of it. The same method exists for glChars (I think), glTextures, tBoxes, and tPoints.

    Please check out [ogLib] The Model Positioning Problem.

    With your camera all the way down, get the difference in pixels from it's model point, using ogl.setDebugMode(2), to the center of the Torcher, as you can see I did with the Gargoyle. Let's say you get the result of -75:
    Simba Code:
    if length(torcherModels:=ogl.getModels(123456)) then
    begin
      torcherPoints:=ogl.getClientMidPoint().closest(torcherModels);
      mouse.click(   torcherPoints[0].adjustPosition(0,round((-1+sin(mainScreen.getVerticalRadians()))*75)   );
    end;




    Skype: obscuritySRL@outlook.com

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
  •