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 [OSRS] Runescape.isLoggedIn() = true in "lobby screen"?

Joined
Dec 24, 2018
Messages
29
I'm not sure if this is supposed to be the case but Runescape.isLoggedIn() returns true in the "lobby screen" (not sure how this screen is called before you get into the game). This messes up my bot since onLoop starts executing before the character is ready.

What's the proper way to check whether the player is truly logged in?
 
Last edited:
Joined
Dec 24, 2018
Messages
29
Potentially janky and not the most efficient but should work: check if the player is visible after the null check

This works perfectly, thanks. Just wondering, am I doing something unusual here? If this is the janky way, is there any "proper" way to do it?

Also, I just realized Execution.delayUntil also delays the log in process. So basically delaying until the player is logged in will delay forever, since nothing is happening. Is there any way to strictly delay my onStart and/or onLoop code without stopping the client from logging in?
 
cuppa.drink(java);
Joined
Mar 13, 2018
Messages
7,097
This works perfectly, thanks. Just wondering, am I doing something unusual here? If this is the janky way, is there any "proper" way to do it?

Also, I just realized Execution.delayUntil also delays the log in process. So basically delaying until the player is logged in will delay forever, since nothing is happening. Is there any way to strictly delay my onStart and/or onLoop code without stopping the client from logging in?
I don't think you're doing anything unusual, I just haven't botted much in a while and I don't remember if there's a better way.
For your delay, you should only delay briefly and then return to let the bot cycle again and log in
 
Joined
Dec 24, 2018
Messages
29
I don't think you're doing anything unusual, I just haven't botted much in a while and I don't remember if there's a better way.
For your delay, you should only delay briefly and then return to let the bot cycle again and log in

No worries, I appreciate it either way. The problem is the delay is pointless if it stops the login process. I don't want onLoop to execute before the player is logged in.
 
cuppa.drink(java);
Joined
Mar 13, 2018
Messages
7,097
No worries, I appreciate it either way. The problem is the delay is pointless if it stops the login process. I don't want onLoop to execute before the player is logged in.
Ye, but just add a check at the beginning of the loop right?

Like as your first line in your loop have
if((p=Players.getLocal())==null || !p.isVisible()){
return emptyLeafTaskObject;
}

or if you're using looping bot, the equivalent to make the bot return

I think that would work?
 
Joined
Dec 24, 2018
Messages
29
Ye, but just add a check at the beginning of the loop right?

Like as your first line in your loop have
if((p=Players.getLocal())==null || !p.isVisible()){
return emptyLeafTaskObject;
}

or if you're using looping bot, the equivalent to make the bot return

I think that would work?

Yeah that works :)

I was kinda just hoping for a method that I could call in onStart that stops onLoop from starting before the player is logged in, so I can avoid doing this check every tick. But no big deal if there's no such thing, I just felt like it would make sense if onLoop started once the player is logged in.
 
Top