Guest Counter
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.
I've seen a couple of people build guest-counters -- a simple ticker that can be incremented by any visitor.
If you do this naively, however, it will be left open to false counting. If a player spams the "sign" link, you don't want the counter to keep incrementing. It should be limited to once per player.
To do this, create a player default property in your world:
has_signed
: (Value) False
And then a location property, for the counter:
counter
: (Value) 0
The action code will a code property, like this:
sign_counter
: (Code):
if not player.has_signed: player.has_signed = True counter += 1 event("You add a mark to the tally.", text("[$name] marks the tally.")) else: event("You’ve already marked the tally.")
The text in the location description might look like this:
[[counter]] people have marked the tally. [Mark it yourself?|sign_counter]
But if you want to remove the link entirely once it's been used, you could do this:
[[counter]] people have marked [$if not player.has_signed]the tally. [Mark it yourself?|sign_counter] [$else]the tally, including you. [$end]
When testing, you can use the debug command /eval del player.has_signed
to reset your has_signed
flag.