ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Thu Oct 18, 2018 4:42 pm

All times are UTC




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: [v1.3.0+] Wall Clock
PostPosted: Thu May 24, 2018 11:25 pm 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1562
Location: A shallow water area south of Bree
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..."


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Fri May 25, 2018 2:27 am 
Offline
Halfling

Joined: Sat Sep 11, 2010 12:23 pm
Posts: 86
It works great! Thank you very much. :D


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Fri May 25, 2018 7:34 pm 
Offline
Higher

Joined: Mon Aug 20, 2012 10:57 am
Posts: 53
Any chance this for Classic UI? It can be in the empty area, lower left just above the UI icons.


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Fri May 25, 2018 11:12 pm 
Offline
Halfling

Joined: Sat Sep 11, 2010 12:23 pm
Posts: 86
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.


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Sat May 26, 2018 2:17 am 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1562
Location: A shallow water area south of Bree
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..."


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Sun May 27, 2018 12:00 am 
Offline
Halfling

Joined: Sat Sep 11, 2010 12:23 pm
Posts: 86
The new version works flawlessly, so far.


Last edited by Laerte on Sun May 27, 2018 3:10 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Sun May 27, 2018 2:17 am 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1562
Location: A shallow water area south of Bree
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..."


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Sun May 27, 2018 3:12 pm 
Offline
Higher

Joined: Mon Aug 20, 2012 10:57 am
Posts: 53
Attachment:
File comment: 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
1.png [ 28.28 KiB | Viewed 1114 times ]


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Tue May 29, 2018 12:59 am 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1562
Location: A shallow water area south of Bree
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:
Attachment:
clock-corner.png
clock-corner.png [ 18.11 KiB | Viewed 1064 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..."


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Wed Jul 25, 2018 12:35 am 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1562
Location: A shallow water area south of Bree
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..."


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Wed Jul 25, 2018 7:31 pm 
Offline
Cornac

Joined: Wed Jun 06, 2018 10:53 am
Posts: 35
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:
..\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:
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:
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.


Top
 Profile  
 
 Post subject: Re: [v1.3.0+] Wall Clock
PostPosted: Wed Jul 25, 2018 11:49 pm 
Offline
Sher'Tul Godslayer

Joined: Thu Jan 23, 2003 8:13 pm
Posts: 1562
Location: A shallow water area south of Bree
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:
       %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..."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group