: say ( s -- ) me @ swap notify ; : wiz_flag ( -- i ) "ABDFHJLMNOQSTUV" 3 pick instr me @ wizard? and ; : check_set ( d s -- ) over ok? not if pop pop -1 exit then over program? if "ABDFHJLMNOSV" over instr 3 pick owner me @ dbcmp and wiz_flag or swap pop swap pop exit then over player? if "AHJLNOSV" over instr 3 pick owner me @ dbcmp and wiz_flag or swap pop swap pop exit then over thing? if "AHJLNOSV" over instr 3 pick owner me @ dbcmp and wiz_flag or swap pop swap pop exit then over room? if "ADHJLNOSV" over instr 3 pick owner me @ dbcmp and wiz_flag or swap pop swap pop exit then over exit? if "AHJLNOSV" over instr 3 pick owner me @ dbcmp and wiz_flag or swap pop swap pop exit then ; : prefix_notify ( s -- ) 4 pick "> " swap strcat " flag: " strcat swap strcat say ; : do_neg_flags begin dup while dup 2 + pick 3 pick check_set dup -1 = if "Invalid Object" prefix_notify then dup not if "Invalid Flag or Permission" prefix_notify then dup 1 = if "Removed" prefix_notify over 3 + pick 4 pick "!" swap strcat set then pop 1 - swap pop loop pop pop ; : do_pos_flags begin dup while dup 2 + pick 3 pick check_set dup -1 = if "Invalid Object" prefix_notify then dup not if "Invalid Flag or Permission" prefix_notify then dup 1 = if "Set" prefix_notify over 3 + pick 4 pick set then pop 1 - swap pop loop pop pop ; : main ( s -- ) dup not if pop "You have to specify some flags to set." say "Usage: flagset =" say " flagset =!" say exit then dup "=" instr not if "Object assumed to be player." say "me=" swap strcat then dup "=" instr 1 - strcut 1 strcut swap pop .sstrip swap .sstrip match dup not if pop pop "I don't see what you want to set." say exit then dup #-2 dbcmp if pop pop "You'll have to be more specific." say exit then dup #-3 dbcmp if pop pop "You can't set those on home!" say exit then swap toupper "" explode over "!" stringcmp not if swap pop 1 - do_neg_flags else do_pos_flags then ;