This is what I use to test if the first line is a comment.
module CP
def self.first_comment(event, comment)
return (event.list.is_a?(Array) && event.list[0].code == 108 &&
event.list[0].parameters[0] == comment)
end
end
I use first line only because checking every line in all events on the map can create a massive lag problem. This here is the alternative that checks ALL lines which I, of course, don't recommend :
module CP
def self.event_comment(event, comment)
return (event.list.is_a?(Array) &&
event.list.any? {|c| c.code == 108 && c.parameters[0] == comment})
end
end
You can call them like:
CP.first_comment($game_map.events[ID], 'COMMENT_HERE')
CP.event_comment($game_map.events[ID], 'COMMENT_HERE')
Of course you can rename the "module CP" to whatever you want.

That call with return either true or false depending on whether the first line is a comment and matches the 'COMMENT_HERE' string. You can then simply change the state of a self switch. Self switches are identified an array which contains their map ID, their event's ID and their own ID (0, 1, 2 and 3 for A, B, C and D respectively). I suggest using this call if you operate events on the current map:
key = [$game_map.map_id, EVENT_ID, OWN_ID]
$game_self_switches[key] = true
or similar depending on whether you turn them on or off.