Jump to content

I don't understand this, im noob):


Recommended Posts

Posted

Where I have the red line (This is Apa's tea thiever guide, was reading it line by line to try and learn)

Few questions,

1) Why does the script there say to drop when the inventory is empty (If this was correct in the tutorial ?)

2) I was gonna try and make my own walking to bank and walk back, would this be using the walk entity feature, or what part of the API do i utilize to try this? (Using the cake stall, and replaced the entity of tea stall with cake , thats it so far.

3)Why is the empty inventory in the onstart instead of onloop, is that to clear the inventory when the script is starting?

4) Maybe I missed this in the guide, what is "case" ?

f07534c2c43549ba80a9c44268660066.png

 

 

Posted (edited)
if (!getInventory().isEmpty()) {
    return State.Drop;
}

Means if the inventory is NOT empty. The ! is a negator to booleans

boolean bool = true;
if (bool) {
// do if true
}

if (!bool) {
//do if false
}

For walking I recommend using webWalker for longer distances where obstacles may be in your way

getWalking().webWalk(Banks.ARDOUGNE_SOUTH)

and for shorter distances where doors etc arent a problem use walk instead.

Edited by Hereweald
Posted (edited)
if (!getInventory().isEmpty()) {
    return State.Drop;
}

Means if the inventory is NOT empty. The ! is a negator to booleans

boolean bool = true;
if (bool) {
// do if true
}

if (!bool) {
//do if false
}

I assumed the ! means opposite, but wouldnt it just be wrote along the lines of isntEmpty ?

inventory.isntempty

over

!inventory.isempty

Edited by Drewyboyo
Posted (edited)

I assumed the ! means opposite, but wouldnt it just be wrote along the lines of isntEmpty ?

inventory.isntempty

over

!inventory.isempty

 

http://www.osbot.org/api

 

Read through the API, .isntEmpty() isn't a method.

Switch basically means switch around the different cases so:

switch(random(1, 30)) {
case 1:
//do if random(1, 30) produces 1
    break;
case 2:
//do if random(1, 30) produces 2
    break;
}

So for this if getState() method returns the State State.DROP; then it will call the Drop case and execute whatever is written in there.

 

and i think you are misreading, its not in the onStart() it is its own method.

Edited by Hereweald
Posted

Not knowing what '!' means is a pretty hard signal that you don't know much about Java. To be blunt, you need to learn a lot more before you will realistically know what you're doing.

I already knew it meant like the opposite, but to me it didn't make sense how the ! is infront of inventory and not isempty, because then I read it as opposite of inventory and not opposite of is empty and thats why it was confusing me :b

Posted

Not knowing what '!' means is a pretty hard signal that you don't know much about Java. To be blunt, you need to learn a lot more before you will realistically know what you're doing.

You mean any programming language?

 

@OP, I'd read through some Java guides before attempting to make your own script. Just because it ends up working doesn't mean you won't get banned (more to do with the API than Java in general).

Posted

You mean any programming language?

 

@OP, I'd read through some Java guides before attempting to make your own script. Just because it ends up working doesn't mean you won't get banned (more to do with the API than Java in general).

m8 im not worried about anti ban right now, no ones first script had antiban lol. everyone started somewhere.

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