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 Interacting with Gates and similar game objects not working

( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,410
Gate has option "Open"

My GameObjects query finds the gate no problem - confirmed by system print lines. But I can't interact with the gate at all. I've tried Camera.turnTo(gate) and it doesn't turn. I've tried gate.interact("Open"), gate.click(), gate.hover() and none of them do anything but I can see that the gate is being found from the query. I've tried do/while and Execution.delayUntils (with print lines in between to know that it's still in the loop) for the interactions to see if it's just clouse missclicking but no interaction is going on at all.

Code:
GameObject closedGate = GameObjects.newQuery().names("Gate").actions("Open").results().first();
if (closedGate != null) {

    System.out.println("Gate found.");
    Camera.turnTo(closedGate);
do {
                System.out.println("Opening gate");
                closedGate.interact("Open");
                Execution.delay(800,1000);
           } while (GameObjects.newQuery().names("Gate").actions("Close").results().isEmpty());


ps I know the do/while is a shotty way of interacting with the gate :rolleyes: but I'm using it now to make sure that it is atleast trying to interact. My log will confirm gate found and then loop "Opening gate" without any change.

Edit:
Simple fix and really a dumb mistake on my part. Turns out standing right beside the gate and using results().first() would instead return a gate across a space that I couldn't see, no matter what camera angle I took. Couldn't tell at first because there was no other gate in sight. Used results().nearest(), fixed the method.
 
Last edited:
Joined
Dec 10, 2014
Messages
3,255
Gate has option "Open"

My GameObjects query finds the gate no problem - confirmed by system print lines. But I can't interact with the gate at all. I've tried Camera.turnTo(gate) and it doesn't turn. I've tried gate.interact("Open"), gate.click(), gate.hover() and none of them do anything but I can see that the gate is being found from the query. I've tried do/while and Execution.delayUntils (with print lines in between to know that it's still in the loop) for the interactions to see if it's just clouse missclicking but no interaction is going on at all.

Code:
GameObject closedGate = GameObjects.newQuery().names("Gate").actions("Open").results().first();
if (closedGate != null) {

    System.out.println("Gate found.");
    Camera.turnTo(closedGate);
do {
                System.out.println("Opening gate");
                closedGate.interact("Open");
                Execution.delay(800,1000);
           } while (GameObjects.newQuery().names("Gate").actions("Close").results().isEmpty());

ps I know the do/while is a shotty way of interacting with the gate :rolleyes: but I'm using it now to make sure that it is atleast trying to interact. My log will confirm gate found and then loop "Opening gate" without any change.
So uhh, what's some example output?

Is it finding the gate?
Is it getting stuck in the loop?
Is it trying to interact once then stopping because there's another closed gate somewhere?

The code you've pasted isn't even a complete code block, you're missing the } for the if block, so we don't know if that's all that's in there or not.
 
Joined
Jan 1, 2015
Messages
272
get the location of the gate, then do #hover to see if has the option "open" or any option at allif not, then continue, otherwise click.

the code is sloppy and alot could be done to check weather its opnen or not before trying to click it
 
( ͡° ͜ʖ ͡°)
Joined
Mar 30, 2015
Messages
2,410
get the location of the gate, then do #hover to see if has the option "open" or any option at allif not, then continue, otherwise click.

the code is sloppy and alot could be done to check weather its opnen or not before trying to click it

A lot is checking if it's open or not, and checking location,etc. That's just a snippet of the actual interaction method, and edited a bit to incorporate a do/while in case the interaction just fails. Obviously not going to post the whole method, if only one part of it (with other parts accounted for, checked and working) is having problems. It was sloppy because I was essentially debugging.
 
Joined
Jan 1, 2015
Messages
272
obv we know the method for interaction but without seing the open gate method you are using then, we are blind to what if anything you are doing wrong.
 
Top