Only Some Exits Printed When Entering Created Rooms [SOLVED]

1234676543224
16 Feb 2022, 18:08

Hello,
I am having a problem where after entering a room, it will only display the exit that I just came from above the room description. For example it says, "You are in some woods. You can go east." But on the compass and in reality I can go north, west, east, and south.
This is my when entering a room script:

if (game.pov.parent.visited=false) {
  sortedw = FilterByType(ScopeExitsForRoom(game.pov.parent),"westdirection")
  sortede = FilterByType(ScopeExitsForRoom(game.pov.parent),"eastdirection")
  sorteds = FilterByType(ScopeExitsForRoom(game.pov.parent),"southdirection")
  sortedn = FilterByType(ScopeExitsForRoom(game.pov.parent),"northdirection")
  if (ListCount(sortede)=0) {
    clonexposroom (game.pov.parent, game.pov.parent, woods)
  }
  if (ListCount(sortedw)=0) {
    clonexnegroom (game.pov.parent, game.pov.parent, woods)
  }
  if (ListCount(sortedn)=0) {
    cloneyposroom (game.pov.parent, game.pov.parent, woods)
  }
  if (ListCount(sorteds)=0) {
    cloneynegroom (game.pov.parent, game.pov.parent, woods)
  }
}
game.pov.parent.visited = true

This is the basic form of my cloneY(or X)Pos(or Neg)room function; it has 3 parameters, "fromRoom", "toRoom", and "name":

create ("new"+game.newroom)
obj = GetObject("new"+game.newroom)
obj.alias = name.alias
obj.usedefaultprefix = false
obj.prefix = name.prefix
obj.description = name.description
obj.beforefirstenter = name.beforefirstenter
obj.isroom = true
obj.parent = fromRoom.parent
obj.descprefix = name.descprefix
obj.exitslistprefix = name.exitslistprefix
obj.firstenter = name.firstenter
obj.enter = name.enter
create exit ("north", fromRoom, obj, "northdirection")
create exit ("south", obj, fromRoom, "southdirection")
game.newroom = game.newroom+1
game.exits = game.exits+1
Grid_CalculateMapCoordinates (game.pov.parent, game.pov)
Grid_Redraw
Grid_DrawPlayerInRoom (game.pov.parent)

Thank you in advance


mrangel
16 Feb 2022, 18:16

This is my when entering a room script:

That's your problem. That script runs after displaying the description. The exits you're creating don't appear because they haven't been created yet.

You need to use the "before entering" script.

Also, I'm puzzled by your use of:

if (game.pov.parent.visited=false) {

The engine already sets game.pov.parent.visited when a room has been visited. It would probably be simpler to miss out that if statement and do those things in the beforefirstenter script.

This would also mean you could omit these lines:

Grid_CalculateMapCoordinates (game.pov.parent, game.pov)
Grid_Redraw
Grid_DrawPlayerInRoom (game.pov.parent)

Because beforefirstenter runs before the standard map stuff is done; so a new room created in beforefirstenter would be picked up by the normal map handling.


1234676543224
16 Feb 2022, 18:38

Alright, that fixed it. Thank you!