Concerning the order in which start and init scripts run

user interface initialisation script

GAME TITLE

start script
init script of object in library file
init script of object in game's code

You are in a room.
>


Did I miss anything?


  • All the default stuff in InitInterface (which you probably only care about if you're replacing rather than adding to it)
    • Which includes:
      • Loading webfonts, determining if we're on web/desktop/mobile, and making default UI adjustments
      • The function InitUserInterface (which is blank by default, made for you to override)
      • UI Initialisation script (game.inituserinterface)
  • The default stuff in StartGame (which you probably only care about if you're replacing rather than adding to it)
    • Which includes:
      • Displaying game title
      • Setting up default stuff (like creating the player object if necessary, and initialising health/money/etc)
      • Game start script (game.start)
      • Object _initialise_ scripts (in the order they appear in the XML file; which usually means libraries first, but not necessarily)
      • Enter starting room (if enabled)
        • beforefirstenter
        • beforeenter
        • Room description
        • Script when entering a room (game.roomenter)
        • firstenter
        • enter
      • Draw map (if enabled)

I figured it's worth mentioning the default stuff, in case you want to use the data from it. For example, if you enable the default health/money status attributes, they are added during StartGame, so the statusattributes dictionary might not exist during the first run of the UI initialisation script. Similarly, if you rely on the default behaviour of using an object named player as the player object, you may find that game.pov is not set in the UI Initialisation script.


Good stuff!


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums