Earth time clock

Discussion in 'Player Created Lua Script Repository' started by CatweazleX, Dec 2, 2019.

Thread Status:
Not open for further replies.
  1. CatweazleX

    CatweazleX Avatar

    Messages:
    653
    Likes Received:
    777
    Trophy Points:
    93
    Location:
    Veritas Sanctuary
    Code:
    -- clock by Catweazle Waldschrath
    -- depends on libsota.0.4.6
    
    
    function ShroudOnStart()
    
    ui.onInit(function()
    
        clock = {
            enabled = true,
            label = createLabelWithShadow(5, 0),
            timer = setInterval(10, function()
                setLabelCaption(clock.label, string.style(os.date("%c"), { size=20, color="#c4a000" }))
            end),
        }
        showLabel(clock.label)
     
        ui.command.add("clock", function()
            clock.enabled = not clock.enabled
    
            setTimerEnabled(clock.timer, clock.enabled)
            setLabelVisible(clock.label, clock.enabled)
     
            local msg = createLabel(nil, nil, 200, 120)
            if isTimerEnabled(clock.timer) then
                setLabelCaption(msg, "<size=18><color=white>clock activated</color></size>")
            else
                setLabelCaption(msg, "<size=18><color=white>clock deactivated</color></size>")
            end
            showLabel(msg)
            setTimeout(3, function() removeLabel(msg) end)
        end)
        ui.shortcut.add("pressed", "RightAlt", "C", "clock")
     
    end)
    
    
    
    
    end -- ShroudOnStart
    
    -- implement other ShroudOn... to allow other scripts
    function ShroudOnConsoleInput() end
    function ShroudOnGUI() end
    function ShroudOnUpdate() end
    
    
    depends on libsota and libsota.util. Can be found here


    Shows the date and time in the upper left.
    Can be deactivated/activated with RightAlt + c or bei typing \clock into the chat window

    [​IMG]
    upper/left : clock.lua | upper / center : loctrack.lua | below paperdoll : paperdoll.lua


    Update:

    RightAlt + C cycles now between local time, "Novia" time (it is the time in Austin/Texas) and off

    The clock implements the following commands:
    \clock - cycles through local, Novia and off
    \clock tz or \clock timezone - outputs the time zone the player is currently in (console (lua channel))
    \clock nbb or \clock Novia - shows "Novia" time
    \clock tig or \clock timeInGame - additionally shows the duration the player is in game and also turn it off again
    \clock tis or \clock timeInScene - additionally shows the duration the player is in the current scene and turn it off again
    \clock on or \clock local - shows local time
    \clock off or \clock false - deactivate the clock


    locTrack:
    RightAlt + T toggles the location tracker on/off

    locTrack implments the command:
    \loctrack - activate / deactivate the loc tracker


    -----
    I do not made extra threads for loctrack.lua and paperdoll.lua, since this are leftovers from testing the functionality of libsota and co. They may be used as blueprint, and also clock.lua, to make your own Add-Ons.
    Discussions regarding libsota are found here
     
    Last edited: Dec 10, 2019
  2. FrostII

    FrostII Bug Hunter

    Messages:
    5,890
    Likes Received:
    11,039
    Trophy Points:
    153
    Gender:
    Male
    Location:
    Pacific Northwest
    How about a pic of it ingame .... ;)
     
  3. CatweazleX

    CatweazleX Avatar

    Messages:
    653
    Likes Received:
    777
    Trophy Points:
    93
    Location:
    Veritas Sanctuary
  4. CatweazleX

    CatweazleX Avatar

    Messages:
    653
    Likes Received:
    777
    Trophy Points:
    93
    Location:
    Veritas Sanctuary
    Updated clock.lua on the cloud drive to show also time in game. (earth time | time played)
    One can also type \info client , \info player, \info scene, \info stat <name or number> or \info xp. (provided by libsota.util)
     
    Anpu likes this.
  5. craftymethod

    craftymethod Avatar

    Messages:
    1,133
    Likes Received:
    2,001
    Trophy Points:
    113
    errm what time zone? :D
     
  6. CatweazleX

    CatweazleX Avatar

    Messages:
    653
    Likes Received:
    777
    Trophy Points:
    93
    Location:
    Veritas Sanctuary
    Should be local time, including representation according your local settings
     
    Anpu likes this.
  7. CatweazleX

    CatweazleX Avatar

    Messages:
    653
    Likes Received:
    777
    Trophy Points:
    93
    Location:
    Veritas Sanctuary
    Uploaded new version found here
    depends on libsota and libsota.util also found there

    RightAlt + c switches now between local time, "Novia" time (it is the time in Austin/Texas (dang: Austin "backslash" Texas)) and off

    The clock implements the following commands:
    \clock - cycles trough local, Novia and off
    \clock tz or \clock timezone - outputs the time zone the player is currently in (console (lua channel))
    \clock nbb or \clock Novia - shows "Novia" time
    \clock tig or \clock timeInGame - additionally shows the duration the player is in game and also turn it off again
    \clock tis or \clock timeInScene - additionally shows the duration the player is in the current scene and turn it off again
    \clock on or \clock local - shows local time
    \clock off or \clock false - deactivate the clock
     
    Last edited: Dec 10, 2019
    Alleine Dragonfyre, Anpu and Mishikal like this.
Thread Status:
Not open for further replies.