At the request of
@Tarkenton and
@Salome, here is how I approached the task of making a bashing timer and gold-per-minute calculator. My first instinct is to work with information that's visible to me, so this first draft only triggers on actual gold drops and pick-ups. It's limited and inefficient, but it gets the job done as long as the proper information appears on my screen. It begins by starting the hunt:
This starts the stopwatch, sets my picked-up gold this session at zero, and my starting gold at whatever total gold I have at the moment (for use by my failed script at the end of this post).
Then I look for gold to drop, and pick it up when I get balance (again, triggered by what I see, since I don't know how to work with gmcp directly yet - more on that in a minute).
Then finally, some math and displaying of info. It displays the stopwatch time (divided by 60 so it's in minutes, rather than seconds), and it divides the gold picked up in the session by the stopwatch time (multiplied by 60 so it's gold per minute, rather than gold per second). This is the part I'm mostly happy with, since it does what I expect and I understand it.
This seems to work for me, but only if all the information I need appears on my screen.
I know there's a better way with GMCP data. I feel like I should be able to track any change in my gold, even if it's received through influencing, or from bards and scholars, or from another player, or even an origami. Here's what I've got and how I expect it to work.
My expectation is that any time there's a change in gmcp.Char.Status gold, if it's higher than what I started the session with, it'll display the same information as my trigger above. Trouble is, I think I have a fundamental misunderstanding of how the Scripts section of Mudlet is supposed to work. Or else I really don't get functions. Am I anywhere close to the right track? What I'd love to hear is that I've got everything I need here in the deltaGold script, and I just need something... else, somewhere, to activate it and make sure it fires every time there's a change in my gold status. Also, I'm open to complete revisions of all this mess to make it into something more efficient.
Comments
Edit: Thanks to some small mistakes I fixed, it works. Other people @Aurik @Ssaliss are tinkering with it too.
A two minor ideas for you:
- Consider using avarice enchant to save yourself the trouble with the gold pickup triggers.
- You can make triggers to fire on prompt by switching trigger type to 'lua function' and using 'return isPrompt()' as trigger. Thus, you
can have it fire on every prompt and simply print something if the amount of gold has changed, meaning you save your amount of gold on 'hunton' and then just compare / update the gold variable everytime it changes on every prompt If that's confusing, let me know and I'll craft you an example tonight.
Oh, then I learned something to improve my own stuff as well. I didn't realize things like Status.Gold were real events.
Estarra the Eternal says, "Give Shevat the floor please."
Estarra the Eternal says, "Give Shevat the floor please."