[v1.3.0+] Wall Clock

A place to post your add ons and ideas for them

Moderator: Moderator

Message
Author
Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

[v1.3.0+] Wall Clock

#1 Post by Zizzo »

By request, I've cobbled together a first pass at a simple Wall Clock addon, which adds a clock to the UI (presumably for the benefit of people who play in full-screen mode, which would cover up your computer's normal clock). The clock is a full-fledged interface element that can be moved and resized in the usual manner (via the padlock icon on the toolbar in the lower right corner). The clock's time format is controlled by the game option "UI | Wall clock format".

[I've also made an effort to play nice with the UI positioning preferences, so that if some of your characters have this addon enabled and some don't, the clock position information saved by the former won't choke the latter. That involved a bit of sneakiness. :wink: ]

Now, this is just a quick proof of concept; I don't know how much people are going to want to be able to configure this (I have a sneaking suspicion it's going to be a lot…). And this is probably a viable candidate for eventual future merging into ZOmnibus and ZOmnibus Lite.
"Blessed are the yeeks, for they shall inherit Arda..."

Laerte
Halfling
Posts: 88
Joined: Sat Sep 11, 2010 12:23 pm

Re: [v1.3.0+] Wall Clock

#2 Post by Laerte »

It works great! Thank you very much. :D

Row
Higher
Posts: 54
Joined: Mon Aug 20, 2012 10:57 am

Re: [v1.3.0+] Wall Clock

#3 Post by Row »

Any chance this for Classic UI? It can be in the empty area, lower left just above the UI icons.

Laerte
Halfling
Posts: 88
Joined: Sat Sep 11, 2010 12:23 pm

Re: [v1.3.0+] Wall Clock

#4 Post by Laerte »

I've got this error when I'm trying to learn "Aura of Silence":

Lua Error: /data/resources.lua:89: attempt to index global 'shat' (a nil value)
At [C]:-1 __index
At /data/resources.lua:89 display_resource_bar
At /mod/class/uiset/Minimalist.lua:846 displayResources
At /mod/class/uiset/Minimalist.lua:1986 super_display
At ...dons/wall_clock/superload/mod/class/uiset/Minimalist.lua:68 display
At /mod/class/Game.lua:1856

I've learned other talents just fine, but as soon as I click to skill the talent, the game start flicking and becomes unresponsive.

Edit: I've just created a wyrmic as test and the flickering starts just after character creation.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Wall Clock

#5 Post by Zizzo »

Laerte wrote:I've got this error when I'm trying to learn "Aura of Silence":

[…]

I've learned other talents just fine, but as soon as I click to skill the talent, the game start flicking and becomes unresponsive.

Edit: I've just created a wyrmic as test and the flickering starts just after character creation.
[sound F/X: source diving] The code that's choking is the bit that draws the Equilibrium resource bar. And frankly, I don't see how that code was working even before I got anywhere near it; it looks like it's accessing a variable it shouldn't have access to from that point. [sound F/X: further source diving] It looks like the Paradox resource bar would have the same problem.

Anyway, I'm not entirely sure how my change fixed it, but v1a appears to have resolved the problem. We Apologize for the Inconvenience.™ :?
Row wrote:Any chance this for Classic UI? It can be in the empty area, lower left just above the UI icons.
Possibly; I have significantly less experience modifying the Classic UI. I'll investigate.
"Blessed are the yeeks, for they shall inherit Arda..."

Laerte
Halfling
Posts: 88
Joined: Sat Sep 11, 2010 12:23 pm

Re: [v1.3.0+] Wall Clock

#6 Post by Laerte »

The new version works flawlessly, so far.
Last edited by Laerte on Sun May 27, 2018 3:10 am, edited 1 time in total.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Wall Clock

#7 Post by Zizzo »

Laerte wrote:The new version works flawlessly so far.
*whew* :mrgreen:

In the meantime, Classic UI support turned not to be as difficult as I'd feared, so that's going out as v1b. Now, the Classic UI doesn't appear to support moving interface elements around like the Minimalist UI does, so I hope the location Row suggested above (lower left corner, just above the action icons) is acceptable.
"Blessed are the yeeks, for they shall inherit Arda..."

Row
Higher
Posts: 54
Joined: Mon Aug 20, 2012 10:57 am

Re: [v1.3.0+] Wall Clock

#8 Post by Row »

This is how it looks like for me. 1920x1080 resolution. Probably align to the right, or center. Also, I prefer the 24 hour format.
This is how it looks like for me. 1920x1080 resolution. Probably align to the right, or center. Also, I prefer the 24 hour format.
1.png (28.28 KiB) Viewed 12249 times

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Wall Clock

#9 Post by Zizzo »

Row wrote:This is how it looks like for me. 1920x1080 resolution. Probably align to the right, or center.
[sound F/X: testing] Hmm, can't reproduce this. Do you have any other video options set, like screen zoom or font scale?

In the meantime, changing the clock position is straightforward enough:
clock-corner.png
clock-corner.png (18.11 KiB) Viewed 12199 times
That's going out as v1b.1
Row wrote:Also, I prefer the 24 hour format.
That's already configurable via the "UI | Wall clock format" game option.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Wall Clock

#10 Post by Zizzo »

Been getting a lot of bug reports over on Steam, reporting oddly positioned or truncated time displays (which sound a lot like Row's problem above, now that I reread it…). It's not obvious what could be going on, so as a first pass, v1b.2 adds a Wall Clock Debug Info dialog (initially bound to <Alt-Shift-C>), which reports some of the positioning information that the addon uses internally. I'm hoping this will give me the info I need to fix the problem… :oops:
"Blessed are the yeeks, for they shall inherit Arda..."

BugReporter
Higher
Posts: 62
Joined: Wed Jun 06, 2018 10:53 am

Re: [v1.3.0+] Wall Clock

#11 Post by BugReporter »

First of all thank you for this wonderful addon. I would like to help with the issue.
I can reproduce the "truncation" issue (for me it looks like in the screenshot by Row ":MM PM", in Minimalist UI it is), no luck with odd positioning though. Please let me know if there is any additional information I can provide. I'll try to explain the issue as I see it to verify whether it is the same one you are getting reports for.
It only happens for 12 hour clock, both 24 hour versions of the clock work as expected.
In Game Options -> UI -> Wall clock format selection window there are following choices:
No clock
:34 PM
19:34
19:34:55
In the actual game the format corresponds to options in the format selection window.
Example 20:03:41 (option -> clock time):
No clock -> no time displayed
:34 PM -> :03 PM
19:34 -> 20:03
19:34:55 -> 20:03:41

Changing %l (lower case L) to %I (upper case i) in file load.lua seems to return hours
to both format selection window and in game clock. A quick search inside the addon
folder revealed only 3 matches for %l (one in L23, two in L72):

Code: Select all

..\tome-wall_clock_4\hooks\load.lua
	Line 23:   config.settings.tome.wall_clock_format = '%l:%M %p'
	Line 72: 	  { name=os.date('%l:%M %p', tz), fmt='%l:%M %p' },
After changing %l to %I:

Code: Select all

Wall Clock Debug Info
Minimalist UI, 1600x900
Clock at 319.20, scale 1
Time 07:04PM (from %I:%M %p), width 62
x = 319 + 120/2 - 62/2 = 348
y = 20 + 20/2 - 18/2 = 21
No change:

Code: Select all

Wall Clock Debug Info
Minimalist UI, 1600x900
Clock at 319.20, scale 1
Time :05PM (from %l:%M %p), width 40
x = 319 + 120/2 - 40/2 = 359
y = 20 + 20/2 - 18/2 = 21
ToME 1.5.10 for WIN from ToME site, Wall clock addon v1b2 (2018-07-25) from https://te4.org/games/addons/tome/wall_clock

Edit. Totally forgot. Source: Programming in Lua (first edition), Part III. The Standard Libraries, 22.1 – Date and Time. A table with tags near the end of the page.
It is available online in Lua documentation https://www.lua.org/docs.html
At first I thought I can find tags in Reference Manual. Apparently I was wrong.

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Wall Clock

#12 Post by Zizzo »

BugReporter wrote:Changing %l (lower case L) to %I (upper case i) in file load.lua seems to return hours to both format selection window and in game clock.
[sound F/X: man strftime(3)] …Huh. Apparently the %l conversion in strftime() isn't as widely supported as the %I conversion:

Code: Select all

       %I     The  hour as a decimal number using a 12-hour clock (range 01 to
              12).  (Calculated from tm_hour.)

[i][…][/i]

       %l     The  hour  (12-hour  clock) as a decimal number (range 1 to 12);
              single digits are preceded by a blank.  (See also %I.)   (Calcu‐
              lated from tm_hour.)  (TZ)

[i][…][/i]

CONFORMING TO
       SVr4, C89, C99.  There are strict inclusions between the set of conver‐
       sions given in ANSI C (unmarked), those given in the Single UNIX Speci‐
       fication (marked SU), those given in Olson's timezone  package  (marked
       TZ), [i][…][/i]
Lua's os.date() function, as you note above, uses the strftime(3) conversion specifications internally, and the underlying support for that clearly varies from platform to platform. I went with %l originally because "9:34 PM" seemed more aesthetically pleasing than "09:34 PM"; but obviously the support for that isn't there, so we'll fall back to what actually works. That's going out as v1b.3. Thanks.
"Blessed are the yeeks, for they shall inherit Arda..."

Zizzo
Sher'Tul Godslayer
Posts: 2517
Joined: Thu Jan 23, 2003 8:13 pm
Location: A shallow water area south of Bree
Contact:

Re: [v1.3.0+] Wall Clock

#13 Post by Zizzo »

v1c is mostly a compability release for the merge into ZOmnibus/Lite v16, but we also take the opportunity to remove the now-useless debug dialog we added back in an earlier version.
"Blessed are the yeeks, for they shall inherit Arda..."

rexorcorum
Graphical God
Posts: 482
Joined: Wed Jan 05, 2011 8:05 am
Location: There and Back again

Re: [v1.3.0+] Wall Clock

#14 Post by rexorcorum »

Heya, Zizzo! Was playing the latest git version (1.7 + DLC's) with the Wall clock enabled and at some point the game decided to go on an error death-loop. Something has changed on the UI / engine front apparently :)

Code: Select all

Lua Error: /mod/class/uiset/Minimalist.lua:1157: bad argument #3 to 'long_desc' (number expected, got nil)
  At [C]:-1 
  At [C]:-1 long_desc
  At /mod/class/uiset/Minimalist.lua:1157 handleEffect
  At /mod/class/uiset/Minimalist.lua:1374 displayBuffs
  At /mod/class/uiset/Minimalist.lua:2018 super_display
  At ...dons/wall_clock/superload/mod/class/uiset/Minimalist.lua:72 display
  At /mod/class/Game.lua:1933 
  ad infinitum...
If you need a longer log, will be happy to provide it too!
~ [ RexOrcorum, a.k.a "rexo": Official Visual Magus, Addon Beautifier, Achiever, Knight of the 561 Trees, Dark Interfacer ] ~
darkgod wrote:~ [ DarkGod whips rexorcorum with Suslik (& many others as well) ] ~

HousePet
Perspiring Physicist
Posts: 6215
Joined: Sun Sep 09, 2012 7:43 am

Re: [v1.3.0+] Wall Clock

#15 Post by HousePet »

Isn't that the 'error in a timed effect description' message though?
My feedback meter decays into coding. Give me feedback and I make mods.

Post Reply