ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Pulling the trials timer value(s) (https://www.esoui.com/forums/showthread.php?t=2032)

NickK 07/28/14 05:11 PM

Pulling the trials timer value(s)
 
Is there any way i can get the value(s) of the timer that starts as soon as you enter a trial? I searched in functions in the API but didn't find anything relevant, is there something that i might be missing?

I found a workaround to do what i wanna do, but if i could pull the values straight from the server/client it would be much better.

Thanks in advance.

merlight 07/28/14 06:18 PM

Lua Code:
  1. -- found this, not sure it's what you want
  2. local raidDuration, penaltyTime = GetCurrentRaidTime()

Randactyl 07/28/14 06:27 PM

What's your workaround?

Looking through zgoo, I see the following trials related items:
Code:

    ["EVENT_RAID_LEADERBOARD_DATA_CHANGED"] = 131143
    ["EVENT_RAID_LEADERBOARD_PLAYER_DATA_CHANGED"] = 131144
    ["EVENT_RAID_PARTICIPATION_UPDATE"] = 131141
    ["EVENT_RAID_REVIVE_COUNTER_UPDATE"] = 131140
    ["EVENT_RAID_SCORE_NOTIFICATION_ADDED"] = 131145
    ["EVENT_RAID_SCORE_NOTIFICATION_REMOVED"] = 131146
    ["EVENT_RAID_TIMER_STATE_UPDATE"] = 131142
    ["EVENT_RAID_TRIAL_COMPLETE"] = 131137
    ["EVENT_RAID_TRIAL_FAILED"] = 131138
    ["EVENT_RAID_TRIAL_NEW_BEST_TIME"] = 131139
    ["EVENT_RAID_TRIAL_STARTED"] = 131136

    ZO_Announce_GetCurrentRaidTrialTimeString()

So you could start your own timer on EVENT_RAID_TRIAL_STARTED, add appropriate time on EVENT_RAID_REVIVE_COUNTER_UPDATE, and stop your timer on either EVENT_RAID_TRIAL_COMPLETE or EVENT_RAID_TRIAL_FAILED. Or maybe pull it out of ZO_Announce_GetCurrentRaidTrialTimeString() at set intervals

edit: disregard me, I missed GetCurrentRaidTime() [duh]

NickK 07/31/14 03:33 PM

Quote:

Originally Posted by Randactyl (Post 10935)
What's your workaround?

Looking through zgoo, I see the following trials related items:
Code:

    ["EVENT_RAID_LEADERBOARD_DATA_CHANGED"] = 131143
    ["EVENT_RAID_LEADERBOARD_PLAYER_DATA_CHANGED"] = 131144
    ["EVENT_RAID_PARTICIPATION_UPDATE"] = 131141
    ["EVENT_RAID_REVIVE_COUNTER_UPDATE"] = 131140
    ["EVENT_RAID_SCORE_NOTIFICATION_ADDED"] = 131145
    ["EVENT_RAID_SCORE_NOTIFICATION_REMOVED"] = 131146
    ["EVENT_RAID_TIMER_STATE_UPDATE"] = 131142
    ["EVENT_RAID_TRIAL_COMPLETE"] = 131137
    ["EVENT_RAID_TRIAL_FAILED"] = 131138
    ["EVENT_RAID_TRIAL_NEW_BEST_TIME"] = 131139
    ["EVENT_RAID_TRIAL_STARTED"] = 131136

    ZO_Announce_GetCurrentRaidTrialTimeString()

So you could start your own timer on EVENT_RAID_TRIAL_STARTED, add appropriate time on EVENT_RAID_REVIVE_COUNTER_UPDATE, and stop your timer on either EVENT_RAID_TRIAL_COMPLETE or EVENT_RAID_TRIAL_FAILED. Or maybe pull it out of ZO_Announce_GetCurrentRaidTrialTimeString() at set intervals

edit: disregard me, I missed GetCurrentRaidTime() [duh]

I've been doing that with the EVENT_RAID_TRIAL_STARTED, as for the the REVIVE_COUNTER_UPDATE and the 2 completion events, they don't work, i don't know if they used to work, but they don't anymore, the event doesn't fire off at all. I will try the ZO_Announce_GetCurrentRaidTrialTimeString() and see how it works out.

Also i'll try what merilight said and report back for future reference.

Thanks both for your info.

NickK 07/31/14 06:36 PM

What merilight wrote works, but i have hard time converting their ms into seconds, i can convert it into minutes by dividing the number by 60000 but it's impossible to get the correct amount of seconds, i divide the number by 1000 but the counter keeps going up after 60sec and i can not find a way to make it reset and start counting again.

merlight 07/31/14 08:58 PM

Lua Code:
  1. -- milliseconds to whole minutes elapsed
  2. local mins = math.floor(ms / 60000)
  3. -- and seconds modulo 60
  4. local secs = math.floor(ms / 1000) % 60
  5. -- print e.g. 13:07
  6. d(("time %d:%02u"):format(mins, secs))

NickK 07/31/14 09:44 PM

Thanks again merlight but i just found the answer 5 mins ago :) It works like a charm now.


All times are GMT -6. The time now is 07:25 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI