@q
@program asys-tune
1 99999 d
i
( asys-tune v1.2 Jessy@FurryMUCK 6/97, 2/99
asys-tune runs Argo +tune command, displaying or setting the Argo
system parameters.
INSTALLATION:
asys-tune uses the default Argo installation method. Port and install
lib-argo. Set asys-tune W. Type '+install asys-tune' to install
this program and its actions.
USAGE:
+tune................... Displays installed programs and parameters
+tune =... Sets to
Only staff members may use +tune to set system parameters.
See lib-argo and the Argo manual for further information.
asys-tune may be freely ported. Please comment any changes.
)
(2345678901234567890123456789012345678901234567890123456789012345678901)
$def thisVersion "1.2"
$define Tell me @ owner swap notify $enddef
$include $lib/argo
lvar scratch (* workspace var *)
lvar ourCounter (* misc. counter var *)
lvar ourDataObj (* dbref: object holding system-wide data *)
lvar ourArg (* inital arg string, unmodified *)
lvar ourCom (* string: 'official' name of command *)
: DoInstall ( -- ) (* install program into Argo system *)
caller program? not if (* confirm installation method *)
">> Programs must be installed via the "
"+install" GetCommandName strcat
" command." strcat Tell exit
then
prog "@a/version" getpropstr if (* confirm re-install *)
">> Reinstalling..." Tell
else
">> Installing..." Tell
then
(* record 'official' name of prog; remove old links *)
prog "@a/name" "asys-tune" setprop
RecOldActions
#0 "+tune" newexit dup scratch ! (* create command *)
prog setlink
prog "@a/version" thisVersion setprop (* set version *)
scratch @ "@a/version" thisVersion setprop
#0 "@a/comm_list/+tune" scratch @ setprop
#0 "@a/prog_list/" prog name strcat prog setprop
scratch @ "@a/name" "+tune" setprop
">> Installed." Tell
;
: DoUninstall (* uninstall program from Argo *)
prog "@a/name" getpropstr if
#0 "@a/prog_list/" prog "@a/name" getpropstr strcat
getprop not if
">> " prog name strcat " is not currently installed." strcat
Tell pid kill
then
else
">> " prog name strcat " is not currently installed." strcat
Tell pid kill
then
">> Please confirm: You wish to uninstall "
prog name strcat "?" strcat Tell
ReadYesNo not if
">> Aborted." Tell pid kill
Then
background
"@a/comm_list/+tune" RemoveCommand
#0 "@a/prog_list/" prog "@a/name" getpropstr strcat remove_prop
RecOldActions
">> Uninstalled. Please edit the online manual as appropriate." Tell
;
: DoHelp ( -- ) (* display help screen *)
" " Tell
"asys-Tune \(#" prog intostr strcat "\)" strcat Tell
" " Tell
"The " command @ strcat
" command displays currently installed Argo system programs and "
"current values for the Argo system parameters. Staff memebers "
"may also use the command to set system parameters."
strcat strcat strcat Tell " " Tell
"Syntax:" Tell " " Tell
" +tune................... Displays installed programs and parameters"
Tell
" +tune =... Sets to " Tell
" " Tell
;
: DoTune ( [s] -- ) (* set sysparm=param as indicated in s *)
(* default behavior is to simply display sysparms *)
ourArg @ not if (* no arg: just display current sysparms *)
" " Tell
"The Argo System, version " thisVersion strcat Tell
" " Tell
"Installed Programs: " Tell " " Tell
NukeStack
0 ourCounter !
#0 "@a/prog_list/" nextprop ourCounter !
begin (* begin program-finding loop *)
ourCounter @ while
#0 ourCounter @ getprop name
#0 ourCounter @ nextprop ourCounter !
repeat (* end program-finding loop *)
depth 3-col (* display results *)
" " Tell
"Current System Parameters: " Tell
" " Tell
0 ourCounter !
ourDataObj @ "@a/sysparms/" nextprop ourCounter !
begin (* begin sysparm-displaying loop *)
ourCounter @ while
" " ourCounter @ 12 strcut swap pop strcat 24 Pad
" = " strcat
ourDataObj @ ourCounter @ getpropstr strcat Tell
ourDataObj @ ourCounter @ nextprop ourCounter !
repeat (* end sysparm-displaying loop *)
exit
then
(* sysparm-setting routine begins here *)
StaffCheck not if (* check: staff member? *)
">> Permission denied." Tell exit
then
(* check syntax *)
ourArg @ "=" explode 1 = if
">> Syntax: " command @ strcat " = " strcat Tell
pop exit
then
(* parse arg *)
strip swap strip swap
(* check: valid param and value? *)
dup ourDataObj @ "@a/sysparms/" rot strcat getpropstr not if
">> Parameter '" swap strcat "' not found." strcat Tell
pop exit
then
dup
"{starting_*|max_*|min_*|turn_*|tech_*|vote_xp*|votes_req*|idle*}"
smatch if
over number? if
over atoi 0 <= if
">> Numeric perameters must be at least 1." Tell pop exit
then
else
">> Invalid parameter." Tell pop exit
then
then
dup
"{combat|magic|psionics|auto_xp|"
"player_pause|character_approval|strict_disads|use_dark}" strcat
smatch if
over "{yes|no}" smatch not if
">> Invalid parameter. Please enter 'yes' or 'no'." Tell pop exit
then
then
(* check: time string for X_interval valid? *)
dup "game_day" smatch
over "vote_interval" smatch or
over "heal_interval" smatch or
over "rumor_interval" smatch or
over "income_interval" smatch or if
over strip ParseTimeString if
pop
else
pop
">> Invalid parameter." Tell
">> Syntax: