def start_routine(ch): '''starts a character routine event in motion''' time = __dflt_routine_step_time__ aux = ch.getAuxiliary("routine_data") item = aux.routine[aux.step] if isinstance(item, tuple): time = item[0] event.start_event(ch, time, routine_event)
def dns_check_event(owner, void, info): '''After a socket connects, monitor their hostname until dns lookup is complete. Then, put the socket into the account handler. ''' sock, = hooks.parse_info(info) if sock != None and sock.can_use: sock.send(" Lookup complete.") sock.send("================================================================================") sock.send(mud.get_greeting()) sock.pop_ih() sock.bust_prompt() # mud.log_string("new connection from " + sock.hostname) else: event.start_event(None, 0.2, dns_check_event, None, info)
def cmd_delay(ch, cmd, arg): '''Usage: delay <seconds> <command> Allows the user to prepare a command to be executed in the future. For example: > delay 2 say hello, world! Will make you say \'hello, world!\' two seconds after entering the delayed command.''' try: secs, to_delay = mud.parse_args(ch, True, cmd, arg, "double string") except: return if secs < 1: ch.send("You can only delay commands for positive amounts of time.") else: ch.send("You delay '%s' for %.2f seconds" % (to_delay, secs)) event.start_event(ch, secs, event_delayed_cmd, None, to_delay)