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
  • Mouse Crosshair Enum


    Explicit

    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

    enum is a waste but easier to understand then 0,1,2

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

    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 )

    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.

    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

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • 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.