def cogitate(self): # Move randomly within the zone. schedule_event(randint(10, 30), lambda: self.character.move_in_zone()) # Schedule the next cogitate in 30 ticks. schedule_event(30, lambda: self.cogitate())
def __init__(self, name, description, hp, keywords=[], takable=False): self.name = name self.description = description self.keywords = keywords self.attachments = [] self.inventory = [] self.current_hp = hp self.max_hp = hp self.takable = takable self.short_description = self.name self.brain = NPCBrain(self) self.where_goes_when_dies = THE_TRASH # NPCs have both stimulus response and self-directed action, # as carried out by a scheduled 'cogitate' method. schedule_event(0, lambda: self.brain.cogitate())
def _scheduled(): num_hours = float(request.form["quantity"]) print("NUM_HOURS: ", num_hours) return "Your meeting is scheduled for: " + str( scheduler.schedule_event(num_hours))