Page 1 of 1
How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 11:45 am
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
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 12:01 pm
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.
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 12:37 pm
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
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 12:42 pm
by EustaceCS
Below the name of what and where, specifically?
Text in item card, like this extra on screenshot,
- 9e6558bd1ce8d0be7ee242b49c71f4807d25e192.thumb.png (88.55 KiB) Viewed 562 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
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 1:12 pm
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]--------????
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 1:26 pm
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.
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 2:08 pm
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 (28.62 KiB) Viewed 527 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 (48.05 KiB) Viewed 535 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.
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 2:20 pm
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
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 2:29 pm
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
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 2:41 pm
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!
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 2:53 pm
by sdgmlj
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'
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 3:38 pm
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.
Re: How to set the "description" of "shortcut"?
Posted: Sat Nov 02, 2024 4:25 pm
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?
Re: How to set the "description" of "shortcut"?
Posted: Mon Nov 04, 2024 10:28 pm
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.
Re: How to set the "description" of "shortcut"?
Posted: Tue Nov 05, 2024 8:04 am
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