Package svs_demogame :: Module scripts
[show private | hide private]
[frames | no frames]

Module svs_demogame.scripts

Class for handling scripts in the demo game.

Author: Simon Yuill

Contact: simon@lipparosa.org

Copyright: 2005 Simon Yuill

License: GNU GPL version 2 or any later version

Classes
Script Maintains code for a script, the code itself is treated as a module upon which functions are called when executed.
ScriptHandler  
ScriptStore This class is used by the ScriptHandler to store data for scripts between calls in the game loop.

Exceptions
ScriptException  

Function Summary
  getScriptEnvironmentProperty(propertyName)
Returns value used as part of the environemnt in which game scripts are run.
  importCode(code, name, add_to_sys_modules)
Import dynamically generated code as a module.
  loadGameCode(path)
Loads the text file for the code functions available to game players.
  loadTemplateCode(path)
Loads code to be used as template code for scriptable game entities.
  makeEmptyScript()
Creates Script object with default code entry.
  makeScriptFromCode(code, author)
Creates Script object with specified code and author.
  setScriptEnvironmentProperty(propertyName, propertyValue)
Sets a value used as part of the environemnt in which game scripts are run.

Variable Summary
Constants script_const = <svs_core.utilities.lib.Constants instanc...

Function Details

getScriptEnvironmentProperty(propertyName)

Returns value used as part of the environemnt in which game scripts are run.

importCode(code, name, add_to_sys_modules=0)

Import dynamically generated code as a module. code is the object containing the code (a string, a file handle or an actual compiled code object, same types as accepted by an exec statement). The name is the name to give to the module, and the final argument says whether to add it to sys.modules or not. If it is added, a subsequent import statement using name will return this module. If it is not added to sys.modules import will try to load it in the normal fashion.

import foo

is equivalent to

foofile = open("/path/to/foo.py") foo = importCode(foofile,"foo",1)

Returns a newly generated module.

Written by Anders Hammarquist, http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/82234

loadGameCode(path=None)

Loads the text file for the code functions available to game players.

If path is not defined, loads the file svs_demogame/gamecode.py.

loadTemplateCode(path=None)

Loads code to be used as template code for scriptable game entities.

makeEmptyScript()

Creates Script object with default code entry.

makeScriptFromCode(code, author=None)

Creates Script object with specified code and author.

setScriptEnvironmentProperty(propertyName, propertyValue)

Sets a value used as part of the environemnt in which game scripts are run.

Variable Details

script_const

Type:
Constants
Value:
<svs_core.utilities.lib.Constants instance at 0x304d3dc8>              

Generated by Epydoc 2.1 on Thu Oct 20 15:30:24 2005 http://epydoc.sf.net