Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Try asking for help in the chatbox
  • Mouse Crosshair Enum


    Explicit
     Share

    Recommended Posts

    /**
     * Created with IntelliJ IDEA
     * User: Anthony
     * Date: 12/11/14
     */
    
    public enum OSCrosshair {
    
        /**
         * #ordinal corresponds with the crosshair index
         */
    
        NONE, DEFAULT, ACTION
    
    }
    

    Example use:

    public boolean didSuccessfullyInteract() {
        return getMouse().getCrosshairColor() == OSCrosshair.ACTION.ordinal()
    }
    

    Obviously use #getLastCrosshairColor or even write another method if checking after the crosshair has disappeared.

    Link to comment
    Share on other sites

    No it's not, an enum makes perfect sense here. Hardcoding these values into your code is a beyond awful way to do things.

    But aren't you essentially hard coding it anyway with the 

    return getMouse().getCrosshairColor() == OSCrosshair.ACTION.ordinal()

     

    ?

    Also we definitely have constants with the numbers for variable name recognition. I dunno if they got obfuscated or not though.

    Link to comment
    Share on other sites

    Kek

    the ordinals get rekt if u guys use proper obfuscation

    sorry m8 but probably won't work

    (Never use ordinal dude :-(, store it in a variable instead )

    Titties, I forgot about obfuscation.

     

    But aren't you essentially hard coding it anyway with the 

    return getMouse().getCrosshairColor() == OSCrosshair.ACTION.ordinal()

     

    ?

    Also we definitely have constants with the numbers for variable name recognition. I dunno if they got obfuscated or not though.

    How is that hard coded? If the action index changes I merely have to change the enum constant, unlike if I put the exact number in where I would have to search my code for all uses.

    Edited by Swizzbeat
    Link to comment
    Share on other sites

    Titties, I forgot about obfuscation.

     

    How is that hard coded? If the action index changes I merely have to change the enum constant, unlike if I put the exact number in where I would have to search my code for all uses.

    tru. But if you're using it in one method

    than you'd only have to change it in one place anyway

    So you have the same amount of changes.

    I dunno. I consider that hard coding.

    I wouldn't if you set variables in the enums.

    Or if you set it as a variable.

    but enum.ordinal()?

    I dun like it. rip

    Link to comment
    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
     Share

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.