Greetings,
I am in the process of writing an auto-defense raising ("defup") script for my system and I am going back and forth with how to implement it. In TinyFugue I accomplished this using cascading timers, where the delays were cumulative based on the balance/equilibrium taken by raising each defense. This was a bit annoying because if I did anything that changed my balance and equilibrium recovery times (i.e. changed class, changed statpack) I had to go back and recalculate the cumulative delays,
I feel as if there should be a clever way to accomplish the same end in Mudlet using trigger chains/filters without having to muddle with cumulative delays. I have a few ideas in mind but before committing to any of them I wanted to ask the community whether any of you have come upon a solution for such a problem that you believe to be easy to maintain.
Thanks for your time!
Thoughts on defense raising ("defup") scripts
-
- Posts: 48
- Joined: Sun Feb 06, 2011 2:00 pm
Re: Thoughts on defense raising ("defup") scripts
One simple solution would be to add all commands to a queue, and execute a command from a queue & remove it upon receiving balance/eq regain. You can pause that, clear it, add things to it easily...
That's just one of the ways off the top of my head
That's just one of the ways off the top of my head
-
- Posts: 48
- Joined: Sun Feb 06, 2011 2:00 pm
Re: Thoughts on defense raising ("defup") scripts
I actually like the queue idea. I never used a formal queue in my Tf system due to the lack of higher level data structures. That said, I'd like to learn more about their uses in text-based RPG systems given that Mudlet seems to readily support them.
I really like the queue function that is described here: Custom quick queues
Was this ever implemented into LuaGlobal?
I really like the queue function that is described here: Custom quick queues
Was this ever implemented into LuaGlobal?
Re: Thoughts on defense raising ("defup") scripts
No, but this doesn't mean that you can't copy/paste the script he's used into a mudlet script and go ahead with the usage.
-
- Posts: 48
- Joined: Sun Feb 06, 2011 2:00 pm
Re: Thoughts on defense raising ("defup") scripts
Of course. I just wanted to ensure that there wasn't a module already integrated into LuaGlobal that provided the same functionality. I believe I'll integrate Iocun's sendQueue functionality and just modify it to my needs. Thanks for the suggestion!
Re: Thoughts on defense raising ("defup") scripts
I have a table of my defences and a table of active (or borked) defences. I have an alias that fires it up.
The main script basically waits for equilibrium and then scans the available defences, checking the active defence table.
A bunch of triggers fill in the defence table, either with success or not (e.g. a defence may need sunlight and its nighttime). These are still set so the scanning function skips over them.
So basically what happens is
1. I type the alias command
2. defences and spirits commands sent
3. scan all defence and sprit lines to pre-populate the active table, wait to the end of the def/spirit line to enable #4
4. walk the available defence table until i find the first item not in active table, send the command
5. wait for eq
6. back to 4
Step 4 also has a reaching the end of table check so i know everything is working.
The main script basically waits for equilibrium and then scans the available defences, checking the active defence table.
A bunch of triggers fill in the defence table, either with success or not (e.g. a defence may need sunlight and its nighttime). These are still set so the scanning function skips over them.
So basically what happens is
1. I type the alias command
2. defences and spirits commands sent
3. scan all defence and sprit lines to pre-populate the active table, wait to the end of the def/spirit line to enable #4
4. walk the available defence table until i find the first item not in active table, send the command
5. wait for eq
6. back to 4
Step 4 also has a reaching the end of table check so i know everything is working.