TinyFugue Doing Machine

This is a (very rough) translation of Eldrik's @doing machine code to TF macros. No need for a parentable object on the MUSH to run it.

Category: Other

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for TinyFugue Doing Machine

; This is a (very rough) translation of Eldrik's @doing machine code
; to TF macros. No need for a parentable object on the MUSH to run it.
;
; to use: Put this file in your home directory or your tf-lib directory,
; wherever TF can find it, then add the line '/load doing.tf' to your
; tfrc file. Once loaded in, type '/dohelp' for command list.
;
/def -i dolist = @pemit me=Stored \
@doings:[iter(lnum(words(v(doings_list),|)),\%r[add(##,1)]. \
[extract(v(doings_list),add(##,1),1,|)])]
/def -i doset = @switch [and(lte(%0,words(v(doings_list),|)), \
gt(%0,0))]=1,{@fo [setq(0,extract(v(doings_list),%1,1,|))]me= \
@doing [r(0)];@pemit me=@doing set: [r(0)]},@pemit me=That is not \
the number of a stored @doing.
/def -i doswap = @switch and(lte(%1,words(v(doings_list),|)), \
gt(%1,0),lte(%2,words(v(doings_list),|)),gt(%2,0))=1,{&doings_list \
me=[setq(0,extract(v(doings_list),%1,1,|))][replace(replace( \
v(doings_list),%1,extract(v(doings_list),%2,1,|),|),%2,r(0),|)]; \
@pemit me=@doings swapped.},@pemit me=At least one selection is invalid.
/def -i dorand = @fo [setq(0,extract(v(doings_list), \
add(rand(words(v(doings_list),|)),1),1,|))]me=@doing [r(0)]; \
@pemit me=@doing set: [r(0)]
/def -i dodel = @switch [and(lte(%0,words(v(doings_list),|)), \
gt(%0,0))]=1,{&doings_list me=[ldelete(v(doings_list),{%0},|)]; \
@pemit me=@doing deleted.},@pemit me=That is not a number of a \
stored @doing.
/def -i dohelp = /echo @doing Machine commands:%;/echo%;/echo /dolist: List \
stored @doings.%;/echo /doadd <text>: Add an @doing.%; \
/echo /dodel <#>: Delete a stored @doing.%; \
/echo /doset <#>: Set your @doing to a stored one.%; \
/echo /dorand: Set your @doing randomly.%; \
/echo /dowap <#> <#>: Swap one @doing with another.%; \
/echo%;/echo Original code by Eldrik@AmberMUSH. Modified for TF \
by Rina@pobox.com.
/def -i doadd = @switch gt(strlen(%0),40)=1,@pemit me={@doing is too long \
-- not saved. ([strlen(%0)] chars, 40 max)},{@switch words( \
v(doings_list),|)=0,&doings_list me={%0},{&doings_list me=[edit( \
v(doings_list),$$,|{%0})]};@pemit me=@doing added.}