Jump to content

I don't understand this, im noob):


Drewyboyo

Recommended Posts

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

 

 

Link to comment
Share on other sites

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

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

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

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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