- Joined
- Mar 30, 2015
- Messages
- 2,410
- Thread Author
- #1
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.
ps I know the do/while is a shotty way of interacting with the gate 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.
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 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: