@Program Emulation
Shows you how to make a softcoded version of the MUX/TINY command @program, which allows an object to get input directly from what a player types. Like an input prompt in BASIC.
Compatibility:
CobraMUSH.
Instructions
Copy and paste the below code into a compatible MUSH or MUX.
MUSHCode for @Program Emulation
@create @program Emulation
@link @program Emulation = #3954
@chzone @program Emulation = #1398
@lock/Basic @program Emulation==#1622
@lset @program Emulation/Basic=no_inherit
@lock/Use @program Emulation=CAN_USE/1
@lset @program Emulation/Use=no_inherit
@set @program Emulation = VISUAL
&CAN_USE @program Emulation=cor(strmatch(+start, %c), hasattrval(me, %#))
@DESCRIBE @program Emulation=Here's an example of how to emulate @program. It takes two objects, one with the starting command to enter the program, and one with the @program, or one object with a creative uselock. The latter is used here.%r%rTo try it out, '+start'. For best effect, it should be in the same room as the person in the program. Also, it will not trap built in commands.
@set @program Emulation/DESCRIBE=no_command visual
&NEXT_0 @program Emulation=1
&NEXT_1 @program Emulation=2
&NEXT_2 @program Emulation=3
&NEXT_3 @program Emulation=
&PROGRAM_CMD @program Emulation=$*:@pemit/silent setr(0, if(hasattrval(me, %#), %#, #-1))=uldefault(me/step_[v(%q0)], An error occured in the program!, %0); &%q0 me=v(next_[v(%q0)]); @wipe me/[if(strlen(v(%q0)), #-1, %q0)]
&+START_CMD @program Emulation=$+start:@pemit/silent setr(0, if(hasattrval(me, %#), #-1, %#))=u(step_0); @wait 1=&%q0 me=v(next_0)
&STEP_0 @program Emulation=You enter the @program.%r>What's your favorite color?
&STEP_1 @program Emulation=Your favorite color is %0.%r>Now what's your favorite pet?
&STEP_2 @program Emulation=Your favorite pet is %0.%r>Now what's your favorite band?
&STEP_3 @program Emulation=Your favorite band is the %0.%r>Now you're done!
@link @program Emulation = #3954
@chzone @program Emulation = #1398
@lock/Basic @program Emulation==#1622
@lset @program Emulation/Basic=no_inherit
@lock/Use @program Emulation=CAN_USE/1
@lset @program Emulation/Use=no_inherit
@set @program Emulation = VISUAL
&CAN_USE @program Emulation=cor(strmatch(+start, %c), hasattrval(me, %#))
@DESCRIBE @program Emulation=Here's an example of how to emulate @program. It takes two objects, one with the starting command to enter the program, and one with the @program, or one object with a creative uselock. The latter is used here.%r%rTo try it out, '+start'. For best effect, it should be in the same room as the person in the program. Also, it will not trap built in commands.
@set @program Emulation/DESCRIBE=no_command visual
&NEXT_0 @program Emulation=1
&NEXT_1 @program Emulation=2
&NEXT_2 @program Emulation=3
&NEXT_3 @program Emulation=
&PROGRAM_CMD @program Emulation=$*:@pemit/silent setr(0, if(hasattrval(me, %#), %#, #-1))=uldefault(me/step_[v(%q0)], An error occured in the program!, %0); &%q0 me=v(next_[v(%q0)]); @wipe me/[if(strlen(v(%q0)), #-1, %q0)]
&+START_CMD @program Emulation=$+start:@pemit/silent setr(0, if(hasattrval(me, %#), #-1, %#))=u(step_0); @wait 1=&%q0 me=v(next_0)
&STEP_0 @program Emulation=You enter the @program.%r>What's your favorite color?
&STEP_1 @program Emulation=Your favorite color is %0.%r>Now what's your favorite pet?
&STEP_2 @program Emulation=Your favorite pet is %0.%r>Now what's your favorite band?
&STEP_3 @program Emulation=Your favorite band is the %0.%r>Now you're done!