How to afk while in-game on Runescape?
The game will log you out automatically after a period of time of inactivity. There's no in-game way around that.
You can use a macro to force activity, however, that method is against the rules, and has a decent chance of being detected. I do not advise, endorse, or recommend this method, and as such, I have not included links to any such macro software.
Other than that, though, there is no way to keep you logged in while AFK. Your best bet is just to be patient and let things happen during regular gameplay.
While it is against the game rules to use software methods to prevent automatic logout, hardware methods are specifically allowed. Because moving your mouse on the game screen resets the timer, rigging up a device to jiggle it (or my favorite: hanging an optical mouse in front of a fan) is a legitimate way to stay logged in for longer periods of time.