I have a rather large and complicated scheme going for a script I've built to tell me how long I have until completing the current project I'm building in the MUD, but I've been having multiple problems with the math part of the equation, some of them being because I don't know how to convert everything into the proper formats. Right now I have this:
<aliases>
<alias
match="ptest"
enabled="y"
send_to="12"
sequence="100"
>
<send>EnableTrigger("test1", true)
Send("list")
DoAfter(1, "list")
EnableTimer("math", true)
ResetTimer("math")</send>
</alias>
</aliases>
<triggers>
<trigger
expand_variables="y"
keep_evaluating="y"
match="^(.*?) taken\) (.*?)\% Complete$"
name="test1"
regexp="y"
send_to="12"
sequence="99"
>
<send>test1 = "%2"
Note (test1)
EnableTrigger("test1", false)
ResetTimer("test2")
EnableTimer("test2", true)</send>
</trigger>
<trigger
expand_variables="y"
match="^(.*?) taken\) (.*?)\% Complete$"
name="test2"
regexp="y"
send_to="12"
sequence="99"
>
<send>test2 = "%2"
Note (test2)
EnableTrigger("test2", false)</send>
</trigger>
</triggers>
<timers>
<timer name="test2" second="0.50" offset_second="0.00" send_to="12"
>
<send>EnableTrigger("test2", true)
EnableTimer("test2", false)</send>
</timer>
<timer name="math" second="2.00" offset_second="0.00" send_to="12"
>
<send>test3 = 100/(test2-test1)
Note "Total time:"
Note (test3)
Note "Remaining time:"
EnableTimer("math", false)</send>
</timer>
</timers>
The goal is to take this line:
Hydra Regen Soft (Alpha) - 6 144Mp (158Mp taken) 18.33% Complete
Two times (one second apart) and get the % from it each time, then examine the difference and convert that into a time estimate (it doesn't have to be exact but thus far it's been anything but accurate). Some of it I accidentally lost when copying these here (I tend to leave bits of code on my copyboard) so the math timer is now completely broken.
If anyone can help me figure out where I'm going wrong, how to convert the end product into time, or give me general tips for fixing this heaping mess of newbstink, it would be greatly appreciated. |