Advertisement
Kovitikus

Example Sunrise

Sep 6th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. # in a file ingame_time.py in mygame/world/
  2.  
  3. from evennia.utils import gametime
  4. from typeclasses.rooms import Room
  5.  
  6. def at_sunrise():
  7.     """When the sun rises, display a message in every room."""
  8.     # Browse all rooms
  9.     for room in Room.objects.all():
  10.         room.msg_contents("The sun rises from the eastern horizon.")
  11.  
  12. def start_sunrise_event():
  13.     """Schedule an sunrise event to happen every day at 6 AM."""
  14.     script = gametime.schedule(at_sunrise, repeat=True, hour=6, min=0, sec=0)
  15.     script.key = "at sunrise"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement