Jump to content

Deleted


Recommended Posts

Posted
1 hour ago, skillerkidos1 said:

Erm it’s not going to do anything all I see is like a few methods but nothing in your onLoop

did you test it?

 

1 hour ago, skillerkidos1 said:

Erm it’s not going to do anything all I see is like a few methods but nothing in your onLoop

did you test it?

do I just need to init it inside the onlooop?

 

Posted

@Dogcube Hid your reposts.

Methods like this 
 

private boolean needToHeal(){
        int healPercent = 45;
        if(healPercent > getHpPercent()){
            return true;
        }else{
            return false;
        }


    }

Can be simplified to this
 

private boolean needToHeal() {
        int healPercent = 45;
        return healPercent > getHpPercent();
    }

And make sure you use braces ( these -> {} ) on your if statements. Scripting tutorial linked below.

https://osbot.org/forum/topic/115124-explvs-scripting-101/

Posted
10 hours ago, Gunman said:

@Dogcube Hid your reposts.

Methods like this 
 


private boolean needToHeal(){
        int healPercent = 45;
        if(healPercent > getHpPercent()){
            return true;
        }else{
            return false;
        }


    }

Can be simplified to this
 


private boolean needToHeal() {
        int healPercent = 45;
        return healPercent > getHpPercent();
    }

And make sure you use braces ( these -> {} ) on your if statements. Scripting tutorial linked below.

https://osbot.org/forum/topic/115124-explvs-scripting-101/

Thanks for the tip I will make sure to keep it in mind for future scripts 

  • Dogcube changed the title to Deleted

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