How to set the "description" of "shortcut"?

Place to post guides, observations, things related to modding that are not mods themselves.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

How to set the "description" of "shortcut"?

Post by sdgmlj »

Adding 'description=' to the prototype is not acceptable
Adding [shortcut description] in the 'locality' does not work either
May I ask how to set it up? thank you
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 214
Joined: Sat Nov 09, 2019 6:49 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by picklock »

Within the prototype it is:

Code: Select all

localised_name = {"Category.name of shortcut"},
And in the locale it is:

Code: Select all

[Category]
name of shortcut="locale"
You can freely choose the name of the category.
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

picklock wrote: Sat Nov 02, 2024 12:01 pm Within the prototype it is:

Code: Select all

localised_name = {"Category.name of shortcut"},
And in the locale it is:

Code: Select all

[Category]
name of shortcut="locale"
You can freely choose the name of the category.
Thank you, friend, but what you said is a localized name. Just add it to [shortcut name]. What I want is a "description", which is a long explanation below the name
EustaceCS
Filter Inserter
Filter Inserter
Posts: 253
Joined: Tue Dec 15, 2020 5:41 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by EustaceCS »

Below the name of what and where, specifically?
Text in item card, like this extra on screenshot,
9e6558bd1ce8d0be7ee242b49c71f4807d25e192.thumb.png
9e6558bd1ce8d0be7ee242b49c71f4807d25e192.thumb.png (88.55 KiB) Viewed 314 times
is added in locale>%lang_code%>%your_mod%.cfg in:
[entity-description] for already-placed things in the world,
[item-description] for your inventory items.

Modifying prototypes is NOT required. Locale modifiers will "attach" themselves to items just fine.

Sample mode: https://mods.factorio.com/mod/novice-qm-helper
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

Sorry, my friends. I didn't express myself clearly. My English is not good, so I can only rely on machine translation
I just want to add a 'description' to the 'shortcut' in the 'local', for example:
[item-name]--------[item-description]
[entity-name]-------[entity-description]
[shortcut-name]--------????
User avatar
picklock
Fast Inserter
Fast Inserter
Posts: 214
Joined: Sat Nov 09, 2019 6:49 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by picklock »

Only that we are talking about the same thing. For me, these are shortcuts in my picture. And for me, the name is the description.
And you can define these as I have already described.
Attachments
shortcut.png
shortcut.png (5.18 KiB) Viewed 291 times
My Mods: Picklocks Fusion Power | Picklocks Inserter | Picklocks Lithium Polymer Accumulator | Picklocks rocket silo stats | Picklocks Set Inventory Filters | Picklocks QuickBar Import/Export | Picklocks Nauvis Cliff-Explosives
EustaceCS
Filter Inserter
Filter Inserter
Posts: 253
Joined: Tue Dec 15, 2020 5:41 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by EustaceCS »

sdgmlj wrote: Sat Nov 02, 2024 1:12 pm Sorry, my friends. I didn't express myself clearly. My English is not good, so I can only rely on machine translation
I just want to add a 'description' to the 'shortcut' in the 'local', for example:
[item-name]--------[item-description]
[entity-name]-------[entity-description]
[shortcut-name]--------????
Knowing "where" would still do no harm.

[item-description] is being used for basic descriptions (like "Blueprint" button from screenshot above, it can be seen in base/locale/en/base.cfg).
Is expected to work well for 90% of description-added needs.

[controls-description] is used for (i) tooltips in Settings > Controls menu.
Screenshot From 2024-11-02 17-11-49.png
Screenshot From 2024-11-02 17-11-49.png (28.62 KiB) Viewed 279 times
No prototype change seem to be required either, only prototype name match with entry in [controls].

More advanced things, like tooltip for "Create spidertron remote"
Screenshot From 2024-11-02 16-48-30.png
Screenshot From 2024-11-02 16-48-30.png (48.05 KiB) Viewed 287 times
, are probably not exposed anywhere yet. Can't seem to find in exposed parts how it is done currently so cannot replicate it for custom keys.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

picklock wrote: Sat Nov 02, 2024 1:26 pm Only that we are talking about the same thing. For me, these are shortcuts in my picture. And for me, the name is the description.
And you can define these as I have already described.
Thank you, what I want to know is, can only change 'name'? Because that would make the name very long and not very attractive, I would like to have a detailed explanation on the new feature I added, as it would be very long...
If there is no other way, the only option is to change the name
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

EustaceCS wrote: Sat Nov 02, 2024 2:08 pm
sdgmlj wrote: Sat Nov 02, 2024 1:12 pm Sorry, my friends. I didn't express myself clearly. My English is not good, so I can only rely on machine translation
I just want to add a 'description' to the 'shortcut' in the 'local', for example:
[item-name]--------[item-description]
[entity-name]-------[entity-description]
[shortcut-name]--------????
Knowing "where" would still do no harm.

[item-description] is being used for basic descriptions (like "Blueprint" button from screenshot above, it can be seen in base/locale/en/base.cfg).
Is expected to work well for 90% of description-added needs.

[controls-description] is used for (i) tooltips in Settings > Controls menu.
Screenshot From 2024-11-02 17-11-49.png
No prototype change seem to be required either, only prototype name match with entry in [controls].

More advanced things, like tooltip for "Create spidertron remote"
Screenshot From 2024-11-02 16-48-30.png
, are probably not exposed anywhere yet. Can't seem to find in exposed parts how it is done currently so cannot replicate it for custom keys.
Thank you, I'm glad I made myself clear and you understand what I mean. And the method I want may not be feasible, I understand. Thank you again and good luck
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by Pi-C »

sdgmlj wrote: Sat Nov 02, 2024 2:20 pm what I want to know is, can only change 'name'?
Check out PrototypeBase, which is inherited by all other prototypes. What you need isn't localised_name, but localised_description!
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

Pi-C wrote: Sat Nov 02, 2024 2:41 pm
sdgmlj wrote: Sat Nov 02, 2024 2:20 pm what I want to know is, can only change 'name'?
Check out PrototypeBase, which is inherited by all other prototypes. What you need isn't localised_name, but localised_description!

Code: Select all

		type = "shortcut",
		name = "abc",
		order = "abc",
		localised_description = "aaaaaa",

You completely understand what I mean, but 'localised_description' is invalid in 'shortcut'
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by Pi-C »

sdgmlj wrote: Sat Nov 02, 2024 2:53 pm

Code: Select all

		type = "shortcut",
		name = "abc",
		order = "abc",
		localised_description = "aaaaaa",

You completely understand what I mean, but 'localised_description' is invalid in 'shortcut'
No, it's not invalid! Enter this on the chat console:

Code: Select all

/c game.print(prototypes.shortcut.abc.localised_description)
For the shortcut defined above, the command will print "aaaaaa".

The real problem seems to be that only localised_name will ever be shown when you hover the shortcut with your cursor. So this looks more like a feature request to implement a way to display the localised description.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

Pi-C wrote: Sat Nov 02, 2024 3:38 pm No, it's not invalid! Enter this on the chat console:

Code: Select all

/c game.print(prototypes.shortcut.abc.localised_description)
For the shortcut defined above, the command will print "aaaaaa".

The real problem seems to be that only localised_name will ever be shown when you hover the shortcut with your cursor. So this looks more like a feature request to implement a way to display the localised description.
Firstly, thank you very much for helping me solve this problem. I would like to ask, is it never possible to achieve mouse hover display through scripts?
Pi-C
Smart Inserter
Smart Inserter
Posts: 1726
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: How to set the "description" of "shortcut"?

Post by Pi-C »

sdgmlj wrote: Sat Nov 02, 2024 4:25 pm Firstly, thank you very much for helping me solve this problem. I would like to ask, is it never possible to achieve mouse hover display through scripts?
There is on_gui_hover, but I'm not sure it will work with vanilla GUIs.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 146
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: How to set the "description" of "shortcut"?

Post by sdgmlj »

Pi-C wrote: Mon Nov 04, 2024 10:28 pm
sdgmlj wrote: Sat Nov 02, 2024 4:25 pm Firstly, thank you very much for helping me solve this problem. I would like to ask, is it never possible to achieve mouse hover display through scripts?
There is on_gui_hover, but I'm not sure it will work with vanilla GUIs.
Thank you, my friend. Although my questions are boring, I always receive your enthusiastic responses. I am truly grateful and wish you happiness
Post Reply

Return to “Modding discussion”