Switching Off Map Calculations

DavyB
30 Sept 2021, 08:05

Am I right in assuming that map calculations are performed even when the map option has not been selected for a game? If so, is it possible to stop these calculations? I am looking at a game that is throwing up random errors that might be explained that way as the player is moved around explicitly with: MoveObject (player, location) and no grid has been considered beforehand.


mrangel
30 Sept 2021, 10:24

Am I right in assuming that map calculations are performed even when the map option has not been selected for a game?

Don't think so.
The code that handles the map is:

        if (game.gridmap) {
          MergePOVCoordinates
        }

(in defaultobject.changedparent)
and:

          if (game.gridmap) {
            Grid_CalculateMapCoordinates (game.pov.parent, game.pov)
            Grid_DrawPlayerInRoom (game.pov.parent)
          }

(in OnEnterRoom)

Neither runs unless game.gridmap is true.
What error messages are you getting?


DavyB
30 Sept 2021, 12:59

Transient errors are appearing in different places. Still head scratching! Here is one example:

> take some breadcrumbs
Error running script: Unknown object or variable 'canAdd'
Error running script: Unknown object or variable 'canAdd'
Error running script: Error evaluating expression 'canAdd': The given key was not present in the dictionary.

You pick them up.

Breadcrumbs were indeed added to the inventory.


mrangel
30 Sept 2021, 14:57

Hmm… that's a very strange error.
Are you using any libraries which use canAdd? Because the only place it appears in the core libraries is the function ContainsAccessible; which shouldn't generate those errors because the variable canAdd is defined immediately before it's used (and there is no dictionary involved).


DavyB
30 Sept 2021, 16:24

Thanks mrangel. It's not my game. I'm just helping out. Only standard libraries are used. A little experimentation may be needed!


mrangel
30 Sept 2021, 18:46

I'd volunteer to take a look at it, but couldn't guarantee a fast response.


DavyB
01 Oct 2021, 08:12

Many thanks mrangel. In the next few days we'll either take you up on that offer or post details of a workaround!