Jump to content
deva

Get name of variable

Recommended Posts

@deva I doubt this is exactly what you were looking for, which is impossible within TRiBot, but this may be of use.

    public static RSArea LUMBRIDGE = new RSArea(new RSTile[]{new RSTile(3216, 3222, 0), new RSTile(3216, 3216, 0)});

    public static HashMap<RSArea, String> areaNames = new HashMap<>();
    static {
        areaNames.put(LUMBRIDGE, "Lumbridge:");
        areaNames.put(LUMBRIDGE_SWAMP, "Lumbridge swamp");
        areaNames.put(VARROCK_SQUARE, "Varrock square");
        areaNames.put(VARROCK_WEST_BANK, "Varrock West bank");
    }

    public static void printLocation(RSArea area) {
        
        General.println(areaNames.get(area));
    }

Adding all your locations to a HashMap that links a String to an RSArea could be one way of doing it. Alternatively if you wanted this to work for any Object, simply replace RSArea with Object and it should still work fine. That being said you still need to manually add in all the names so I wouldn't do this for all variables, just for things you might want to debug.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×