campfire ; campfires ; Axel 2003-Feb-10 n fire,room,do,nul ;--- check how many seconds it would take to gather wood s room=$$room^%char(who) s do=$$campdo^%room(room) w "You start gathering some wood for a campfire..." d room^%act("$n starts to gather wood for a campfire...",1,who,0) i do>=64 s nul=$$add^%sched(who,%tps*3,1,1,"fail^"_$zn,0,0,who,room) e s nul=$$add^%sched(who,%tps*do,1,1,"done^"_$zn,"cancel^"_$zn,0,who,r$ q fail ;--- camping on that sector does fail d port^%comm(ptr1) w "You were unable to find enough wood.",! q done ;--- campfire is done! n obj,room,who,die,nul,dly s who=ptr1 s room=ptr2 ;--- how long is the fire supposed to live? s die=$$campdie^%room(room)/60 i die<1 s die=1 i die>15 s die=15 ;--- do we already got a fire? s obj=$$findroom^%obj("fire",room,1) i obj>0 g already ;--- create virtual object s obj=$$create^%obj() s nul=$$name^%obj(obj,"fire campfire camp") s nul=$$ldesc^%obj(obj,"A warm fire lights the places.") s nul=$$sdesc^%obj(obj,"a campfire") s nul=$$typeflag^%obj(obj,1) s nul=$$wearflag^%obj(obj,0) s nul=$$timer^%obj(obj,die) ;--- place it to the room and give echo s nul=$$toroom^%obj(obj,room) d char^%act("A warm fire lights the place.",1,who,0) d room^%act("A warm fire lights the place.",1,who,0) ;--- periodical echos s dly=$r(60)+20*%tps s nul=$$add^%sched(0,dly,0,0,"pecho^"_$zn,0,0,obj,0,"campfire") q pecho ;--- periodical echo ; ;--- object gone? i $$ex^%obj(ptr1)<1 q n echo,room,nul s room=$$room^%obj(ptr1) i '$r(3) d . s echo=$p($t(@("echo+"_$r(6))),";",2) . d room^%act(echo,1,0,ptr1) n dly s dly=$r(60)+20*%tps s nul=$$add^%sched(0,dly,0,0,"pecho^"_$zn,0,0,ptr1,0,"campfire") q already ; ;--- reset timer s nul=$$timer^%obj(obj,die) d char^%act("You throw some wood on the fire.",1,who,0) d room^%act("$n throws some wood on the fire.",1,who,0) q echo ;The campfire's flames flicker and dance hypnotically. ;A moth is drawn to the fire and sizzles as it is consumed by the flame$ ;The fire hisses and smokes as a damp piece of wood burns. ;The embers at the centre of the fire glow a dull orange. ;A thin trail of grey smoke rises above the campfire. ;The fire crackles and sends sparks floating up with the smoke. ;$