Resolved What do these arguments do?

Discussion in 'Developer Support' started by Fibbz, Oct 16, 2016.

  1. Fibbz

    Joined:
    Sep 7, 2016
    Messages:
    48
    Likes Received:
    2
    Ive seen alot of "!" and "! = " used for coding, i wonder what they actually do, could anyone help me? thanks
     
  2. Best Answer:
    Post #2 by RobinPC, Oct 16, 2016
  3. RobinPC

    RobinPC The work is what matters.

    Joined:
    Jun 9, 2015
    Messages:
    776
    Likes Received:
    202
    Means "is not" and "not equal to"

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

    Example:
    tree != null ; tree is not null
     
    #2 RobinPC, Oct 16, 2016
    Last edited: Oct 16, 2016
  4. Fibbz

    Joined:
    Sep 7, 2016
    Messages:
    48
    Likes Received:
    2
    Ok thanks i dont understand but i try my best to grasp it
     
  5. RobinPC

    RobinPC The work is what matters.

    Joined:
    Jun 9, 2015
    Messages:
    776
    Likes Received:
    202
    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? :)
     
    Cloud likes this.
  6. Fibbz

    Joined:
    Sep 7, 2016
    Messages:
    48
    Likes Received:
    2
    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);
     
  7. Haisaku

    Joined:
    Oct 5, 2016
    Messages:
    28
    Likes Received:
    3
    Thanks, though I don't understand anything about programming, I understood this bit :)
     
  8. Fibbz

    Joined:
    Sep 7, 2016
    Messages:
    48
    Likes Received:
    2
    Bump, could someone explain those lines? ty again
     

Share This Page

Loading...