Adonthell
0.4
Main Page
Related Pages
Classes
Files
File List
File Members
mapviewschedules.dxt
1
/*
2
$Id: mapviewschedules.dxt,v 1.1 2001/10/15 15:00:06 gnurou Exp $
3
4
Copyright (C) 2001 Alexandre Courbot
5
Part of the Adonthell Project http://adonthell.linuxgames.com
6
7
This program is free software; you can redistribute it and/or modify
8
it under the terms of the GNU General Public License.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY.
11
12
See the COPYING file for more details.
13
*/
14
15
/*!
16
17
\page page9 Writing mapview schedules
18
19
\section mviewsched0 The Basics
20
A mapview schedule file should always be placed into the \e
21
script/schedules/mapviews directory in the %game hierarchy. It
22
should consist of a single class, named like the module itself.
23
A schedule is attached to a mapview by using the
24
mapview::set_schedule () method. See it's documentation for more
25
details. You should be particularly careful that the argument
26
list given to mapview::set_schedule () \e has to be a Python
27
tuple containing ONLY Python strings or integers.
28
29
\section mviewsched1 Arguments passed to __init__ ()
30
When you call mapview::set_schedule (), the first argument
31
passed to the class constructor is a reference to the mapview
32
that called this method. This parameter should be saved as it will
33
most likely be used during the run () method to control the
34
mapcharacter. Then follows the arguments stored in the Python
35
tuple that has (optionally) been passed to mapview::set_schedule ().
36
37
\section mviewsched2 Arguments passed to run ()
38
No arguments are passed to the run () method.
39
40
\section mviewsched3 Structure of a mapview schedule file
41
Here is what a mapcharacter schedule file should ideally look like:
42
\verbatim
43
#
44
# (C) Copyright <year> <your name>
45
# Part of the Adonthell Project http://adonthell.linuxgames.com
46
#
47
# This program is free software; you can redistribute it and/or modify
48
# it under the terms of the GNU General Public License.
49
# This program is distributed in the hope that it will be useful,
50
# but WITHOUT ANY WARRANTY.
51
#
52
# See the COPYING file for more details
53
#
54
55
#
56
# <description of the schedule>
57
#
58
59
<do your imports here>
60
61
class myschedule:
62
63
# Parameters:
64
# Description of myparameter1
65
# Description of myparameter2
66
def __init__ (self, mapviewinstance, myparameter1, myparameter2):
67
self.myself = mapviewinstance
68
<do you other initialisation here>
69
70
def run (self):
71
<mapcharacter control>
72
73
def __del__ (self)
74
<eventual cleanup>
75
\endverbatim
76
77
\section mviewsched4 Storing variables
78
It is unsafe to use class variables different from those that are
79
passed to the __init__ method. When a mapview's schedule is
80
state-saved, only the schedule filename and it's initialisation
81
arguments (the Python tuple passed to mapview::set_schedule ())
82
are saved. So, if you create class variables inside the object,
83
do not expect them to survive %game saving/loading. However,
84
mapview schedules usually don't need persistant variables.
85
*/
mapviewschedules.dxt
Generated by
1.8.1.2