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

    Posted
    /**
     * 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.

    Posted

    For those of us who may be unaware, please explain what a mouse crosshair is.

    Posted

    For those of us who may be unaware, please explain what a mouse crosshair is.

     

    It's the little crosshair that turns red to show you clicked something.

    Posted

    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.

    Posted

    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.

    Posted

    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 )

    Posted

    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.

    Posted

    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

    Posted

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

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

    Where is face palm emoticon

    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.