Page 1 of 2
[v1.3.0+] Wall Clock
Posted: Thu May 24, 2018 11:25 pm
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.

]
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.
Re: [v1.3.0+] Wall Clock
Posted: Fri May 25, 2018 2:27 am
by Laerte
It works great! Thank you very much.

Re: [v1.3.0+] Wall Clock
Posted: Fri May 25, 2018 7:34 pm
by Row
Any chance this for Classic UI? It can be in the empty area, lower left just above the UI icons.
Re: [v1.3.0+] Wall Clock
Posted: Fri May 25, 2018 11:12 pm
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.
Re: [v1.3.0+] Wall Clock
Posted: Sat May 26, 2018 2:17 am
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.
Re: [v1.3.0+] Wall Clock
Posted: Sun May 27, 2018 12:00 am
by Laerte
The new version works flawlessly, so far.
Re: [v1.3.0+] Wall Clock
Posted: Sun May 27, 2018 2:17 am
by Zizzo
Laerte wrote:The new version works flawlessly so far.
*whew*
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.
Re: [v1.3.0+] Wall Clock
Posted: Sun May 27, 2018 3:12 pm
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.
- 1.png (28.28 KiB) Viewed 12509 times
Re: [v1.3.0+] Wall Clock
Posted: Tue May 29, 2018 12:59 am
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 (18.11 KiB) Viewed 12459 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.
Re: [v1.3.0+] Wall Clock
Posted: Wed Jul 25, 2018 12:35 am
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…

Re: [v1.3.0+] Wall Clock
Posted: Wed Jul 25, 2018 7:31 pm
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.
Re: [v1.3.0+] Wall Clock
Posted: Wed Jul 25, 2018 11:49 pm
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.
Re: [v1.3.0+] Wall Clock
Posted: Fri Oct 25, 2019 12:27 am
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.
Re: [v1.3.0+] Wall Clock
Posted: Sun Oct 11, 2020 6:41 pm
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!
Re: [v1.3.0+] Wall Clock
Posted: Sun Oct 11, 2020 9:01 pm
by HousePet
Isn't that the 'error in a timed effect description' message though?