I have a regular expression that is working how I want it to work. The regular expression looks to see if there is a corpse in the room, and if there is, I can "search corpse" to find treasure. The regular expression is as follows:
However, if there are mobs in the room, I don't want to take the time to search the corpses until after the mobs are dead. This is just due to how the timing in the game works. If I'm searching corpses while other mobs are in the room, they can attack me. So it doesn't make sense to search them until the room is clear.
Here is a text sample for when I should NOT be taking the time to search corpses.
Because that "M - " line exists, I should NOT search corpses. But after the troll and gnoll are dead...
It is now ok to search corpses because that "M - " line no longer exists.
I'm not sure how to modify the regular expression so that it will:
^There is a (.*)corpse(.*?)|(.*?)corpse here.|(.*?)a corpse,(.*?)$However, if there are mobs in the room, I don't want to take the time to search the corpses until after the mobs are dead. This is just due to how the timing in the game works. If I'm searching corpses while other mobs are in the room, they can attack me. So it doesn't make sense to search them until the room is clear.
Here is a text sample for when I should NOT be taking the time to search corpses.
[]
[]M
[] ^
[] x
[]$
[] ^
M - troll, gnoll
There is a longsword and a corpse here.Because that "M - " line exists, I should NOT search corpses. But after the troll and gnoll are dead...
[]
[]
[] ^
[] x
[]$
[] ^
There is a longsword, a corpse, and a corpse here.It is now ok to search corpses because that "M - " line no longer exists.
I'm not sure how to modify the regular expression so that it will:
IF ("M - " does not exist) AND (corpses are in the room) THEN
Send ("search corpse")
ELSE
keep fighting