Post Wednesday, 1st April 2015, 09:55

Finding messages since last turn in CLUA?


I hope CLUA questions are OK on this board. I'm looking to make my automated functions in my rcfile a little more aware of my surroundings, so that (for instance) my char won't automatically eat chunks when I just walked around the corner from a monster. For that, I'd have to know what happened in which turn so I can guesstimate how far from danger I am, but unfortunately, no way to do this in seems to be exposed in CLUA. crawl.messages calls get_recent_messages, which empties the full buffer, and what I think is the more appropriate function (get_last_messages) isn't accessible. crawl.clear_messages(true) doesn't seem to do anything, either.

So I'm sorta lost. Is there any way to do this? I can't think of a good trick that would be gracefully handled by the server, either (string.gsub seems to be expensive), and I don't want to go slow other people's games by experimenting too much.

Thanks in advance!

Edit: Oh, and a side question: Is there a way to get all visible monsters in an array or something? I've seen that HDA scans the entire 8x8 grid every round, which seems taxing as well.