Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Resolved What do these arguments do?

Joined
Sep 7, 2016
Messages
48
Ive seen alot of "!" and "! = " used for coding, i wonder what they actually do, could anyone help me? thanks
 
Joined
Jun 9, 2015
Messages
3,735
Means "is not" and "not equal to"

Example:
!object.isValid() ; is not valid

Example:
tree != null ; tree is not null
 
Last edited:
Joined
Jun 9, 2015
Messages
3,735
Ok thanks i dont understand but i try my best to grasp it
Ok.

Let's say you want to check if there's a nearby tree to chop.
GameObject tree = GameObjects.newQuery().names("Tree").results().nearest();
This will look for a tree that is closest to the player.

After that, you want to do:
if(tree != null)
Why?
To check if there's an actual tree around the player. If there is no tree, and you try to interact with it, it will return null, resulting in an error. That's why you do the != check.

Does that clear up some stuff for you? :)
 
Joined
Sep 7, 2016
Messages
48
Ok.

Let's say you want to check if there's a nearby tree to chop.
GameObject tree = GameObjects.newQuery().names("Tree").results().nearest();
This will look for a tree that is closest to the player.

After that, you want to do:
if(tree != null)
Why?
To check if there's an actual tree around the player. If there is no tree, and you try to interact with it, it will return null, resulting in an error. That's why you do the != check.

Does that clear up some stuff for you? :)
Yes thanks alot! I have another doubt could you clear it for me?

Could you tell me what each lines do? thanks, its an open source code of Mudrune grinder by bertrand.

Execution.delayUntil(() -> Interfaces.newQuery().containers(1371, 1370).visible().results().size() != 0);
if (Interfaces.newQuery().containers(1371, 1370).visible().results().size() != 0) {
Execution.delay(2500, 3000);
Keyboard.typeKey(KeyEvent.VK_SPACE);
Execution.delay(2500, 3000);
GameObjects.getLoaded().random().hover();
Execution.delayUntil(() -> Interfaces.newQuery().containers(1251).visible().results().size() == 0);
 
Joined
Oct 5, 2016
Messages
28
Ok.

Let's say you want to check if there's a nearby tree to chop.
GameObject tree = GameObjects.newQuery().names("Tree").results().nearest();
This will look for a tree that is closest to the player.

After that, you want to do:
if(tree != null)
Why?
To check if there's an actual tree around the player. If there is no tree, and you try to interact with it, it will return null, resulting in an error. That's why you do the != check.

Does that clear up some stuff for you? :)

Thanks, though I don't understand anything about programming, I understood this bit :)
 
Top