@prog cond-desc.muf 1 999 d 1 i ( Conditional description program. Give it an argument of the form xxx yyy zzz www where xxx and yyy are dbrefs and zzz and www are property name prefixes. Then if xxx's lock will let yyy pass, this calls #23 with zzz as the prefix; if not, www is used as the prefix. : If www is missing, no output is produced in the "fail" case; if zzz is missing, no output is ever produced, though the lock is still tested, provided xxx and yyy are both present. If one or both of xxx or yyy is missing, nothing happens. If www is missing, and zzz begins with a !, the ! is stripped and the result will be used for the "fail" case, with no output produced in the "success" case - as if the string were www, with zzz missing. : The dbrefs can be numbers or the strings "me" or "loc" [without the quotes], which use me @ and loc @. Numbers are accepted with or without the leading # character. : No provision is made for spaces in zzz. Spaces in www are preserved, except for leading whitespace, which is discarded. : For an example, see the description of this program itself. ) : trimleadsp begin dup " " 1 strncmp not while 1 strcut swap pop loop ; : cutat over over instr dup if rot swap 1 - strcut rot strlen strcut swap pop else pop pop "" then ; : conv-dbref dup "me" strcmp not if pop me @ exit then dup "loc" strcmp not if pop loc @ exit then dup "#" 1 strncmp not if 1 strcut swap pop then atoi dbref ; : main trimleadsp " " cutat trimleadsp " " cutat trimleadsp " " cutat trimleadsp dup not if pop dup "!" 1 strncmp if "" else 1 strcut swap pop "" swap then then 4 rotate dup not if pop pop pop pop exit then conv-dbref 4 rotate dup not if pop pop pop pop exit then conv-dbref swap passlock? not if swap then pop dup if prog "_desc-prog" getpropstr atoi dbref call else pop then ; . c q