Thread Tools Display Modes
Prev Previous Post   Next Post Next
05/27/15, 06:07 PM   #1
Luxor
 
Luxor's Avatar
Join Date: May 2015
Posts: 7
Question 10 Min (Dolmens Timer) - Help Request

So after three days of learning how to use lua and xml, I'm still very much lost when it comes to actually creating something of my own.

What I'm trying to do is create a 10min timer (doesn't matter whether its counting up or down). I'm currently working with seconds as minutes seem a bit complicated as I think i'd have to display the active conversion of minutes from seconds, which itself is already out of my present abilities.

At the moment, I have a functional counter synced to GetFrameDeltaTimeSeconds() every time my addon updates however, GetFrameDeltaTimeSeconds() seems to be 3x the speed of actual seconds on a clock. It's still better than updating every frame but it still isn't what I want it to be.
My current codes are:

Timer.lua

Lua Code:
  1. local counter = 0
  2. local delta = GetFrameDeltaTimeSeconds()
  3.  
  4. function TimerUpdate()
  5.     TimerCounter:SetText(string.format("Timer: %0.2fs", counter))
  6.     counter = counter + delta
  7. end
  8.  
  9. function TimerInitalized()
  10. end


Timer.xml
Code:
<GuiXml>
    <Controls>
        <TopLevelControl name="Timer">
            <Dimensions x="200" y="42" />
            <Anchor point="CENTER" />
 
            <OnUpdate>
                TimerUpdate()
            </OnUpdate>
 
            <OnInitialized>
                TimerInitialized()
            </OnInitialized>
 
            <Controls>
                <Backdrop name="$(parent)BG" inherits="ZO_ThinBackdrop" />
                <Label name="$(parent)Counter" font="ZoFontWindowTitle" color="CFDCBD" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="Timer: ">
                    <AnchorFill />
                </Label>
            </Controls>
        </TopLevelControl>
    </Controls>
</GuiXml>
Also I wouldn't even know how to get it to stop once it reached 600secs (10 mins).

In pure Lua it would look something like this:

Lua Code:
  1. function sleep(s)
  2.   local atime = os.time() + s
  3.   repeat until os.time() > atime
  4. end
  5.  
  6. Time = 0
  7.  
  8. for i=Time, 599 do
  9.     print (i + 1)
  10.     sleep(1)
  11. end

However, I don't know how to even implement something like that into ESO.

All help is appreciated.

Thanks in advance!

Last edited by Luxor : 05/27/15 at 06:49 PM.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » 10 Min (Dolmens Timer) - Help Request


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off