One person chair
To the extent possible under law, the person who associated CC0 with this work has waived all copyright and related or neighboring rights to this work.
The code behind a one-person chair.
Realm-wide properties:
on_wake
: Code: locations.location_name_here.is_sat = False
This is just a simple line of code that makes sure that people aren't still counted as 'sitting' when the age is empty.
Location properties:
Place these in the location you'd like the chair to be.
desc
: Text:
Normal description [$if is_sat==ObjectId(players.player())] You could [stand up|chair_stand]. [$elif not is_sat] You could [sit in the chair|chair_sit]. [$else] [[players.name(players.player(is_sat))]] is sitting in the chair. [$end] More description
Note that you can place
[$if is_sat==ObjectId(players.player())]
in front of things you want to appear when the person is sitting. For example, this:[$if is_sat==ObjectId(players.player())] Behind you is the door that leads back out into the middle of the house. [$else] Behind you is the door that leads back [out into the middle of the house|back]. [$end]would make sure that the person sitting down can't leave without first standing up.
chair_sit
: Code:
if not is_sat: is_sat = ObjectId(players.player()) event("You sit in the chair.", text("[$name] sits down in the chair."))
chair_stand
: Code:
if is_sat==ObjectId(players.player()): is_sat = False event("You stand up.", text("[$name] stands up."))
is_sat
: Value: False
on_leave
: Code:
if is_sat == ObjectId(players.player()): is_sat = False
A big thanks to Pavitra for helping me out on this one.