: say me @ swap notify ; : osay loc @ me @ rot notify_except ; : do_pack trigger @ location "*packed?" getpropstr if "Pipe error> The pipe is already packed." say exit then trigger @ location "*packed?" "yes" 0 addprop trigger @ location "_pack" getpropstr me @ swap pronoun_sub say trigger @ location "_opack" getpropstr me @ swap pronoun_sub osay trigger @ location "_name" getpropstr " (packed and unlit)" strcat trigger @ location swap setname ; : do_light trigger @ location "*lit?" getpropstr if "Pipe error> The pipe is already lit." say exit then trigger @ location "*packed?" getpropstr not if "Pipe error> The pipe is not packed yet." say exit then trigger @ location "*lit?" "yes" 0 addprop trigger @ location "_light" getpropstr me @ swap pronoun_sub say trigger @ location "_olight" getpropstr me @ swap pronoun_sub osay trigger @ location "_name" getpropstr " (packed and lit)" strcat trigger @ location swap setname ; : do_smoke trigger @ location "*lit?" getpropstr not if "Pipe error> The pipe is not lit yet." say exit then trigger @ location "*smoking?" getpropstr if "Pipe error> The pipe is already being smoked." say exit then trigger @ location "*smoking?" "yes" 0 addprop "%N puts the pipe to %p lips and begins smoking it." me @ swap pronoun_sub dup say osay trigger @ location "_name" getpropstr " (being smoked)" strcat trigger @ location swap setname 10 begin dup while random 120 % 61 + sleep trigger @ location "_smoke#" getpropstr atoi random swap % 1 + intostr trigger @ location "_smokemsg" rot strcat getpropstr me @ swap pronoun_sub dup say osay 1 - loop pop random 120 % 61 + sleep "%N's pipe tobacco gets used up and the pipe goes out." me @ swap pronoun_sub dup say osay trigger @ location "_name" getpropstr " (extinguished)" strcat trigger @ location swap setname trigger @ location "*lit?" remove_prop trigger @ location "*smoking?" remove_prop trigger @ location "*packed?" remove_prop ; : do_stash trigger @ location "*stashed?" getpropstr if "Pipe error> The pipe is already stashed." say exit then trigger @ location "*smoking?" getpropstr if "Pipe error> The pipe is being smoked." say exit then trigger @ location "*lit?" getpropstr if "Pipe error> The pipe is lit." say exit then trigger @ location "*stashed?" "yes" 0 addprop trigger @ location "*lit?" remove_prop trigger @ location "*packed?" remove_prop trigger @ location "*smoking?" remove_prop trigger @ location "_stash" getpropstr me @ swap pronoun_sub say trigger @ location "_ostash" getpropstr me @ swap pronoun_sub osay trigger @ location "_name" getpropstr " (put away)" strcat trigger @ location swap setname ; : do_produce trigger @ location "*stashed?" getpropstr not if "Pipe error> The pipe is already exposed." say exit then trigger @ location "*stashed?" remove_prop trigger @ location "_produce" getpropstr me @ swap pronoun_sub say trigger @ location "_oproduce" getpropstr me @ swap pronoun_sub osay trigger @ location "_name" getpropstr " (unpacked and unlit)" strcat trigger @ location swap setname ; : do_reset trigger @ location "*smoking?" remove_prop trigger @ location "*lit?" remove_prop trigger @ location "*packed?" remove_prop do_stash ; : main pop trigger @ name "auto" stringcmp not if do_produce 15 sleep do_pack 15 sleep do_light 15 sleep do_smoke 15 sleep do_stash exit then trigger @ name "pack" stringcmp not if do_pack exit then trigger @ name "light" stringcmp not if do_light exit then trigger @ name "smoke" stringcmp not if do_smoke exit then trigger @ name "stash" stringcmp not if do_stash exit then trigger @ name "produce" stringcmp not if do_produce exit then trigger @ name "reset" stringcmp not if do_reset exit then ;