Pet
A simple pet that still needs a bit of work. (For Aleltai)
@zcreate Delilah,Female,Cat,del=pet/delilah
@act run;pet=$pet/delilah=$pet/delilah:run=$nothing
@succ $pet/delilah:run={with:pet,{loc:this},{lexec:{&cmd},#43520}}
@set #43520=start:{null:{store:{lunion:{prop!:running_pets},{&pet}},running_pets},{store:1,running,{&pet}},{if:{gt:{subt:{secs},{prop!:lastrun}},5},{delay:1,`{lexec:runloop}`}}}}
@set #43520=_msgmacs/pose:{force:{:1},:{subst:{:2},%p,{if:{eq:{default:{prop:gender,{:1}},female},male},his,her}}}
@set #43520=_msgmacs/petowner:{default:{prop:pet/owner,{:1}},*Riverdale}
@set #43520=_msgmacs/home:{force:{:1},j {petowner:{:1}}}{if:{not:{nearby:{:1},{petowner:{:1}}}},{force:{:1},gohome}}
@set #43520=_msgmacs/isrunning:{lmember:{prop:}}
lsedit #43520=runloop
.del ^ $
{null:
{store:{secs},lastrun},
{foreach:pet,
{prop!:running_pets},
{if:
{not:
{nearby:
{&pet},
{petowner:{&pet}}}},
{lexec:seekowner},
{if:
{and:
{gt:
{subt:
{secs},
{prop:lastpose,{&pet}}},
60},
{eq:{dice:15},1}},
{lexec:dopose}}}}
{delay:3,`{lexec:runloop}`}}
.end
lsedit #43520=dopose
.del ^ $
{pose:
{&pet},
{lrand:
{if:{propdir:poses#,{&pet}},
{list:poses,{&pet}},
{list:poses}}}}
{store:{secs},lastpose,{&pet}}
.end
lsedit #43520=poses
.del ^ $
stretches out %p limbs.
yawns, tongue curling.
paws at something invisible.
rubs up against the wall.
flicks %p tail.
sits on the floor and licks %p paw.
mews softly.
's ear twitches.
brushes %p nose with %p paw.
.end
lsedit #43520=seekowner
.del ^ $
{pose:{&pet},suddenly notices that %p owner is gone and runs off.}
{home:{&pet}}
{if:
{dbeq:{loc:{&pet}},{petowner:{&pet}}},
{pose:{&pet},leaps into {name:{loc:{&pet}}} arms.},
{pose:{&pet},saunters in behind {name:{petowner:{&pet}}}}}
.end
lsedit #43520=run
.del ^ $
{exec!:start}
{name:{&pet}} is now running.
.end
lsedit #43520=pet
.del ^ $
{null:
{exec!:start}
{tell:You pet {name:{&pet}}.}
{otell:pets {name:{&pet}}.},
{pose:{&pet},coos appreciatively.}}
.end