Jump to content
Dogcube

MossGiantScriptDogcube

Recommended Posts

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?

 

Link to post
Share on other sites

@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/

Link to post
Share on other sites
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 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...