#SystemClock - local time in-game on a customizable clock!

1 messages · Page 1 of 1 (latest)

formal osprey
#

🕓 SystemClock adds a draggable, resizable, customizable clock to the game screen.

https://github.com/Breezebuilder/SystemClock/

It includes 5 editable presets and supports a variety of time formats, UI styles, and color options.

Keep track of time - don't fall into the Black Hole.

SystemClock only requires Lovely, but supports Steamodded's MODS menu for convenience.

GitHub

An in-game clock mod for Balatro. Contribute to Breezebuilder/SystemClock development by creating an account on GitHub.

wanton veldt
#

give me this right now omg???

#

(messaging here so the thread shows up for later)

#

the one trick casinos don't want you to know!

  • bring a clock
formal osprey
wanton veldt
#

or bring zero money so you can't gamble it 😤

#

or bring debt so you can lose that 😤

hollow wyvern
#

I would like to change the credit to use my actual alternative username instead of server nickname 💀
also typo 💀💀💀

formal osprey
#

So sorry for the typo, I just noticed! Also apologies for assuming the name, I should have asked how you would have liked to be credited

formal osprey
hollow wyvern
#

"Xem trong trận" and "Xem trong menu"

hollow abyss
#

I was wondering in the future do you think we can get the option to have it do what ante does and have a title above it?

hollow wyvern
#

I forgor to mention

#

the preset I gave doesn't fit well in 16:9 screens

formal osprey
formal osprey
#

Or is it the default placement of the clock in-game thats the problem?

formal osprey
hollow wyvern
#

on Windows it gets partially obscured
Mac screens (especially MacBook Pro's) are 16:10 instead

formal osprey
#

Oh, i understand what you mean now. All good! I used a variant of your submission for Preset 2 with a smaller text size and basic styling:

#

Which should be fine on all systems because the minimum view area is based on 16:9 proportions, so wider aspect ratios add additional area on the sides, and narrower aspects add space top and bottom

hollow wyvern
#

I've never been in such an intensive brainstorming session h_

#

apparently, I'm finding a way to make my Vietnamese mod no longer depend on smods, all thanks to SystemClock's migration out of it in v1.6.0

formal osprey
#

If you don't need to load assets from within your mod folder, Lovely can handle pretty much everything else. Fewer dependencies are usually better, and the less mods that have full system read/write access, the better.

formal osprey
#

Apart from that, i think it's pretty well structured and fine to use as a template

formal osprey
hollow wyvern
#

I published v1.3.0 that pretty much adds preliminary (but unstable) support for non-smods installation

hollow wyvern
#

well, the thing is
unlike SystemClock (works fine as a standalone), VietnameseBalatro has cross-mod connections since I've localized some of the well-known mods like Cryptid and Ortalab (and they all require smods)
I'm just adding non-smods method as the last resort for those stubborn enough to refuse smods at all costs
another thing: smods handles loc files in localization folder inside the parent mod folder itself, while pure Lovely handles them in localization folder outside "Mods" 💀

formal osprey
#

I'm considering making a deeper UI-customisation mod if I find myself with a lot of free time for development (depending on which direction my career goes in the next couple of weeks), but if i follow through with it then i'd like to make all UI elements rearrangable, which would also support placing the clock within any ui panel.

hollow abyss
formal osprey
hollow abyss
#

i like how you named it Throwback

#

it speaks to me

formal osprey
#

Imitation is the sincerest form of flattery, and naming things is hard

hollow abyss
#

I don’t blame you, I name nearly every oc of mine after an alcoholic drink

formal osprey
#

This also improves parsing of values from the config file, so if you ever wanted to use extremely specific custom colours, or wanted your clock to display the date (?!) or show the time in an unusual format, those can all now be defined in the %AppData%/Balatro/config/SystemClock.jkr file

#

Clock colours can be arrays in the format { r, g, b } or { r, g, b, a }, or hexadecimal strings in the format "#rrggbb" or "#rrggbbaa"
Clock formats should be a string formatted in a way that can be parsed by Lua's os.date function, but any text is valid

formal osprey
#

This also allows SystemClock to double as a label-maker... for... some reason

formal osprey
#

On second thoughts, this might be the greatest feature i've ever added

unreal beacon
#

Can you do multiple boxes?

formal osprey
#

Nope, just the one. Multiple clocks on-screen feels a little excessive, and would require a complete overhaul of a bunch of the config and ui systems

hollow abyss
#

If you could, I would totally suggest just have it so there’s a hidden button to just have all presets on screen at once

formal osprey
hollow abyss
#

Joke feature

#

It wouldn’t be worth the effort for a single joke tbh

formal osprey
#

If anyone would like to build their own floating UI panel, most of the backbone of SystemClock's clockUI is formed by DraggableContainer which is an extension of UIBox that has gone through multiple stages of development by Toeler, MathIsFun0 and I, and is in a very usable state as a drop-in module.

Toeler originally developed it as MoveableContainer with a large number of additional features for his HandPreview mod. MathIsFun0 then took an axe to it and cut it down to its minimal parts for use in Ankh Speedrun Tmer, which I then overhauled and built upon. It's possible that there are no lines of code left from Toeler's mod, but credit where it's due.
It can display child popups on hover provided in args.h_popup, can respond to mouse-hover and drag events in the same dynamic way that cards and sprites do with juice and zoom effects, and will work dynamically with other menus while paused.

clock_ui.reset() in src/clock_ui.lua provides an example of how it can be used. A mod that allows for custom popups with editable text probably wouldn't be too difficult, it's just not something I feel like spending time on right now

hard island
#

@formal ospreyinteresting interpretation of 'sky blue' cirThink

formal osprey
hard island
#

ohhh cirDerp

#

that makes sense cirThink

formal osprey
#

I did briefly consider writing a system to interpret the colour and name it accordingly while I was supporting Trance's font system, but it's not a trivial problem when also supporting 16 languages, haha

hard island
#

why not copy_table(G.C.SECONDARY_SET) before anything else can touch it and then pull from wherever you put that instead, so that no other mods can interfere with the colours unless they specifically patch it

#

then again, you don't really normally expect G.C.SECONDARY_SET to be interfered with cirDerp

#

although this is... kinda detached? from everything else

#

it's not like it's specifically tied to the normal use of the colour for any purpose other than "it's there"
it's used in a completely different context

formal osprey
#

My original goal was to support Trance and stay consistent with whatever custom colour theme users wanted to define in that. That meant the names wouldn't match up, but the colours would translate in a consistent way and meant that people who want to go to the trouble of using custom colour themes would have the colour theming consistent.

hard island
#

ahhh

formal osprey
#

It's less about exact colours and more about respecting the palette of the game

formal osprey
#

It would require a custom cycle implementation, but i've had ideas about that for a while now anyway

ebon prairie
#

can the mod adds a customizable (countdown) timer? just wondering

formal osprey
# ebon prairie can the mod adds a customizable (countdown) timer? just wondering

I'm happy to give it a try, though it'll take some rethinking and reengineering to add it as a full-fledged and polished feature. I won't make promises on an eta, but i'll set aside some time in the next week or two and see how I go.
Any specific feature requests about how you'd like to use or set the countdown timer? Would milliseconds be necessary?

ebon prairie
#

milliseconds are good in stopwatches, one might not want to set it in countdown timers

formal osprey
formal osprey
ebon prairie
#

break timer, game performance evaluator, or just simply a notification timer, you name it

#

although it might be niche to be implemented i get it

formal osprey
ebon prairie
#

Lol, that's quite fascinating

ebon gorge
#

is there a way for the mod to tell you how long you spent on a run when you finish the run?

hard island
formal osprey
short mist
formal osprey
#

Ah, sorry to bother you then, your message and join dates just seemed similar

#

I'm trying to track them down because they've posted a version of SystemClock to Thunderstore which they've edited and broken, then disappeared...

formal osprey
#

🕛

ebon gorge
#

heyo, i really like how you made a draggable container and want to use a very similar thing for my mod

#

do you mind if i use your code as a template for the thing i want to display

formal osprey
ebon gorge
#

tysm :)

formal osprey
#

Feel free to ping or message me if you have any questions about any of the totally-uncommented modules.
My main goal was to maximise compatibility and interfere with as little as possible, so all the parts are loaded as modules by Lovely, with no destructive or replacing patches to any Balatro or Steamoddded code. None of the hooks in src/core.lua are necessary for the basic functionality either, they're all clock-related or config-related. I think everything you'll need is in lovely/modules.toml, src/clock_ui.lua and src/draggable_container.lua

ebon gorge
formal osprey
# ebon gorge youre a legend, i appreciate all the work you put into this, i did have a questi...

If you have a UI element with text that needs to change or do the fancy Balatro jumping and wobbling text, DynaText is by far the easiest way to do it. It's essentially a Moveable that contains text that draws itself, along with a lot of extra cleverness for text effects. They do all update once per frame though, so be aware that there's a performance hit to adding many of them.
Check the create_clock_DynaText() function for a usage example, it's just a matter of defining a DynaText object, and a UIT.O object containing that DynaText.

#

I didn't come across any parts of the Balatro code that try and recalculate a UIT.T type node after its creation - I think all changing text is either DynaText objects self-updating, or the entire parent UI element being destroyed and recreated

ebon gorge
#

gotcha okay that makes sense, ill go over the code, thanks so much once again

#

:)

hollow abyss
#

@formal osprey Can I see if i could borrow some of your code for grabbing the month and day?

formal osprey
hollow abyss
#

oh, thank you!

formal osprey
#

I might be getting my usages mixed up, hold on

#

Yep, sorry, it's os.date rather than os.time, i should have actually checked the docs i linked

hollow abyss
#

lol, fair, thanks again lol

formal osprey
#

🕐

tepid gale
#

right clicking the clock in a run to open the menu for it instantly crashes

formal osprey
tepid gale
#

yeah 0711a works

formal osprey
formal osprey
#

I've submitted a PR to SMODS to prevent the crash, since it's a very simple regression. If it doesn't get merged then I can release a patch for SystemClock, but I'd prefer not to go through the hassle just yet

lucid bobcat
#

I’ll merge it when I’m back at my pc later

formal osprey
frozen portal
#

what aboot analog clocks?

formal osprey
#

I've considered doing it in the past mostly as a fun challenge, even though it wouldn't realistically be used by many people. I don't have a huge amount of free time right now, but maybe one day i'll have a tinker and see if i can get something basic working

little grove
#

dragging a slider has some janky behavior when trying to make slight adjustments to the clock's position
i suspect it might have something to do with the menu ui bobbing up and down per balatro's ui engine

formal osprey
#

Yeah, I found it a bit temperamental too. I considered making a separate number-input field for it too but never got around to it. As a workaround, if you want an exact value you can edit the config file (%AppData%/Balatro/config/SystemClock.jkr). No need to restart the game either, i wrote it so that it'll reload from file whenever you switch presets

hollow wyvern
#

🕛 🪰