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
  • Lag issues with enum State


    Before

    Recommended Posts

    Posted

    I have a long series of

    if (getState() == state.STATE1)
            {
                return "STATE1";
            }
    

    And it creates a tremendous amount of lag. I'm probably doing something wrong (and tbh it's not that important, it's just for a paint). Does anyone have an idea of what I could be doing wrong?

     

    Edit: I just did a super easy workaround idk why I was even doing this shit in the first place.

    Posted


    if (getState() == state.STATE1){
    return "STATE1";
    }



    Posted
    if (getState() == state.STATE1){
                return "STATE1";
    }
    
    
    

    Well I mean that's what I did

    Posted

    Well I mean that's what I did

     

    if (getState() == state.STATE1)
            {
                return "STATE1";
            }
    
    Posted

     

    Dude they're legit the same you put the sqiggly bracket on a line above it's identical

    Posted

    Paint can cause lag because it "loops" very fast, so it makes all calculations as fast as it can.

    (ofc i don't know the real technical explaination)

     

     

    anyways you should just do

    return getState().toString();
    
    Posted

     

    Paint can cause lag because it "loops" very fast, so it makes all calculations as fast as it can.

    (ofc i don't know the real technical explaination)

     

     

    anyways you should just do

    return getState().toString();
    

    why even return the string? just return the enum type.

    Posted

    why even return the string? just return the enum type.

    because your paint doesn't paint enums  :P

    Posted

    For every if statement that you have of that nature, it is running your getState method once. So if you stored the state like private State (or whatever the enum is called) currentState; and then did currentState = getState(); then just check what currentState is.

    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.