Practice Automation

Post Reply
xaknoir
Posts: 2
Joined: Fri Sep 21, 2018 10:15 pm

Practice Automation

Post by xaknoir »

Just got back into a mud I played ages ago and am trying to use triggers to practice spells on one character while doing something less boring on another (our limit is 2 characters). The problem is I have no real code experience and the LUA stuff I've looked up so far makes no sense.

Id like to get data from the mud in the form of a list of spells (that would look like this but with more than 5):

You know of the following spells:
Spell1-----------------Spell Level: X----- Level: X (the ------ are a random number of spaces)
Spell2-----------------Spell Level: X-----Level: X
Spell3-----------------Spell Level: X----- Level: X
Spell4-----------------Spell Level: X-----Level: X
Spell5----------------- Spell Level: X-----Level: X

I only want to practice a spell if the spell level is under a value I choose, lets say 5. The "Level: X" at the right of each row is the level the spell is learned and is irrelevant for what I'm wanting to do.

Id like to practice Spell1 until I get a message from the client that the knowledge has increased. At which time the trigger would practice Spell2 and repeat until all spells can no longer be practiced and require a trip to a master to increase their level.
An echo like (Time to go see the trainer)...

P2racticing the spell is simply casting a low level of the spell over and over, which would look like:

cast 0 'spell1'

Casting: spell1****
X/XH X/XM X/XV XA XG XX > (this is character info that is displayed after each action/input)

Casting: spell1***
X/XH X/XM X/XV XA XG XX >

Casting: spell1**
X/XH X/XM X/XV XA XG XX >

Casting: spell1*
X/XH X/XM X/XV XA XG XX >

You complete your spell...
SpellCompletionMessage. (some kind of message based on what the spell does to the target)
Your knowledge of spell1 increases! (if the knowledge increase)
OR
You need to visit a master to learn more about spell1! (if it can no longer be practiced, would be removed from the list or skipped)

The number of countdown casts varies by current level of the spell I think...

Idk if this is possible but I would appreciate any help.

User avatar
Vadi
Posts: 5041
Joined: Sat Mar 14, 2009 3:13 pm

Re: Practice Automation

Post by Vadi »

Yep it's definitely possible! Definitely not a trivial small trigger, so be prepared to learn a lot to get it going. Get started by watching the tutorials on how to make basic triggers: https://www.mudlet.org/media as well as the introduction on triggers: https://wiki.mudlet.org/w/Manual:Introduction#Triggers

Jor'Mox
Posts: 1146
Joined: Wed Apr 03, 2013 2:19 am

Re: Practice Automation

Post by Jor'Mox »

I know scripting can seem a bit overwhelming when you first get started. I find the key is to break it down into its component parts, and then get them working one at a time.

To help get you started, here is the general approach I would go with for what you are talking about.
  1. Capture "You know the following spells" line to clear the data table and turn on other triggers
  2. Capture individual spell lines to add data to table
  3. Capture some indicator of the end of the list of spells to turn that trigger off and kick things off
  4. Sort captured list to see what you want to practice first, and get rid of spells you don't need to practice
  5. Send the first command and enable necessary trigger(s) to let you know when the spell has finished and any extra info (i.e you got better or you can't get any better)
  6. Use the spell completion triggers to set variables that you use when a prompt or similar trigger fires following them
  7. Once again, go through the list to see what you want to work on, and if you are done, raise an alert.

xaknoir
Posts: 2
Joined: Fri Sep 21, 2018 10:15 pm

Re: Practice Automation

Post by xaknoir »

So far ive gotten:
Gate Trigger
You know of the following spells:
spells_practice = {}
Capture Trigger
^(.+)\s+Spell Level:\s*(\d+)\s+Level:\s+(\d+)\s*$
table.insert(spells_practice, matches[2] .. matches[3])
Page Advance Trigger to go through spells/skills until I reach skills then stop.
Gate Close Trigger
You know of the following skills:
send("q")
setTriggerStayOpen("Gate", 0)
cecho("\n<green>Spells to Practice!: <red>" .. table.concat(spells_practice, ", "))

Post Reply