Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show current time during gameplay. #6775

Closed
wants to merge 1 commit into from
Closed

Show current time during gameplay. #6775

wants to merge 1 commit into from

Conversation

nelchael
Copy link
Contributor

@nelchael nelchael commented Nov 4, 2023

Adding an option to display current time just under the FPS counter.

Screenshot from 2023-11-04 17-17-52

@qndel
Copy link
Member

qndel commented Nov 4, 2023

You can check current time in chat log by pressing L

@qndel qndel closed this Nov 4, 2023
@nelchael
Copy link
Contributor Author

nelchael commented Nov 4, 2023

You can check current time in chat log by pressing L

Yes, but it can't be displayed all the time.

@StephenCWills
Copy link
Member

We have added Lua to the codebase. It would be better to implement these kinds of customizations there.

@nelchael
Copy link
Contributor Author

nelchael commented Nov 4, 2023

We have added Lua to the codebase. It would be better to implement these kinds of customizations there.

I was able to figure out how to implement this in C++, I'm afraid I'm not that good with Lua.

@AJenbo
Copy link
Member

AJenbo commented Nov 4, 2023

You know a game is intended for a mature audience when it has an option to display the real life clock :)

@AJenbo
Copy link
Member

AJenbo commented Nov 4, 2023

@nelchael if you can either create an issue for it or maybe get on the chat we can help you create a Lua implementation.

@nelchael
Copy link
Contributor Author

nelchael commented Nov 4, 2023

@nelchael if you can either create an issue for it or maybe get on the chat we can help you create a Lua implementation.

There was an issue for that apparently -- #3539.

@AJenbo
Copy link
Member

AJenbo commented Nov 4, 2023

Ok, here we go:
image

in lua/user.lua put the following:

local render = require('devilutionx.render')

local function ShowTime()
	render.string(os.date('%H:%M:%S'), 85, 8)
end

Events.OnGameDrawComplete.Add(ShowTime)

For US people you can get your odd format with: %I:%M:%S %p

There is a slight catch though, os is currently not exposed so you would have to add it to the lib list around line 165 in lua.cpp.

@nelchael
Copy link
Contributor Author

nelchael commented Nov 4, 2023

Ok, so that's more like a DYI solution, bundling this script with a release build would force the clock display for everyone (I don't think settings are exposed to Lua either).

@StephenCWills
Copy link
Member

Right, the point is to make these types of things more DIY.

Like, you want a clock? Go download the Lua script that implements it.

@nelchael
Copy link
Contributor Author

nelchael commented Nov 4, 2023

Right, the point is to make these types of things more DIY.

Like, you want a clock? Go download the Lua script that implements it.

Got it, I'd prefer to just have an option in the release build, but it's just me :)

@AJenbo
Copy link
Member

AJenbo commented Nov 4, 2023

We may well include some default mods that can be enabled form a menu in settings, same with any additional ones you make or download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants