I use these 2 scripts together as a backup for the lack of targeting on ROTS.
Script 1, for targeting with the Space button.
if #g_game.getMonstersAround(3) >= 1 then
g_game.sendKey("Space")
end
auto(1000)
Script 2, for pausing the cavebot to kill monsters that you are targeting, and then resuming the cavebot when everything is dead.
if #g_game.getMonstersAround(1) >= 1 then setOption("Cavebot/Enabled", "false")
elseif #g_game.getMonstersAround(2) == 0 then setOption("Cavebot/Enabled", "true")
end
auto(1000)