nakedmudv3.6/
nakedmudv3.6/lib/
nakedmudv3.6/lib/help/A/
nakedmudv3.6/lib/help/B/
nakedmudv3.6/lib/help/C/
nakedmudv3.6/lib/help/D/
nakedmudv3.6/lib/help/G/
nakedmudv3.6/lib/help/H/
nakedmudv3.6/lib/help/J/
nakedmudv3.6/lib/help/L/
nakedmudv3.6/lib/help/M/
nakedmudv3.6/lib/help/O/
nakedmudv3.6/lib/help/P/
nakedmudv3.6/lib/help/R/
nakedmudv3.6/lib/help/S/
nakedmudv3.6/lib/help/W/
nakedmudv3.6/lib/logs/
nakedmudv3.6/lib/misc/
nakedmudv3.6/lib/players/
nakedmudv3.6/lib/txt/
nakedmudv3.6/lib/world/
nakedmudv3.6/lib/world/examples/
nakedmudv3.6/lib/world/examples/mproto/
nakedmudv3.6/lib/world/examples/oproto/
nakedmudv3.6/lib/world/examples/reset/
nakedmudv3.6/lib/world/examples/rproto/
nakedmudv3.6/lib/world/examples/trigger/
nakedmudv3.6/lib/world/limbo/
nakedmudv3.6/lib/world/limbo/room/
nakedmudv3.6/lib/world/limbo/rproto/
nakedmudv3.6/src/alias/
nakedmudv3.6/src/dyn_vars/
nakedmudv3.6/src/editor/
nakedmudv3.6/src/example_module/
nakedmudv3.6/src/help2/
nakedmudv3.6/src/set_val/
nakedmudv3.6/src/socials/
nakedmudv3.6/src/time/
'''
demo_prompt.py

Provides a short demo on how to write prompts and input handlers in Python, as
well as how the default prompt can be overwritten in Python.
'''
import mud, mudsys, socket

def new_prompt(sock):
    '''this prompt will be used to override the default NM prompt'''
    sock.send_raw("\r\nnew prompt> ")

def example_prompt(sock):
    '''used as an example of how to interact with the input handler stack'''
    sock.send_raw("\r\nexample prompt> ")

def example_handler(sock, arg):
    '''used as an example of how to interact with the input handler stack'''
    if arg.upper() == 'Q':
        sock.pop_ih()
    else:
        sock.send("You typed " + arg + ". Q to quit.")

def cmd_pyih(ch, cmd, arg):
    '''used as an example of how to interact with the input handler stack'''
    ch.socket.push_ih(example_handler, example_prompt)
    ch.send("New input handler set.")


# add the command that allows us to interact with the input handler stack
mudsys.add_cmd("pyih", None, cmd_pyih, "admin", False)

# override our default prompt with a new one
mudsys.show_prompt = new_prompt