Getting this error

Captain_Red
19 Feb 2022, 12:32

Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.
Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.
Error running script: Error evaluating expression 'DictionaryItem(coordinates, coordinate)': The given key was not present in the dictionary.

When I try to have a 'Move script' to move player to a different room.


mrangel
19 Feb 2022, 13:54

This is pretty well documented.

If you have the map turned on, and move the player to a room that isn't displayed on the map yet, it will cause this error. It doesn't know where to draw the room relative to the existing ones.

I believe in the manual, there is a script which will explore the map and draw it all in, to cure this error.

One alternative would be a script like:

Grid_SetGridCoordinateForPlayer (game.pov, name of room, "x", 0.0)
Grid_SetGridCoordinateForPlayer (game.pov, name of room, "y", 0.0)
Grid_SetGridCoordinateForPlayer (game.pov, name of room, "z", 0.0)
game.pov.parent = name of room

This way, you're positioning the room on the map. If it is accessible from the old room, you need to make sure the coordinate is right; if the new location can only be reached by script movement, you could just make a big number (like 1000 or something) for one of the values.

(In this script I used game.pov rather than player because it always works and is a good habit to get into)