DayDream BBS has a python module (dd.py, _dd.so) that allows easy door-writing and scripting using Python language.
sys.argv[1]
.
HOTKEY_CURSOR
- detect cursor keys. returns ascii code 250 if up, 251
if down, 252 if left, 253 if right.
HOTKEY_YESNO
- Yes/no mode
HOTKEY_NOYES
- yes/No mode (if HOTKEY_YESNO
or
HOTKEY_NOYES
is specified, integer is returned. 0 = carrier lost, 1 = yes, 2 = no).
HOTKEY_QUICK
- return instantly. (get a char from serial/console buffer)
TYPE_WARN
- warn user if the file is not found
TYPE_MAKE
- Format the filename (add .txt/.gfx extension and path)
TYPE_NOCODES
- Disable control codes (~#)
TYPE_CONF
- Look for the file from conference's display dir
TYPE_NOSTRIP
- Don't strip ansi codes even if the user is in ascii mode
TYPE_SEC
- Check if there's file for user's security.
Returns 0 if file not found, 1 if success.
PROMPT_SECRET
- hide input
PROMPT_NOCRLF
- don't write crlf when user presses enter
PROMPT_FILE
- don't allow '/'.
Returns 0 if carrier lost, otherwise 1.
getvar
may
return you a string, integer, long integer or a char, depending on type.
BBS_NAME
- BBS Name
BBS_SYSOP
- SysOp's Name
USER_REALNAME
- Real name of the user
USER_HANDLE
- Handle of the user
USER_ORGANIZATION
- Organization of the user
USER_ZIPCITY
- Zip & City of the user
USER_VOICEPHONE
- Voice phone number of the user
USER_COMPUTERMODEL
- Computer model of the user
USER_SIGNATURE
- Upload signature of the user
DOOR_PARAMS
- Command line parameters from main prompt
DD_ORIGDIR
- same as getenv("DAYDREAM"), the dir where DD stuff is.
USER_CONFERENCEACC1
- Conference access for confs 1-32,
in format "X----X---", where X is yes and - is no.
USER_CONFERENCEACC2
- Conference access for confs 33-64,
in format "X----X---", where X is yes and - is no.
USER_FIRSTCALL
- Date of the first call by the user, in ctime()-format.
USER_LASTCALL
- Date of the last call by the user, in ctime()-format.
CONF_NAME
- Name of the current conference
CONF_PATH
- Path to the current conference
CONF_ULPATH
- Upload path of the current conference
CONF_NEWSCANAREAS
- New file scan areas
CONF_PASSWD
- Conference password
MSGBASE_NAME
- Name of the current message base
MSGBASE_FN_TAG
- Fidonet tag of the current message base
MSGBASE_FN_ORIGIN
- Origin line
MSGBASE_FN_ADDRESS
- Address
USER_SCREENLENGTH
- Screen length of the user (lines)
USER_ULFILES
- Number of files uploaded by the user
USER_DLFILES
- Number of files downloaded by the user
USER_PUBMESSAGES
- Number of public messages written by the user.
USER_PVTMESSAGES
- Number of private messages written by the user.
USER_CONNECTIONS
- Number of calls by the user.
USER_FILERATIO
- File ratio of the user
USER_BYTERATIO
- Byte ratio of the user
USER_FREEDLBYTES
- Free download bytes of the user
USER_FREEDLFILES
- Free download files of the user
USER_SECURITYLEVEL
- Security level of the user
USER_JOINCONFERENCE
- Auto-join conference
USER_DAILYTIMELIMIT
- Daily time limit (minutes)
USER_ACCOUNT_ID
- User account id
USER_TIMELEFT
- Remaining time
SYS_CONF
- Current conference number
USER_FAKEDFILES
- Number of faked files
USER_FAKEDBYTES
- Number of faked bytes
SYS_FLAGGEDFILES
- Number of files flagged for downloading
SYS_FLAGGEDBYTES
- Number of bytes flagged for downloading
SYS_FLAGERROR
- Error code of the last file flagging attempt (See libdd.doc for more info)
SYS_MSGBASE
- Number of the current message base
CONF_FILEAREAS
- Number of fileareas in current conference
CONF_UPLOADAREA
- Upload area number of the current conference
CONF_MSGBASES
- Message base in the current conference
CONF_COMMENTAREA
- Comment base number of the current conference
MSGBASE_MSGLIMIT
- Message limit in the current message base
USER_ULBYTES
- Number of bytes uploaded by the user
USER_DLBYTES
- Number of bytes downloaded by the user
USER_PROTOCOL
- Protocol ID char of the user
Set variable var. newvalue must be supplied as string. Possible var's are:
BBS_NAME
- BBS Name
BBS_SYSOP
- SysOp's Name
USER_REALNAME
- Real name of the user
USER_HANDLE
- Handle of the user
USER_ORGANIZATION
- Organization of the user
USER_ZIPCITY
- Zip & City of the user
USER_VOICEPHONE
- Voice phone number of the user
USER_COMPUTERMODEL
- Computer model of the user
USER_SIGNATURE
- Upload signature of the user
USER_CONFERENCEACC1
- Conference access for confs 1-32,
in format "X----X---", where X is yes and - is no.
USER_CONFERENCEACC2
- Conference access for confs 33-64,
in format "X----X---", where X is yes and - is no.
To change the value of an integer value, do it like this:
spam=dd.getvar(dd.ULFILES) spam=spam+1; dd.setvar(dd.ULFILES,`spam`)
USER_SCREENLENGTH
- Screen length of the user (lines)
USER_ULFILES
- Number of files uploaded by the user
USER_DLFILES
- Number of files downloaded by the user
USER_PUBMESSAGES
- Number of public messages written by the user.
USER_PVTMESSAGES
- Number of private messages written by the user.
USER_CONNECTIONS
- Number of calls by the user.
USER_FILERATIO
- File ratio of the user
USER_BYTERATIO
- Byte ratio of the user
USER_FREEDLBYTES
- Free download bytes of the user
USER_FREEDLFILES
- Free download files of the user
USER_SECURITYLEVEL
- Security level of the user
USER_JOINCONFERENCE
- Auto-join conference
USER_DAILYTIMELIMIT
- Daily time limit (minutes)
USER_TIMELEFT
- Remaining time
USER_FAKEDFILES
- Number of faked files
USER_FAKEDBYTES
- Number of faked bytes
USER_ULBYTES
- Number of bytes uploaded by the user
USER_DLBYTES
- Number of bytes downloaded by the user
USER_PROTOCOL
- Protocol ID char of the user
JC_LIST
- if conf = 0, show list of conferences
JC_SHUTUP
- don't tell user if anything goes wrong..
JC_QUICK
- don't show conference information..
Returns 1 if success, otherwise 0.
MC_QUICK
- don't tell anything if failed to join
MC_NOSTAT
- don't display msgbase stats
To be able to access DD commands, you have to import 2 modules in the
beginning of your script. These two modules are dd and sys
.
When importing module dd
, c-routines are being loaded automatically. Connection with DD is established with dd.initdoor-routine, and if it fails,
your script is NOT launced from DD. Here's an example of a simple script:
import dd import sys if (dd.initdoor(sys.argv[1])==0): print "Ugh. Run me from DD\n" sys.exit(-1) else: dd.sendstring ("Hello, World and ") name=dd.getvar(dd.USER_HANDLE) dd.sendstring (name + "\n") calls=dd.getvar(dd.USER_CONNECTIONS) dd.sendstring ("You have called this system " + `calls` + " times.\n")Simple, huh? :)