Differentiating between event types, and displaying message for "Add State" command

Hello,
While making my game, I've run into two problems that I've tried to solve by scripting but have been stumped on for a while.

1. I have a script that randomly generates dungeons. What I want is for each room in the dungeon to have one event that is an enemy or the exit and one event that is neither of those things. How do I tell the difference between those types of events in a script? The closest I've gotten is doing it based on the event's ID, but I have no way to arrange them conveniently, I would have to manually put in the event IDs of the enemies and exits for each map.

2. I use the "Add State" command in common events often, but I fear it will confuse the player because it gives no indication when it happens in battle, just adding the state providing no text. How can I make this command during battle display the message of adding the state as if it was done by an attack? E.g. actor became poisoned.

Thanks to anyone who helps.
Well, I figured out #2 while this post was pending approval-turns out I had to use $scene and not something like $scene_windowbattle to call the methods of Scene_WindowBattle. Once I figured that out, I made a method there to push text then called it from the add_state command.

I am still stuck on #1 though.
1) depending on the options of your maker and the script you're using, this is usually determined by checking one of three possible places to store data in events:
- the name of the event
- the notefield of the event (only MV and later)
- a comment command at the beginning of the event

this all assumes that the events are copied from some master list, where you setup things with the correct data. then you go through the event array and its data and read out the correct field and analyse it.



2) not an answer but a comment
script commands are not everything. there are places where it is easier to use event commands as they handle a lot of the background tasks automatically.

I just had to write another post to someone who thought that javascript is always better at handling things like event commands, and your second post about the solution of your other problem reminds me of that.
The event command for adding a state should have the message handled automatically. There are cases where you have to use the script equivalents for their versatility, but if that is not neccessary then you should use event commands where possible.
1) depending on the options of your maker and the script you're using, this is usually determined by checking one of three possible places to store data in events:
- the name of the event
- the notefield of the event (only MV and later)
- a comment command at the beginning of the event
I tried using the name already, by making a method to return the name instance variable, but it couldn't actually return anything for some reason. I didn't know comments could be used like that-how would I access an event's comment?
The event command for adding a state should have the message handled automatically.
It doesn't.
the comment is stored as an event command with its own data, even if that event command basically is "do nothing". So you have to search through the command list of the event and extract it from there.

I know that several scripters made this easier for themselves by declaring that they will only check the first command for comment and content.
So what would be the script to check if a certain event has its first line be a certain command?

Original thread: https://forums.rpgmakerweb.com/threads/differentiating-between-event-types-and-displaying-message-for-add-state-command.148004/