config
index
/home/achifaifa/git/kirino/source/config.py

#usr/bin/env python

 
Modules
       
common
help
os
sys

 
Classes
       
config

 
class config
    Configuration class. When instancing it it takes the variables from the configuration files and stores them in the instance.
If there is no data on the file with a parameter, the default is taken
 
#Environment variables
autosave=0
fog=1
gomsg="Game Over"
 
#Key mapping variables
north="n"
south="s"
east="e"
west="w"
northeast=""
northwest=""
southeast=""
southwest=""
charsh="c"
opt="o"
quit="q"
report="z"
nextf="b"
showkeys="k"
showmap="m"
console="/"
quick1="q"
quick2="w"
quick3="f"
quick4="p"
quick5="g"
quick6="j"
 
  Methods defined here:
__init__(self)
keymap(self, restricted)
Key mapping configuration menu.
options(self, restricted)
Game options menu. 
 
This allows modification of the general options, such as key mappings, autosave, etc.
 
If the restricted parameter is 1, it hides the options that should not be changed during the game (fog, etc)
saveoptions(self)
Option saving function. 
 
Takes all the configuration variables and writes them into a file.
 
The file is ../player/config, if the directory does not exist this creates the directory and the file.

 
Functions
       
newkey(msg)
Changes a key.
 
Needs a message with the long name of the key (e.g. 'go northwest' for the option variable northwest)
returns the new value of the option variable (e.g. "New key for 'go northwest'" ->4 -> returns 4)
If the lenght of the key is not 1, returns an error message.