@q
@program cmd-goto
1 9999 d
i
( cmd-goto   Jessy @ FurryMUCK   9/96
  
  This soft-coded version of the 'goto|go' command lets you 'go' through an 
  exit normally, or go to a room that you control, regardless of its location 
  or the MUCK's @teleport parameters.
  
  Installation:
  
  Port the program and link a command with a name such as 'goto;go' to it.
  The program needs to be set W, for the FORCE primitive used to send
  users through exits. It also requires lib-match.
  
  Use:
  
	To use the command to move around normally, simply type 'go <cmd or
	exit>'. To go to a remote room you control, type 'goto <room #dbref>'.
  
  Cmd-goto may be freely ported. Please comment any changes.
)
  
$include $lib/match
  
: DoHelp  (  --  ) ( show help screen )
    
    " " .tell
    "cmd-goto" .tell
    " " .tell
    "This soft-coded version of the 'goto' command lets you 'go' through an "
    "exit normally, or go to a room that you control, regardless of its "
    "location or the MUCK's @teleport parameters. To use the command to move " 
    "around normally, simply type 'goto <cmd or exit>'. To go to a room you "
    "own, type 'goto <room #dbref>'."
    strcat strcat strcat strcat .tell
;
  
: DoRoom  ( d --  )  ( move user to room d, provided that s/he controls it )
    
    dup me @ swap controls not if
        pop "Permission denied." .tell exit
    then
    me @ swap moveto
;
    
: DoExit  ( d --  )  ( force user to use exit d )
    
    name
    dup ";" instr dup if
        1 - strcut pop
    else
        pop
    then
    me @ swap force
;
  
: main 
    
    "me" match me !
    dup not if
        exit
    then
    strip dup "#*" smatch if
        dup "#help" swap stringpfx if
            DoHelp exit
        then
        dup 1 strcut swap pop atoi dbref
    then
    dup string? if
        match 
        dup #-1 dbcmp if
            "huh_mesg" sysparm 
            me @ swap notify exit
        then
        dup #-2 dbcmp if
            "I don't know which one you mean!" 
            me @ swap notify exit
        then
				dup #-3 dbcmp if
				  pop me @ getlink
				then
    then
    dup room? if
       DoRoom exit
    then
    dup exit? if
       DoExit exit
    then
    "Bad destination." .tell
;
.
c
q