@program roll.muf 1 1000 d i $include $lib/rp $include $lib/alynna $def notify ansi_notify $def notify_except ansi_notify_except lvar dice lvar number lvar cur lvar result lvar total lvar target lvar entered lvar dieshift : dieshifter ( -- ) target @ ":" instr if target @ ":" explode pop atoi dieshift ! target ! else 0 dieshift ! then ; : main ( s -- ) strip target ! target @ entered ! target @ not if "Alynna's FFa2 roller 3.0" .tell "Formats: " .tell " roll d<+/-> Roll sided dice, <+/-> to the total" .tell " Ex: 1d10, 3d6, 4d12+5, 1d20-3" .tell " roll <+/-> Roll stat on your sheet, <+/-> to the total" .tell " Ex: body-2, spirit+1, tail, agility+3, nostrum-2" .tell " roll :<+/-> Roll stat on your sheet, with the die shifted" .tell " by ranks (positive or negative), with" .tell " <+/-> to the total" .tell " Ex: 1:Artistry, 1:Survival-2, -2:body" .tell " " "Body, mind and spirit account for additional points already." .tell "To roll something with a focus, just use 1:" .tell exit then dieshifter target @ "+" instring if target @ "+" explode pop swap atoi total ! target ! else target @ "-" instring if target @ "-" explode pop swap atoi 0 swap - total ! target ! else 0 total ! then then target @ "[1-9]d*" smatch not if target @ atoi 0 > if 1 dice ! target @ atoi number ! else 1 dice ! me @ me @ target @ "level" lookupstat if me @ me @ target @ "level" lookupstat getstatint else "Not a valid stat." "Yerf" pretty tellme exit then dieshift @ + dup 0 < if pop 0 then dup 6 > if pop 6 then ldie number ! then else target @ "d" explode pop atoi dice ! atoi number ! then 1 cur ! "" result ! begin random number @ % 1 + dup total @ + total ! intostr " " strcat result @ strcat result ! cur @ 1 + cur ! cur @ dice @ > until { "^GREEN^^NORMAL^ " me @ name " rolls " entered @ " (" dice @ "d" number @ ") and gets " result @ ": " total @ }cat dup .tell .otell ; . c q