Thread: [Any Revision Ish] Hover ID's for entities, items, and objects.

Results 1 to 9 of 9
  1. #1 [Any Revision Ish] Hover ID's for entities, items, and objects. 
    Donator

    Join Date
    Feb 2017
    Posts
    104
    Thanks given
    0
    Thanks received
    14
    Rep Power
    46
    This is a small utility snippet you can add to your client to make ID's visible on hover for items, npcs, and objects. It amazes me how long I did this by editing the on screen menu drawing method -face wall-.

    Spoiler for Show Code:

    Code:
    package com.client.interface.osm;
    
    import com.client.ItemDef;
    import com.client.EntityDef;
    import com.client.ObjectDef;
    
    /**
     * @Author XScapeRSPS
     * This is a small class which reloads entity, item, and object definitions granting the player visible ID's by means of hovering.
     *
     * Note: You must place new ActiveHoverID(); somewhere it will only load once after all entities items and object definitions have loaded.
     * Note: You may need to correct imports or fix the @variable's listed below.
     */
    public class ActivateHoverID {
    
        public ActivateHoverID() {
            onLoad();
        }
    
        /**
         * @variable EntityDef.streamIndices.length - think of this as npc_count in my client. Yours may be named differently.
         * You should be able to find a similar variable at EntityDef.forID(i);
         * @see EntityDef
         *
         * @varaible ItemDef.totalItems - Same as above except applicable to items. You can find this in the same place to except in ItemDef.java
         * @see ItemDef
         *
         * @varaible ObjectDef.streamIndices.length - Same as above except applicable to items. You can find this in the same place to except in ObjectDef.java
         * @see ObjectDef
         *
         * Note: If for whatever reason you just can't get these variables to work change the variables to a number, 30_000 is usually high enough, and enclose
         * each for statement in a try-catch block with no print statement. This should be fine since you are only loading it once and you won't even login
         * before the processing completes.
         */
        private void onLoad() {
            final int entityCount = EntityDef.streamIndices.length;
            for (int i = 0; i < entityCount; i++) {
                final EntityDef entityDef = EntityDef.forID(i);
                if(entityDef != null)
                    entityDef.name += parentheticalWrap(i);
            }
    
            for (int i = 0; i < ItemDef.totalItems; i++) {
                final ItemDef itemDef = ItemDef.forID(i);
                if (itemDef != null)
                    itemDef.name += parentheticalWrap(i);
            }
    
            final int objectCount = ObjectDef.streamIndices.length;
            for (int i = 0; i < objectCount; i++) {
                final ObjectDef objectDef = ObjectDef.forID(i);
                if (objectDef != null)
                    objectDef.name += parentheticalWrap(i);
            }
        }
    
        /** Adds coloring and parenthesis. **/
        private String parentheticalWrap(int id) {
            return " @whi@(@gre@" + id + "@whi@)";
        }
    
    }
    Reply With Quote  
     

  2. #2  
    Rune-Server Affiliate

    Join Date
    Apr 2014
    Posts
    1,761
    Thanks given
    75
    Thanks received
    714
    Rep Power
    1073
    uhhhhhh

    r u ok? can literally just do:

    MiniMenu.addOption("Examine", "@lre@" + itemDefinition.name + itemDefinition.id, 1448, item.id, i1, j1, 0);


    not sure wtf you are doing in this snippet lol
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Banned
    Join Date
    Dec 2017
    Posts
    47
    Thanks given
    47
    Thanks received
    30
    Rep Power
    0
    Confused
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Apr 2015
    Posts
    225
    Thanks given
    127
    Thanks received
    48
    Rep Power
    39
    This has been done before if you search.
    - -
    Reply With Quote  
     

  6. #5  
    Im an albatraoz

    Nand0's Avatar
    Join Date
    Feb 2010
    Age
    31
    Posts
    948
    Thanks given
    233
    Thanks received
    128
    Rep Power
    241
    I've done it like this for ages

    menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (myRights == 4 ? " (" + itemDef.id + ")" : "");



    Looking for blazing fast and affordable vps or web hosting?
    AllGeniusHost



    Reply With Quote  
     

  7. Thankful user:


  8. #6  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Quote Originally Posted by Nand0 View Post
    I've done it like this for ages

    menuActionName[menuActionRow] = "Examine @lre@" + itemDef.name + (myRights == 4 ? " (" + itemDef.id + ")" : "");
    Yea, that's how everyone does it afaik. But this snippet will loop through all npcs, objects, and items and add their id to the name String. So then you don't need to make it have the id at the end of each menuaction.
    Reply With Quote  
     

  9. Thankful users:


  10. #7  
    Im an albatraoz

    Nand0's Avatar
    Join Date
    Feb 2010
    Age
    31
    Posts
    948
    Thanks given
    233
    Thanks received
    128
    Rep Power
    241
    Quote Originally Posted by Hitten View Post
    Yea, that's how everyone does it afaik. But this snippet will loop through all npcs, objects, and items and add their id to the name String. So then you don't need to make it have the id at the end of each menuaction.
    Can this increase performances overall when using a developer account?
    Reply With Quote  
     

  11. #8  
    ¯\_(ツ)_/¯


    Join Date
    Jul 2014
    Posts
    1,803
    Thanks given
    928
    Thanks received
    550
    Rep Power
    299
    Quote Originally Posted by Nand0 View Post
    Can this increase performances overall when using a developer account?
    Technically yes, because it will pre-load the ids to the object name and client will not need to check if the account is a developer when loading the menu actions.
    Reply With Quote  
     

  12. #9  
    Im an albatraoz

    Nand0's Avatar
    Join Date
    Feb 2010
    Age
    31
    Posts
    948
    Thanks given
    233
    Thanks received
    128
    Rep Power
    241
    Quote Originally Posted by Hitten View Post
    Technically yes, because it will pre-load the ids to the object name and client will not need to check if the account is a developer when loading the menu actions.

    Hmmm i was going to say ill add it but it will give the disadvantage while changing objects.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 3
    Last Post: 06-16-2018, 12:47 AM
  2. Replies: 7
    Last Post: 12-26-2015, 07:12 PM
  3. Replies: 2
    Last Post: 08-15-2012, 06:26 PM
  4. Multiple ID's for same item for custom stats?
    By snwspeckle in forum Help
    Replies: 0
    Last Post: 01-18-2011, 12:22 AM
  5. Replies: 6
    Last Post: 09-30-2009, 10:00 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •