textadventures / quest

Create text adventure games
http://textadventures.co.uk/quest
MIT License
304 stars 69 forks source link

Move Player on Startup Causes Error #774

Closed g-mcclock closed 8 years ago

g-mcclock commented 9 years ago

Hi,

In the game object, I have a startup script that moves the player to a different room. This works but I also get several repeated errors that read:

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

FYI: My player object has been renamed and he does carry items in inventory.

g-mcclock commented 9 years ago

Almost forgot... Great job with this engine! I'm having a lot of fun designing my text adventure.

alexwarren commented 9 years ago

Do you need the map feature in your game? If you've got it switched on, can you try switching it off?

g-mcclock commented 9 years ago

Hi Alex,

Yes. I am using the map feature. I can switch it off as a test, but will I lose my map settings if I do that?

alexwarren commented 9 years ago

No, the settings should still exist even if you turn the map off, ready to be reapplied if you turn it back on again. On 27 Jan 2015 22:46, "g-dog" notifications@github.com wrote:

Hi Alex,

Yes. I am using the map feature. I can switch it off as a test, but will I lose my map settings if I do that?

— Reply to this email directly or view it on GitHub https://github.com/textadventures/quest/issues/774#issuecomment-71744599 .

g-mcclock commented 9 years ago

Ok. Thanks. I just switched off the map and the error does not appear.

alexwarren commented 9 years ago

OK. This will be happening because the map relies on exits to know where each room should appear, so if you move the player in the startup script, they'll suddenly be in a room which the map code hasn't linked to where they started.

You might be able to fix this by ensuring in your game file that the "player" object isn't set to any room. Then when you move the player in the game start script, that should initialise the mapper from the correct start location.

g-mcclock commented 9 years ago

For now I was just using the script as a way of moving the player into whichever room I was testing. So it's easy enough for me to just navigate to the player object and move his location that way instead. I just wanted to let you know in case the error had other implications.

Thanks for the insight and keep up the good work!