$include $lib/rp
$include $lib/alynna
lvar param
lvar cmd
lvar official
$def cmdbase cmd @ toupper "." split pop
$def }at }cat cmd @ toupper pretty tellhere
$def }t }cat cmd @ toupper pretty tellme
$def }rp }array "/" array_join cmdbase "/" strcat swap strcat "$rpsystem" match swap getpropstr
$def }wc }cat "*avatar" match swap "wc " swap strcat force
: staffonly
me @ mlevel 5 < if
{ "^RED^Permission denied." }tell pid kill
then
;
: list
{ "Listing all results for the chart " cmdbase "." split pop }cat header tellme
1 100 1 for var! res1
{ res1 @ "table" }rp if
{ "^RED^" res1 @ tostr 3 rj "^ ^ : ^YELLOW^" { res1 @ "table" }rp }tell
1 100 1 for var! res2
{ res1 @ res2 @ }rp if
{ " ^BLUE^" res2 @ tostr 3 rj "^ ^ : ^CYAN^" { res1 @ res2 @ }rp }tell
then
repeat
then
repeat
{ cmdbase " v1.0" }cat footer tellme
;
: edit
param @ not if
{ "Syntax: +" cmd @ "/edit
/[=[]]" }tell
{ "Usages:" }tell
{ " +" cmdbase "/edit / Display an entry" }tell
{ " +" cmdbase "/edit /= Delete an entry" }tell
{ " +" cmdbase "/edit /= Add or edit an entry" }tell
{ " " }tell
{ "Valid tables are 1 to 100, valid results are 1 to 100, 'name' or 'blurb'" }tell
exit
then
param @ "=" instr not if
param @ "/" split var! result var! table
table @ toint 1 100 .. not result @ toint 1 100 .. not or if
{ "You must specify a table and a result in the format /." }t exit
then
{ "Displaying entry for chart " cmdbase ", table " table @ ", result " result @ }cat header tellme
{ table @ result @ }rp wrap78 atellme
{ cmdbase " v1.0" }cat footer tellme
exit
then
param @ "=" split var! fate "/" split var! result var! table
result @ "name" smatch if
fate @ not if
{ "I refuse to delete this table, however if you want to delete this table manually, enter the following command:" }t
{ "@set $rpsystem=/" cmdbase "/" table @ ":" }t
exit else
"$rpsystem" match { cmdbase "/" table @ "/table" }cat fate @ setprop
{ "You've renamed table " table @ " in chart " cmdbase " to '" fate @ "'." }t
then
exit then
result @ "blurb" smatch if
fate @ not if
"$rpsystem" match { cmdbase "/" table @ "/blurb" }cat 0 setprop
{ "You've removed the blurb for table " table @ " in chart " cmdbase "." }t
exit else
"$rpsystem" match { cmdbase "/" table @ "/blurb" }cat fate @ setprop
{ "You've set the blurb for table " table @ " in chart " cmdbase " to '" fate @ "'." }t
then
exit then
table @ toint 1 100 .. not result @ toint 1 100 .. not or if
{ "You must specify a table and a result in the format /." }t exit
then
{ table @ "table" }rp not if
{ "NOTICE: This will create a new table " table @ " in the " cmdbase " chart. Unless you really are trying to create a new table in this chart, you may have specified a chart that does not exist. If you are sure you want to create a chart, type the name of the new chart and hit enter. To cancel, type NO or CANCEL or just hit enter with a blank response:" }t
READ_WANTS_BLANKS read var! x
x @ not x @ "{NO|CANCEL}" smatch or if { "Edit canceled." }t exit then
READ_WANTS_BLANKS
"$rpsystem" match { cmdbase "/" table @ "/table" }cat x @ setprop
{ "NOTICE: Since this is a new table, the result to be edited will default to 1." }t
"1" result !
then
fate @ not if
"$rpsystem" match { cmdbase "/" table @ "/" result @ }cat 0 setprop
{ "You've removed the result " result @ " for table " table @ " in chart " cmdbase "." }t
exit else
"$rpsystem" match { cmdbase "/" table @ "/" result @ }cat fate @ setprop
{ "You've set the result " result @ " for table " table @ " in chart " cmdbase " to '" fate @ "'." }t
then
;
: cmd.rm.list list ; SAFECALL cmd.rm.list
: cmd.gw.list list ; SAFECALL cmd.gw.list
: cmd.rm.edit staffonly edit ; SAFECALL cmd.rm.edit
: cmd.gw.edit staffonly edit ; SAFECALL cmd.gw.edit
: cmd.rm
var res1
var res2
"Random Morph - Gaia needs more of ..." header tellhere
random 100 % ++ var! die1
random 100 % ++ var! die2
random 100 % ++ var! die3
random 100 % ++ var! die4
{ "Your roll: [^RED^" die1 @ tostr 3 rj "^ ^] [^BLUE^" die2 @ tostr 3 rj "^ ^] --- Chart "
die1 @ 1 -1 for var! res1
{ res1 @ "table" }rp if break then
repeat
die2 @ 1 -1 for var! res2
{ res1 @ res2 @ }rp if break then
repeat
"[^RED^" res1 @ tostr 3 rj "^ ^] / Result [^BLUE^" res2 @ tostr 3 rj "^ ^]"
}at
{ "Genus table: " { res1 @ "table" }rp }at
"Your fate .." header tellhere
{
"Final result: ^YELLOW^"
die3 @ case
1 46 .. when "Male" end
47 53 .. when "Hermaphrodite" end
54 100 .. when "Female" end
endcase "(" die3 @ ") "
{ res1 @ res2 @ }rp "(" die1 @ ":" die2 @ ") "
die4 @ case
1 10 .. when "feral" end
11 90 .. when "anthromorph" end
91 100 .. when "taur" end
endcase "(" die4 @ ") "
}cat dup var! x tellhere
{ "Random morph for " me @ " the new " { res1 @ res2 @ }rp }cat footer tellhere
official @ if
{ me @ " used random morph officially and got a result of: " x @ }wc
{ "OFFICIAL ROLL: The result of this roll has been reported to staff." }at
then
; SAFECALL cmd.rm
: cmd.gw
var res1
var res2
"Gaia's Wrath - May Her Will Be Done" header tellhere
random 100 % ++ var! die1
random 100 % ++ var! die2
{ "Your roll: [^RED^" die1 @ tostr 3 rj "^ ^] [^BLUE^" die2 @ tostr 3 rj "^ ^] --- Chart "
die1 @ 1 -1 for var! res1
{ res1 @ "table" }rp if break then
repeat
die2 @ 1 -1 for var! res2
{ res1 @ res2 @ }rp if break then
repeat
"[^RED^" res1 @ tostr 3 rj "^ ^] / Result [^BLUE^" res2 @ tostr 3 rj "^ ^]"
}at
{ "Gaia's table: " { res1 @ "table" }rp }at
"Your fate .." header tellhere
{ res1 @ res2 @ }rp dup not if pop "Gaia has performed an illegal operation and Holy will be invoked. Blame your local staffer for the destruction of the planet." then dup var! x wrap78 atellhere
{ "Gaia's Wrath for " me @ " the " { res1 @ "blurb" }rp }cat footer tellhere
official @ if
{ "(" die1 @ ":" die2 @ "): " x @ }cat x !
{ me @ " used Gaia's Wrath officially and got a result of: " x @ }wc
{ "OFFICIAL ROLL: The result of this roll has been reported to staff." }at
then
; SAFECALL cmd.gw
: cmd.rm.official 1 official ! cmdbase cmd ! cmd.rm ; SAFECALL cmd.rm.official
: cmd.gw.official 1 official ! cmdbase cmd ! cmd.gw ; SAFECALL cmd.gw.official
: help
{
{ "+" cmdbase ", by Anwyn for SC" }cat
"The chart-table result roller thingamajigy to replace the old +gw MPI code"
" "
"Syntax:"
" "
{ " +" cmdbase " Roll for a result on the tables for this chart" }cat
{ " +" cmdbase "/official Rolls with a report directly to staff for TPs" }cat
{ " +" cmdbase "/list Lists all possible results for a chart" }cat
{ " "
"Staff only chart editing commands"
{ " +" cmdbase "/edit / View the description of a result" }cat
{ " +" cmdbase "/edit /= Remove a result" }cat
{ " +" cmdbase "/edit /= Add or edit a result and give it a description" }cat
{ " +" cmdbase "/edit /blurb View the miscellaneous blurb for a table" }cat
{ " +" cmdbase "/edit /blurb= Remove the table blurb" }cat
{ " +" cmdbase "/edit /blurb= Add or edit the table name" }cat
{ " +" cmdbase "/edit /name= Give instructions for removing the table" }cat
{ " +" cmdbase "/edit /name= Rename the table" }cat
" "
"For edit commands, if you try to add a result to a table that does not exist, it will allow you to create the table."
}array atellme
;
: main
param !
0 official !
command @ "" "+" subst "." "/" subst cmd !
param @ "#help" smatch if help exit then
prog "cmd." cmd @ strcat cancall? if
prog "cmd." cmd @ strcat call
else
{ "^YELLOW^Your icon(s) have no default tool." }tell
then
;