/* $Id: mapviewschedules.dxt,v 1.1 2001/10/15 15:00:06 gnurou Exp $ Copyright (C) 2001 Alexandre Courbot Part of the Adonthell Project http://adonthell.linuxgames.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. See the COPYING file for more details. */ /*! \page page9 Writing mapview schedules \section mviewsched0 The Basics A mapview schedule file should always be placed into the \e script/schedules/mapviews directory in the %game hierarchy. It should consist of a single class, named like the module itself. A schedule is attached to a mapview by using the mapview::set_schedule () method. See it's documentation for more details. You should be particularly careful that the argument list given to mapview::set_schedule () \e has to be a Python tuple containing ONLY Python strings or integers. \section mviewsched1 Arguments passed to __init__ () When you call mapview::set_schedule (), the first argument passed to the class constructor is a reference to the mapview that called this method. This parameter should be saved as it will most likely be used during the run () method to control the mapcharacter. Then follows the arguments stored in the Python tuple that has (optionally) been passed to mapview::set_schedule (). \section mviewsched2 Arguments passed to run () No arguments are passed to the run () method. \section mviewsched3 Structure of a mapview schedule file Here is what a mapcharacter schedule file should ideally look like: \verbatim # # (C) Copyright # Part of the Adonthell Project http://adonthell.linuxgames.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY. # # See the COPYING file for more details # # # # class myschedule: # Parameters: # Description of myparameter1 # Description of myparameter2 def __init__ (self, mapviewinstance, myparameter1, myparameter2): self.myself = mapviewinstance def run (self): def __del__ (self) \endverbatim \section mviewsched4 Storing variables It is unsafe to use class variables different from those that are passed to the __init__ method. When a mapview's schedule is state-saved, only the schedule filename and it's initialisation arguments (the Python tuple passed to mapview::set_schedule ()) are saved. So, if you create class variables inside the object, do not expect them to survive %game saving/loading. However, mapview schedules usually don't need persistant variables. */