Lyntin is a mature multi-platform multi-user-interface mud client written entirely in Python. It's also a framework on top of which you can code additional functionality to suit your needs.
Modues:
- Lyntin_sounds - A module for playing sounds within lyntin, requres pygame.
"Run" script
To use, copy this script into your modules directory (specified by the startup ini) as run.py.
"""
A module to preform automated runs, a series of predefed actions. Usually these are used to move through
the mud to known monsters, then pause while they are dispatched before moving on to the next one.
"""
import sys
from lyntin import exported
from lyntin.modules import modutils
#from PartyTarget import setPartyTarget #Requires the party target module
runs_dict = {}
run_current = []
def definerun_cmd(ses, args, input):
"""
Store a run for future use. Runs are comma seperated steps, each of which are sent to the mud.
Steps starting with "target:" will pause the run and set the target to the remainder of the line.
Steps starting with "pause:" will pause the run and say the remainder of the line to the party.
"""
global runs_dict
runs_dict[args["name"]] = args["value"]
def run_cmd(ses, args, input):
"""
Start a run, which was previously defined with the define run command.
"""
global runs_dict
global run_current
try:
run_current = runs_dict[args["name"]].split(",")
# create a party so status messages can be sent to the party channel
exported.lyntin_command("party create stats", internal=1, session=ses)
runnext_cmd(ses, {}, input)
except KeyError:
exported.write_message("No such run: " + name, ses)
def runnext_cmd(ses, args, input):
"""Take the next step of the run. A current run mus have been set with the run command first."""
global run_current
if len(run_current) == 0:
exported.write_message("The current run is complete.", ses)
return
exported.lyntin_command("brief", internal=1, session=ses)
stop = False
while len(run_current) > 0 and not stop:
step = run_current.pop(0).strip()
if step.startswith("target:"):
stop = True
target = step.split(":")[1]
info = ""
if (len(step.split(":")) > 2):
info = step.split(":")[2]
#setPartyTarget(target, ses) #Requires the party target module
exported.lyntin_command("p' Target: " + target + ". " + info, internal=1, session=ses)
elif step.startswith("pause:"):
exported.write_message("Pause.", ses)
stop = True
else:
exported.lyntin_command(step, internal=1, session=ses)
exported.lyntin_command("brief", internal=1, session=ses)
commands_dict = {}
commands_dict["run"] = (run_cmd, "name")
commands_dict["definerun"] = (definerun_cmd, "name value")
commands_dict["runnext"] = (runnext_cmd, "")
def load():
""" Initializes the module by binding all the commands."""
modutils.load_commands(commands_dict)
def unload():
""" Unbinds the commands (for when we reimport the module)."""
modutils.unload_commands(commands_dict)
In the data directory make a runs.py file to store the run definitions.
#alias {VK_F6} {#runnext}
#definerun malbeth {11 n, 20 w, 17 w,path,2 s,sw,2 w,2 n,nw,n,target:guard:50K \
,enter,w,target:guard:50K \
,e,n,target:peasant:2x 68K \
,e,n,target:guard:50K \
,S,w,out,s,se,3 s,2 e,ne,3 n,17 e,20 e,11 s, p' At CS}
To use it stand at the CS and type #run malbeth. Dispatch the first mob and press F6 to move on.
last updated 1 year ago
#