since the built-in 'visited' Boolean Attribute is already built to work (reveal map rooms) with the grid mapping, I'd instead make your own separate Boolean Attribute, that you check for, in whether to run a script(s) or not, instead of using the 'firsttime' Script~Function or nor the text processor's 'once' command, as they're tied to the 'visited' Boolean Attribute too, as well.
visited: leave as is, using it to determine what rooms you can see in~on the mapping grid
visited2: your newly created Attribute, for checking for what scripts to run.
(just a sample example, so the code design choice I used, is poor for actual implementation in a big game)
<object name="room">
</object>
<object name="room2">
<attr name="visited" type="boolean">true</attr>
<attr name="visited2" type="boolean">false</attr>
</object>
<object name="player">
<parent type="object">room</parent>
<attr name="changedparent" type="script">
if (this.parent.name = "room2" and this.parent.visited2 = false) {
// script(s) 1
this.parent.visited2 = true
} else if (this.parent.name = "room2" and this.parent.visited2 = true) {
// script(s) 2
}
</attr>
</object>