From 223705d6b36d5041b5dfe241727411043b281153 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sun, 4 Feb 2018 12:15:26 +1000 Subject: [PATCH] more work on docs --- docs/docs/guide/doors/dosbox.md | 6 ++- docs/docs/guide/doors/dosemu.md | 5 ++- docs/docs/guide/scripting.md | 72 ++++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 3 deletions(-) diff --git a/docs/docs/guide/doors/dosbox.md b/docs/docs/guide/doors/dosbox.md index 17ab325..68aa66f 100644 --- a/docs/docs/guide/doors/dosbox.md +++ b/docs/docs/guide/doors/dosbox.md @@ -60,13 +60,17 @@ Here is an example script I use for Freshwater Fishing: export SDL_VIDEODRIVER="dummy" NODE=$1 SOCKET=$2 - + + trap '' 2 + if [ ! -e /home/pi/MagickaBBS/doors/ffs.inuse ]; then touch /home/pi/MagickaBBS/doors/ffs.inuse cp /home/pi/MagickaBBS/node${NODE}/door.sys /home/pi/MagickaBBS/doors/ffs/ /usr/local/bin/dosbox -socket $SOCKET -c "C:\ffs\ffs.bat ${NODE}" -conf /home/pi/MagickaBBS/doors/dosbox.conf rm /home/pi/MagickaBBS/doors/ffs.inuse fi + + trap 2 This will just dump the user back to the BBS if the door is in use. You could get fancy and use the 'inuse' door I created which will display an in-use message and then quit ([INUSE Door](https://github.com/apamment/inuse)), but that is outside the scope of this document. diff --git a/docs/docs/guide/doors/dosemu.md b/docs/docs/guide/doors/dosemu.md index 26758ea..6cb2040 100644 --- a/docs/docs/guide/doors/dosemu.md +++ b/docs/docs/guide/doors/dosemu.md @@ -78,12 +78,15 @@ until you have a directory for each node. Finally, the script for running tinys hangman, thang.sh #!/bin/bash - + trap '' 2 NODE=$1 cp /home/someuser/MagickaBBS/node${NODE}/dorinfo1.def /home/someuser/MagickaBBS/doors/thang/node${NODE}/ /usr/bin/dosemu -quiet -f /home/someuser/MagickaBBS/doors/dosemu.conf -I "dosbanner 0" -E "D:\THANG\THANG.BAT ${NODE}" 2>/dev/null + + trap 2 + You can then edit your doors.ini to include: diff --git a/docs/docs/guide/scripting.md b/docs/docs/guide/scripting.md index 291a21b..1fed0fa 100644 --- a/docs/docs/guide/scripting.md +++ b/docs/docs/guide/scripting.md @@ -6,10 +6,58 @@ Next, add scripts! ## Menu Scripts +Each menu can have a script function that runs to display the menu, read the hotkey and return the key to the BBS. + +This is the script for the mail menu. + + function menu() + -- clear the screen + bbs_write_string("\027[2J"); + + -- display menu ansi + bbs_display_ansi("mailmenu"); + + + -- display the current mail conference and area + local dir_no; + local dir_name; + local sub_no; + local sub_name; + + dir_no, dir_name, sub_no, sub_name = bbs_cur_mailarea_info(); + bbs_write_string(string.format("\r\n\027[0m \027[0;36mConference: \027[1;34m(\027[1;37m%d\027[1;34m) \027[1;37m%-20s\027[0;36mArea: \027[1;34m(\027[1;37m%d\027[1;34m) \027[1;37m%-20s\r\n", dir_no, dir_name, sub_no, sub_name)); + + -- display the prompt with the time left + bbs_write_string(string.format("\r\n\027[1;34m [\027[0;36mTime Left\027[1;37m %dm\027[34m]-> \027[0m", bbs_time_left())); + + -- read char entered + cmd = bbs_read_char(); + + -- return the char entered + return cmd; + end + + ## Login/Logout Scripts +The login and logout functions can also be scripted. + +The `login_stanza.lua` script does everything from the point the user logs in until the main menu is displayed. + +The `logout_stanza.lua` script runs a logout function that simply displays a good bye ansi and returns 1. + ## Utility Scripts +Utility scripts are just scripts that can be called from a menu. They can do anything you like, an example would be a oneliners script. + +To run a script from a menu, place the script in the scripts directory, and call it from a menu like this + + HOTKEY O + COMMAND DOSCRIPT + DATA oneliners + +Where data is the name of the lua script to call without the extension. + ## BBS Script Commands **bbs_write_string** Takes one string, writes that string to the user. Returns nothing. @@ -18,6 +66,8 @@ Next, add scripts! **bbs_display_ansi** Takes one string, displays that ansi from the ansis folder (don't include path or extension). Returns nothing. +**bbs_display_ansi_pause** Takes one string, displays that ansi (with a pause prompt) from the ansis folder (don't include path or extension). Returns nothing. + **bbs_read_char** Reads a character from the user, returns a string with one character in it. **bbs_version** Returns a string with the BBS version in it. @@ -40,4 +90,24 @@ Next, add scripts! **bbs_display_automsg** Displays the current automessage -**bbs_get_info** Returns 4 strings, the BBS name, the Sysop name, the OS name and the system architecture. \ No newline at end of file +**bbs_get_info** Returns 4 strings, the BBS name, the Sysop name, the OS name and the system architecture. + +**bbs_file_scan** Performs a file scan. + +**bbs_full_mail_scan** Performs a full mail scan (like a mail scan but also displays new messages) + +**bbs_get_userhandle** Returns the logged in user's handle + +**bbs_message_found** Takes three numbers, the conference, area and the message number, returns one number, 1 if found, 0 if not. + +**bbs_read_message_hdr** Takes three numbers, the conference, area and the message number. Returns three strings, the Sender, Recipient and Subject. + +**bbs_read_message** Takes three numbers, the conference, area and the message number. Returns one string, the message body. + +**bbs_temp_path** Returns a temporary path for the script to store data in. This path is cleared out on login. + +**bbs_post_message** Takes 2 numbers and 4 strings, The conference number, the area number, the recipient, the sender, the subject and the body. + +**bbs_data_path** Returns a path for script data storage. This is shared with all scripts, so make sure your filenames are unique. + +**bbs_user_security** Returns the current user's security level.