Page 1 of 5 123 ... LastLast
Results 1 to 25 of 101

Thread: [OGL Methods] clostest, extractIDs, etc

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

    Default [OGL Methods] clostest, extractIDs, isBehindInterface, etc

    Before you go further, realize that I will not be hand-holding. If you're too lazy to read up on these function, methods, and procedures, then I'm likely to be too lazy to help. My work is for people who want to learn. People who want to improve. Take time and read through them. Read the descriptions. Read the examples. These are powerful and, if you take the time to learn them, will cut your scripting time in half.

    My scripts are designed for RuneScape 3. While most methods and such will work with Legacy, specific functions, such as obsGetPercentHealth(), will not be designed for Legacy. Period.

    If you can think of anything that you'd like designed, something that already exists that you'd like to be easier, please post. I like a challenge and odds are I'll get it done.

    The Simba file is attached. Examples are included, but commented out.

    Method/function/procedure list (items in bold have been added or edited in the last release):
    • adjustPosition()
    • .closest()
    • .closestTo()
    • .delete()
    • .distanceFrom()
    • .extractColourID()
    .extractDimensions()
    .extractHeight()
    • .extractID()
    .extractTID()
    .extractWidth()
    • .furthest()
    • getMousePoint()
    • .indexes()
    • .isBehindInterface()
    • .isEmpty()
    .isInBox()
    • .maxIndex()
    • .minIndex()
    • obsCanThreshold()
    • obsCanThreshold()
    • obsClickOption()
    • obsGetActionBar()
    • obsGetAbilityCooldown()
    • obsGetAbilityKey()
    • obsGetAbilityQue()
    • obsGetActionBar()
    • obsGetActionKey()
    • obsGetActionSlotKey()
    • obsGetAbilityColourID()
    • obsGetAbilityKey()
    • obsGetAdrenaline()
    • obsGetAutoRetaliate()
    • obsGetCameraAngle()
    • obsGetCameraAngleE()
    obsGetChooseOption()
    • obsGetCompassAngle()
    • obsGetCompassAngleE()
    • obsGetLifePoints()
    • obsGetInventoryCount()
    • obsGetInventoryItem()
    • obsGetInventoryFull()
    • obsGetInventorySlot()
    • obsGetMiniMapBounds()
    • obsGetMiniMapMiddle()
    • obsGetPrayerPoints()
    • obsGetRunEnergy()
    • obsGetRunMode()
    • obsGetSummoningPoints()
    • obsLocalMap()
    • obsLocalMapReverse()
    • obsMiniMapClickAngle()
    • obsSetAutoRetaliate()
    • obsSetCameraAngle()
    obsSetChooseOption()
    • obsSetCompassAngle()
    • obsSetRunMode()
    • .randomizePoint()
    • .randomizePointEllipse()
    • .toPoint()
    • .toTPA()
    • etc...

    obscurityLibraryUpload.Simba:
    obscurityLibraryUpload.simba - Last updated: 2:18PM 01-27-2015
    Last edited by Obscurity; 01-14-2015 at 12:50 AM.




    Skype: obscuritySRL@outlook.com

  2. #2
    Join Date
    Aug 2014
    Location
    Australia
    Posts
    932
    Mentioned
    53 Post(s)
    Quoted
    495 Post(s)

    Default

    I have no idea who will find these useful and for what, but great work regardless.

    Also, just fyi, [simba] tags enable code highlighting unlike the tags you're currently using. Should make your snippets easier to read.



    New to scripting? Procedures & Functions for Beginners
    Do you use your computer at night? Just get f.lux

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

    Default

    Couple of changes. I was retarded and made a couple errors. Mind you - I wrote the whole thing while offline and didn't test it at all. It's been tested now.

    Changes:
    • Added toPoint() methods. Odds are, these already exist, but these are to work with my closest() and other methods. For example:
    Simba Code:
    models:=glGetModels(3246121294);
    models[0].toPoint().closest(glGetModels([2973247522,4266457693,3167054540,1910331604,3846713432]));
    The above finds models with the ID 3246121294. It then retrieves another list of models and finds the closest to the first 3246121294 result.

    I use this in my shitadel bot (I hate the citadel), for example. To find the closest root to the player, that's not the one you're standing beside, I use:
    Simba Code:
    mouse(positionPlayer.closest(arrayOfRoots).toPoint().closest(arrayOfRoots).randomizePoint(10),1);
    First, it gets the closest root to positionPlayer. It then converts that glModel to a tPoint. It then gets the closest root to that point. Obviously my anti-ban is removed from the post for personal reasons. :-P.

    • Made the glModel and glTexture methods convert the IDs to cardinals. As you know, integers/IDs, such as 3246121294, that are above 2B become negative. Therefore, things like:
    Simba Code:
    models:=glGetModels([3246121294,2973247522,4266457693,3167054540,1910331604,3846713432]);
    for modelIndex:=0 to length(models)-1 do
      writeLN(models[modelIndex]);

    writeLN(models.extractID(3246121294));
    Report incorrect values.

    • Fixed errors in each of the closest(), extractColourID(), and extractID() methods.

    • Added obscurityLibrary.Simba as an attachment to the original post.
    Last edited by Obscurity; 10-21-2014 at 03:55 AM.

  4. #4
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

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

    Default

    A lot more to come. I'll just be uploading them as I use them or as I need them. These methods are incredibly helpful with OGL - if anyone wants examples/samples as to how or why, let me know and I'll write a few up. .

  6. #6
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Some tips:

    Quote Originally Posted by Obscurity View Post
    Simba Code:
    function getMousePoint:tPoint;
        var
          mouseX,
            mouseY:integer=0;
        begin
          getMousePos(result.x,result.y);
        end;
    You forgot to remove the 2 unused variables

    As you might have guessed, there's already a points sorting function in simba:
    Simba Code:
    SortTPAFrom(var a: TPointArray; const From: TPoint)

    One of the methods i use for sorting models:
    Simba Code:
    function glModelArray.toMouseClosest(): glModelArray;
    var
      x, y, i, i2: Integer;
      TPA: TPointArray;
    begin
      if Length(self) = 0 then
        Exit;
      if Length(self) = 1 then
        Exit(self);

      GetMousePos(x, y);
      TPA:= self.toTPA;
      SortTPAFrom(TPA, Point(x, y));
      for i:=0 to High(TPA) do
        for i2:=i to High(self) do
          if TPA[i].equals(Point(self[i2].x, self[i2].y)) then
          begin
            swap(self[i], self[i2]);
            Break;
          end;

      Result:= self;
    end;

    For your TPoint.randomizePoint() functions, you could simply specify the randomness in the Mouse() routine (look through all the overloaded Mouse() methods), or better yet use gauss clicking

    For retrieving the model/texture with the desired ID sometimes i just use
    Simba Code:
    function glTextureArray.getIndex(ID: Integer): Integer;
    var
      highSelf, i: Integer;
    begin
      highSelf := High(self);
      for i:= 0 to highSelf do
        if self[i].ID = ID then
          Exit(i);

      Result := -1;
    end;

    function glTextureArray.contains(ID: Integer): Boolean;
    begin
      Result := self.getIndex(ID) > -1;
    end;

    function glModelArray.getIndex(IDs: TIntegerArray): Integer; overload;
    var
      i: Integer;
    begin
      for i:=0 to High(self) do
        if InIntArray(IDs, self[i].ID) then
          Exit(i);

      Result := -1;
    end;
    then call the particular element in the array directly instead of having to assign new arrays.
    Last edited by riwu; 10-21-2014 at 11:59 AM.

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

    Default

    Cheers for looking through it! As I said, I'm new to Simba and SMART, etc. I've never used it for anything serious, though I've written some wicked PvM bots with it (such as boss hunters [Bandos, Tormented Demons, etc], Slayer, etc).

    I appreciate you actually going through and analyzing it (which I gather you did, based on your first tip. :P. I'm not sure of built in functions or anything yet, such as SortTPAFrom(), so I've been writing my own for them. >.<

    I'll post when I've made the changes!

    EDIT: My main concern is performance. Clarity knows, as he's one of my best friends, that I'm an efficiency freak. Could a custom function/method out-perform things like SortTPAFrom()?
    Last edited by Obscurity; 10-21-2014 at 09:32 PM.

  8. #8
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    EDIT: My main concern is performance. Clarity knows, as he's one of my best friends, that I'm an efficiency freak. Could a custom function/method out-perform things like SortTPAFrom()?
    I don't wanna get too off topic, but since you're OP and you mentioned it, it's pretty on topic I think.

    You're using this for RS right? I've never really understood why people obsessed over efficiency in RS. There are extremely limited cases where you'll have HUGE arrays of data, and the actual limiting factor is almost always how long it takes to click something, or to move somewhere, or an RS animation. I wrote up a timer for my evergreen chopper which timed how long it took to find the tree and click on it. It took roughly 1s from detecting the tree was gone to clicking the new tree. It took ~1s just to move the mouse. The whole find colours, sort TPA, split TPA, sort ATPA, debug ATPA, etc all was in the time it took to write in the debug that the finder was starting and for my eyes to notice it happened.

    So sure you might write a better way to sort TPAs, but unless you're clicking blades of grass and have 1TB of TPA data, you're not going to notice any performance issue in RS. I have a script now that runs 10,000s of iterations of data analysis in the blink of an eye, there's probably measurable time to do it, but nothing that effects RS performance at all.

    Things like this are best approached with the 80/20 rule. 20% of the effort gets you 80% of the gains. The other 80% of the effort is only to get the final 20% gains. You've got some great code here, don't waste 80% of your time making ms gains in functions that exist when the actual RS time it takes is 2 seconds.
    Last edited by 3Garrett3; 10-21-2014 at 10:29 PM. Reason: Olly told me 1MB wasn't a big TPA so I changed it to 1TB

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  9. #9
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    EDIT: My main concern is performance. Clarity knows, as he's one of my best friends, that I'm an efficiency freak. Could a custom function/method out-perform things like SortTPAFrom()?
    For TPA sorting you aren't going to make it faster due to compiled code (Simba's) vs non compiled (Lape).
    There are things in Simba that you can outperform in Lape though.

    Quote Originally Posted by 3Garrett3 View Post
    So sure you might write a better way to sort TPAs, but unless you're clicking blades of grass and have 1MB of TPA data,
    1MB is equal to a TPA length of 13,000. Not much
    Last edited by Olly; 10-21-2014 at 10:20 PM.

  10. #10
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    EDIT: My main concern is performance. *..snip..*. Could a custom function/method out-perform things like SortTPAFrom()?
    SortTPAFrom is efficent, there is close to no way to get any decent speedup there. At best with compiled and highly optimized code you would get it a few percent faster (considering random data). SortTPAFrom is also compiled (to machine code), so any interpreted sorting function (written in lape/simba) which does the same thing will never achieve the same speed.

    You should look for bottlenecks elsewhere.


    As a side-note:
    Quote Originally Posted by Obscurity View Post
    ...
    Now, I needed some methods that returned the closest tPoint, glModel, or glTexture to a given tPoint. So:

    closest():
    Simba Code:
    ...
      function tPoint.closest(aOP:tPointArray):tPoint;
        var
          aOPIndex:cardinal=0;
          closestDistance,
            distance:extended=2147483647;
        begin
          for aOPIndex to length(aOP)-1 do
            begin
              if ((distance:=sqrt(pow(aOP[aOPIndex].x-self.x,2)+pow(aOP[aOPIndex].y-self.y,2)))<closestDistance) and (not (distance=0)) then
                begin
                  closestDistance:=distance;
                  result:=aOP[aOPIndex];
                end;
            end;
        end;

    ...
    Something like this would likely be around 2x faster then the above.
    - Power is an expensive way to compute "x*x", use Sqr(x) or simply write "x*x".
    - Sqrt is simply not needed. Squared euclidean is all you need for comparison.
    Simba Code:
    function TPoint.Closest(Arr:TPointArray): TPoint;
    var
      idx:Int32;
      closestDistance, distance: Double;
    begin
      if Length(Arr) = 0 then Exit();
      closestDistance := Sqr(Arr[0].x-self.x) + Sqr(Arr[0].y - self.y);
      Result := Arr[0];
      for idx:=1 to High(Arr) do
      begin
        distance := Sqr(Arr[idx].x-self.x) + Sqr(Arr[idx].y - self.y);
        if (distance < closestDistance) then
        begin
          closestDistance := distance;
          Result := Arr[idx];
          if closestDistance = 0 then Exit();
        end;
      end;
    end;
    Last edited by slacky; 10-21-2014 at 10:58 PM.
    !No priv. messages please

  11. #11
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    Quote Originally Posted by Olly View Post
    1MB is equal to a TPA length of 13,000. Not much
    Hey I just made up a random number there! I'm sure all of the other wisdom is correct though

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

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

    Default

    Is there already a sortGLMAFrom()? Or sortGLTAFrom()? Where they sort a glModelArray or glTextureArray by distance form a tPoint?

    Also, is there already a built-in concat()?

    Sorry if I'm asking dumb questions - I've always gone with custom functions/methods.

  13. #13
    Join Date
    Feb 2012
    Location
    Norway
    Posts
    995
    Mentioned
    145 Post(s)
    Quoted
    596 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    Is there already a sortGLMAFrom()? Or sortGLTAFrom()? Where they sort a glModelArray or glTextureArray by distance form a tPoint?

    Also, is there already a built-in concat()?

    Sorry if I'm asking dumb questions - I've always gone with custom functions/methods.
    You have yet to define this data-types for us.
    If they are equal to TPointArray structure-wise, you can simply cast it to a TPointArray, and sort it using any TPA-sorting function, but I doubt this is the case.
    So if not.. then you have to write it your self.

    concat? as in combine/merge?
    That depends on which datatype we are talking about.. If it's a TPA you could use CombineTPA. For anything else a simple call to SetLength and a call to MemMove is all you need (roughly), or you could use Insert(Arr2, Arr, Length(Arr));.


    Also what is up with stacking a bunch of code in to one line for no reason? It only makes it harder to go through.
    like, really??:
    pascal Code:
    ...
      function glTexture.randomizePoint(randomizeByX:integer;randomizeByY:integer):tPoint;overload;
        var
          halfRandomizeByX,
            halfRandomizeByY:integer;
        begin
          result:=point(self.x+random((halfRandomizeByX:=ceil(randomizeByX/2))*-1,halfRandomizeByX),self.y+random((halfRandomizeByY:=ceil(randomizeByY/2))*-1,halfRandomizeByY));
        end;
    Why would you do that?
    Last edited by slacky; 10-22-2014 at 11:11 AM.
    !No priv. messages please

  14. #14
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by slacky View Post
    You have yet to define this data-types for us.
    Simba Code:
    type glTexture = record
      ID: Integer;
      ColourID: Integer;
      FullColourID: Integer;
      X, Y: Integer;
      Bounds: TBox;
    end;

    type glModel = record
      ID: Cardinal;
      TID: Integer;
      X, Y: Integer;
    end;

    type
      glModelArray = array of glModel;
      glTextureArray = array of glTexture;

    @Obs, @Brandon wrote the original GLX includes so he might know more about whether these functions you're asking about exist.
    Last edited by Clarity; 10-21-2014 at 11:35 PM.

  15. #15
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    No there's definitely no function in simba to sort the ogl records directly.
    You have to convert the records to tpa then sort it with SortTPAFrom()
    This is what i do:
    Simba Code:
    function glTextureArray.toTPA: TPointArray;
    var
      i, highGt: Integer;
    begin
      highGt:= High(Self);
      SetLength(Result, highGt + 1);
      for i:=0 to highGt do
        Result[i]:= Point(Self[i].X, Self[i].Y);
    end;

    function glTextureArray.toTPA(ID: Integer): TPointArray; overload;
    var
      i, highGt, c: Integer;
    begin
      highGt:= High(Self);
      SetLength(Result, highGt + 1);
      for i:=0 to highGt do
        if self[i].ID = ID then
        begin
          Result[c]:= Point(Self[i].X, Self[i].Y);
          Inc(c);
        end;

      SetLength(Result, c);
    end;

    function glModelArray.toTPA: TPointArray;
    var
      i: Integer;
    begin
      SetLength(Result, Length(self));
      for i:=0 to High(Self) do
        Result[i]:= Point(Self[i].X, Self[i].Y);
    end;

    function glModelArray.toTPA(ID: Cardinal): TPointArray; overload;
    var
      i, highGm, c: Integer;
    begin
      highGm:= High(Self);
      SetLength(Result, highGm + 1);
      for i:=0 to highGm do
        if self[i].ID = ID then
        begin
          Result[c]:= Point(Self[i].X, Self[i].Y);
          Inc(c);
        end;

      SetLength(Result, c);
    end;

    function glModelArray.toTPA(ID: Cardinal; area: TBox): TPointArray; overload;
    var
      i, c: Integer;
    begin
      SetLength(Result, Length(self));
      for i:=0 to High(Self) do
        if (self[i].ID = ID) and PointInBox(Point(self[i].x, self[i].y), area) then
        begin
          Result[c]:= Point(Self[i].X, Self[i].Y);
          Inc(c);
        end;

      SetLength(Result, c);
    end;
    All that would take less than 1 ms for most arrays taken from RS.

    As you can see i'm an efficiency freak as well (i assign High(self) do a variable first to avoid the for loop having to repeated call it, though afterwards i learnt that lape already does this https://villavu.com/forum/showthread.php?t=110550 so it isnt actually necessary for lape, only for PS)

    Quote Originally Posted by 3Garrett3 View Post
    I don't wanna get too off topic, but since you're OP and you mentioned it, it's pretty on topic I think.

    You're using this for RS right? I've never really understood why people obsessed over efficiency in RS. There are extremely limited cases where you'll have HUGE arrays of data, and the actual limiting factor is almost always how long it takes to click something, or to move somewhere, or an RS animation. I wrote up a timer for my evergreen chopper which timed how long it took to find the tree and click on it. It took roughly 1s from detecting the tree was gone to clicking the new tree. It took ~1s just to move the mouse. The whole find colours, sort TPA, split TPA, sort ATPA, debug ATPA, etc all was in the time it took to write in the debug that the finder was starting and for my eyes to notice it happened.
    1s! u would laugh if i tell u sometimes i wrote almost double the code just to avoid having to call glGetModel()/glGetTextures() more than once to save about 30ms...

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

    Default

    Updated the Simba file again. Not quite finished, but is all I have time for tonight.

    After I really like your function glModelArray.toTPA(ID:Cardinal):TPointArray;overlo ad;, riwu. Would you mind if I added it - credited, of course.

  17. #17
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    Updated the Simba file again. Not quite finished, but is all I have time for tonight.

    After I really like your function glModelArray.toTPA(ID:Cardinal):TPointArray;overlo ad;, riwu. Would you mind if I added it - credited, of course.
    Sure np

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

    Default

    Updated yet again.

    Changes:
    • Added a number of distanceFrom() methods
    • Added randomizePointEllipse(diameter:integer):tPoint;ove rload;
    • Added randomizePointEllipse(diameterX:integer;diameterY: integer):tPoint;overload;
    • Changed closest() and closestTo(). Neither will return an array, sorted by closest to furthest. Instead, if you wish to find the second/third/etc closest, use:
    Simba Code:
    point(400,300).closest(arrayOfModels,1); //~ Second closest
    arrayOfModels.closestTo(point(400,300),2); //~ Third closest
    • Fixed issues where empty arrays were passed to methods such as glModelArray.closestTo(tPoint); or tPoint.closest(glTextureArray);


    Various other changes. Just look at the examples in the Simba file.
    Last edited by Obscurity; 10-24-2014 at 07:56 PM.

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

    Default

    I noticed that GL_MMBounds() was not only out of date, but when updated with new texture IDs it would return incorrect results when the map is tall but skinny (less then roughly 250px wide). The reason for this was the background texture would change when made skinny.

    So, I've added obsMiniMapBounds() and obsMiniMapBounds(glTextureArray) which will correctly locate the minimap, regardless of size.

    Also added a number of other methods that I needed. Some of which being, isBehindInterface() which will tell you if a point, model, or texture is behind the abilityBar, minimap, inventory, chat, or other basic interfaces. Again, if some already exist, sorry. I know Clarity's already mentioned (and I removed) a few on Skype that already exist.

    Edit:
    I thought I'd mention... The reason a few of my functions require a glTextureArray or such passed, is because my scripts lately follow the pattern below:
    • Retrieve all models and textures
    • Build a set of variables based on those
    • Perform actions based on the variables

    For example, a bare script may look like:
    Simba Code:
    var
      modelArray:glModelArray;
      textureArray:glTextureArray;
    //~ Etc etc etc...

    procedure lookForWarpedToroise;
    var
      closestWarpedTortoise:tPoint;
    begin
      closestWarpedTortoise:=obsMiniMapMiddle(textureArray).closest(YELLOW_DOT_ID); //~ MAIN POINT: I just retrieved textures under 1MS ago... So just reuse textureArray to find the minimap middle
      mouse(closestWarpedTortoise.randomizePointEllipse(10),1);
    //~ Etc etc etc...

    procedure buildVariables
    begin
      modelArray:=glGetModels(usefulModels);
      textureArray:=glGetTextures(usefulTextures);

      isSoulSplitting:=(not textureArray.extractID(SOUL_SPLIT_ID).isEmpty);
    //~ Etc etc etc...

    procedure mainLoop;
    begin
      buildVariables;

      if (not has30Health) and (not isSoulSplitting) and hasPrayer then
        action:=@activateSoulSplit
      else if (not has30Health) and (not hasPrayer) and hasSuperRestore then
        action:=@drinkSuperRestore
      else if (not isOverloaded) then
        action:=@drinkOverload
      else if (not hasWarpedToroise) then
        action:=@lookForWarpedToroise;
      //~ Etc etc etc...

    I as running bots on a shitty laptop and old video card. Every time glGetModels/Textures was called, it added up and slowed it down drastically (Clarity knows). So, from then on (despite now using a desktop with dual GTX 760s now) I refuse to call them more then I have to.
    Last edited by Obscurity; 11-15-2014 at 11:11 PM.

  20. #20
    Join Date
    Dec 2011
    Posts
    2,147
    Mentioned
    221 Post(s)
    Quoted
    1068 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    For example, my mainLoop might look like:
    Simba Code:
    buildVariables;

    if (not has30Health) and hasPrayer then
      action:=@enableSoulSplit
    else if (not has30Health) and (not hasPrayer) and hasSuperRestore then
      action:=@drinkSuperRestore
    else if (not isOverloaded) then
     action:=@drinkOverload;
    //~ etc...
    Rorariipretty much any PvM leak uh oh uh oh.

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

    Default

    You would know, my fighters are much more advanced. .

  22. #22
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Almost the entire glx include is outdated...last update was 3 months ago.
    Even the texture id for compass (which is used for gl_LoggedIn) is outdated, new ID is 147885 (the one in include is 147839)

    I've pretty much remade the entire include, removing functions i dont ever use and adding/updating functions like
    Simba Code:
    function glTextureArray.getIndex(ID: Integer): Integer;
    var
      i: Integer;
    begin
      for i:= 0 to High(self) do
        if self[i].ID = ID then
          Exit(i);

      Result := -1;
    end;

    function glTextureArray.contains(ID: Integer): Boolean;
    begin
      Result := self.getIndex(ID) > -1;
    end;

    function GL_LoggedIn(gt: glTextureArray): Boolean; overload;
    begin
      Result:= gt.contains(147885);
    end;

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

    Default

    Yeah, I've got those added as well. The way I build my useful variables is... I have a file which contains useful IDs similar to:
    Simba Code:
    __glTextureMapArray:=[
             3786240,//~ Background
              147839,//~ Compass
              147885,//~ Compass
              237147,//~ Corner
              386460,//~ Corner
                3570,//~ Dot
                1275,//~ Flag
               63371 //~ World map
        ];
        __glTextureFiremakingArray:=[
             1396788,//~ Choose A Tool title
              118575,//~ Elder logs
              128520,//~ Log (Add to bonfire)
              122910,//~ Magic logs
              116280,//~ Maple logs
              116280,//~ Yew logs
               62985,//~ Baby dragon bones
               62985,//~ Big bones
               52275,//~ Bones
               52275,//~ Burnt bones
               84405,//~ Dagannoth bones
               84405,//~ Dragon bones
               84405,//~ Frost dragon bones
               52275,//~ Monkey bones
               84405,//~ Our bones
               52275,//~ Wolf bones
              105570 //~ Wyvern bones
        ];
    //~ Etc etc etc...
    ...Which I include in most scripts. And then I use:
    Simba Code:
    insert(__glTextureBankArray,usefulTextures);
        insert(__glTextureFiremakingArray,usefulTextures);
        insert(__glTextureMapArrayusefulTextures);
    That way, if an ID changes (like the compass has recently), one edit fixes all my scripts.



    Anyhow, another update today - added a furthest() method. Works the same as closest, only backwards. For example:
    Simba Code:
    furthestDot:=obsMiniMapMiddle().furthest(textureArray.extractID(3570));
     writeLN('The furthest dot from the player is at: ',toStr(furthestDot));
     //~ ----------------------------------------
     furthestDot:=obsMiniMapMiddle().furthest(textureArray.extractID(3570),2);
     writeLN('The third furthest dot from the player is at: ',toStr(furthestDot));

    Also updated a number of the closest, closestTo, etc to accept a wider range of parameters. I believe previously, closestTo() only accepted TPA.

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

    Default

    Another update! All new or edited methods, functions, or procedures have been bolded in the first post.

    I realize some of these exist, such as obsGetPercent*(), but mine are strictly OpenGL and do not read text from the screen.

    The biggest mention of this update is obsMinimapClickAngle() and obsMakeCompass.

    obsMakeCompass() functions much like GL_MakeCompass(). However, I don't think I need to mention why obsMakeCompass() is better then GL_MakeCompass(), but... GL_MakeCompass() presses and holds a directional key over and over, 50MS at a time, until it reaches the desired angle. Need I say more?

    obsMinimapClickAngle() is my favorite procedure to date. To describe it, I'll simply copy it's notes from the SIMBA file:
    Simba Code:
    {
     ========================================
     NOTE: The obsMinimapClickAngle
     procedures clicked a specified angle on
     the minimap. If angleRelative is true,
     the specified angle is offset by the
     camera's current position.

     Angle | Click
     0     | North
     90    | West
     180   | South
     270   | East
     360   | North

     EXAMPLES:
     ----------------------------------------
     writeLN('Walking somewhere south with a 90 degress tolerance...');
     obsMinimapClickAngle(180,90);
     ----------------------------------------
     writeLN('Walking somewhere up-left (regardless of current camera angle [angleRelative=false]) with a 45 degress tolerance...');
     obsMinimapClickAngle(45,45,false);
     ========================================
    }

    The first example from above will click anywhere in the green in the following screenshot. The second is red. Note the compass direction:


    It chooses a random point on the angle you provide, and walks your character to that point. it is careful not to click the buttons, such as world map.

    .extractColourID() now allows you to specify a colour tolerance.

    EDIT: Can I get the title changed to:
    [OGL] Methods/Functions/Procedures



    Enjoy!
    Last edited by Obscurity; 12-10-2014 at 01:30 AM.

  25. #25
    Join Date
    Jun 2014
    Location
    Lithuania
    Posts
    475
    Mentioned
    27 Post(s)
    Quoted
    200 Post(s)

    Default

    Quote Originally Posted by Obscurity View Post
    Another update! All new or edited methods, functions, or procedures have been bolded in the first post.
    Nice stuff!

    I was just wondering if for example there is a way to find for example frost dragon bone by open gl texture id if it is covered by for example other player or frost dragon. Or something similar accurately. Since traditional methods in some areas i am working in makes alot of mess especially in crowded ones. Tried to count damage done to get if my drop then count drop position on screen and if it doesnt see it in few seconds then roate screen... finding items covered would defitenely help alot.

Page 1 of 5 123 ... LastLast

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
  •