Search found 86 matches
- Tue Jul 26, 2022 3:28 pm
- Forum: Modding help
- Topic: Select character on event on_player_changed_force
- Replies: 6
- Views: 1056
Re: Select character on event on_player_changed_force
Thanks for your help. What you say is not confirmed in the code. When I try to get the player character in the on_player_changed_force event the value of Player.character does not exist and get_associated_characters() gives me the previous character. Items are added successfully, but to the old inve...
- Tue Jul 26, 2022 3:03 pm
- Forum: Modding help
- Topic: GUI and textfield focus
- Replies: 3
- Views: 1043
Re: GUI and textfield focus
Thanks for the suggestions! However, I've found another way in the meantime: I listen to on_gui_text_changed changed now, so I can verify the text as soon as a character has been entered. When the text in the textfield matches an existing name, I set its style to "invalid_value_textfield"...
- Tue Jul 26, 2022 1:36 pm
- Forum: Modding help
- Topic: GUI and textfield focus
- Replies: 3
- Views: 1043
Re: GUI and textfield focus
Hello, I hope you are well, There is no event related to the focus, and making them by means of flag variables (variables that indicate that everything is going well) can become tedious, but I think it is one of the options you have. The other option that I envision is that you validate everything i...
- Tue Jul 26, 2022 12:54 pm
- Forum: Modding help
- Topic: How do I call the vanilla tooltip?
- Replies: 3
- Views: 1126
Re: How do I call the vanilla tooltip?
Hello,
If what you want is to modify the tooltip that is generated in vanilla, I am sorry to cut it off, it is not possible.
If what you want is to replace it, it can be done, following the styles available in the game.
If you need, I can explain the second in a better way.
If what you want is to modify the tooltip that is generated in vanilla, I am sorry to cut it off, it is not possible.
If what you want is to replace it, it can be done, following the styles available in the game.
If you need, I can explain the second in a better way.
- Tue Jul 26, 2022 11:14 am
- Forum: Modding help
- Topic: Select character on event on_player_changed_force
- Replies: 6
- Views: 1056
Select character on event on_player_changed_force
Hello,
I hope you are well,
I need help with the following idea.
I want to add some items to a player's inventory, but I found that, when they change forces, I can't find the instance of the new character associated with the player to add the items.
I hope I have explained myself well.
I hope you are well,
I need help with the following idea.
I want to add some items to a player's inventory, but I found that, when they change forces, I can't find the instance of the new character associated with the player to add the items.
I hope I have explained myself well.
- Sun May 22, 2022 8:55 pm
- Forum: Modding help
- Topic: Identify game mode
- Replies: 2
- Views: 758
- Sun May 22, 2022 4:15 pm
- Forum: Modding help
- Topic: Identify game mode
- Replies: 2
- Views: 758
Identify game mode
Is there a way to identify the game mode of a player, Sandbox or pvp?
What I seek is to identify in which scenario it is required to investigate some technology.
What I seek is to identify in which scenario it is required to investigate some technology.
- Thu May 12, 2022 9:03 pm
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
I haven't tried this code yet, but it's an idea of what I want to do. -- Variable initialization _G.OnTick = _G.OnTick or { } -- Requests per tick local TickRequest = 25 local function Add( Table, Data ) if not Table[ 1 ] then table.insert( Table, { } ) end if #Table[ 1 ] > TickRequest - 1 then tabl...
- Wed May 11, 2022 8:09 pm
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
I will start by saying: I have not tried what you are saying. So if the mod is installed before the player joins, the mod can add the player's translation in on_player_joined_game. If the mod is installed after the player joined, it will add the player's translation in on_configuration_changed (whi...
- Wed May 11, 2022 3:54 pm
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
Fair enough - though I'd say that a lot of work and thought has been put into that library (https://github.com/factoriolib/flib/blob/master/dictionary.lua, https://factoriolib.github.io/flib/modules/dictionary.html) so you'd save yourself a lot of time and effort by using it. Have you seen the exam...
- Tue May 10, 2022 6:14 pm
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
You're right
I haven't said why I'm doing all this.
I want to create a dictionary from which to filter a word (or fragment of a word) in the translations.
Yes, that's what I'm looking for, but that MOD uses a library that I don't understand, and I have tried to understand it.
- Tue May 10, 2022 4:36 pm
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
I wanted to avoid that option because of the weight (in MB) that would mean. But if I have no other choice... If I do it as you say, when should I upload the translations? That is, in such a way that it affects the players who open a previously saved game. I want to load all the information before ...
- Tue May 10, 2022 1:46 pm
- Forum: Modding help
- Topic: Help with GUI - stretch scroll-pane
- Replies: 2
- Views: 667
Re: Help with GUI - stretch scroll-pane
I get it.
This option does not always work as it is supposed to do.
I had to give specific heights to many of the elements, which affects it when I change the scale.
This option does not always work as it is supposed to do.
Code: Select all
Element.style.vertically_stretchable = true
- Tue May 10, 2022 1:18 pm
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
Reading your comments it occurred to me to try some things This code worked!! -- Control.lua local localised_name = Player.forge.recipes[ "iron-plate" ] localised_name = localised_name.localised_name Player.request_translation( localised_name ) script.on_event( defines.events.on_string_tra...
- Mon May 09, 2022 11:09 am
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
Re: How to get the translation?
The event will be triggered only if the string could be translated, i.e. if the return value of LuaPlayer::request_translation(localised_string) is true. I don't understand you, because the function always returns true But just in case, I tried other variants and it still doesn't work. -- Control.l...
- Mon May 09, 2022 12:10 am
- Forum: Modding help
- Topic: How to get the translation?
- Replies: 19
- Views: 3174
How to get the translation?
What am I doing wrong? I am trying to get the translation of the texts I want. -- Control.lue local localised_name = { "recipe-name.iron-plate" } Player.request_translation( localised_name ) The event is not receiving anything script.on_event( defines.events.on_string_translated, function...
- Wed May 04, 2022 11:45 am
- Forum: Modding help
- Topic: Help with GUI - stretch scroll-pane
- Replies: 2
- Views: 667
Re: Help with GUI - stretch scroll-pane
I tried to fix it on my own, but I made it worse.
I need someone to explain to me how the property vertically_stretchable works and what I am doing wrong.
I need someone to explain to me how the property vertically_stretchable works and what I am doing wrong.
Code: Select all
Element.style.vertically_stretchable = true
- Mon May 02, 2022 1:39 pm
- Forum: Modding help
- Topic: How to get the width of GUI element containers?
- Replies: 3
- Views: 845
Re: How to get the width of GUI element containers?
I would like to help you, but I really don't understand what you are trying to do.
How about showing me in code what you have and a drawing of what you want??
So be a scheme like this
How about showing me in code what you have and a drawing of what you want??
So be a scheme like this
- Sun May 01, 2022 11:44 pm
- Forum: Modding help
- Topic: Which LuaGuiElement is in front?
- Replies: 1
- Views: 597
Re: Which LuaGuiElement is in front?
I would like to help you, but I don't think I understand what the problem is. If what you want is to prevent the windows from overlapping, place it to one side of the main one script.on_event(defines.events.on_player_created, function(event) local player = game.get_player(event.player_index) local a...
- Sun May 01, 2022 11:36 pm
- Forum: Modding help
- Topic: How to get the width of GUI element containers?
- Replies: 3
- Views: 845
Re: How to get the width of GUI element containers?
There is no way to read the height or width of an element. Is there any way how I could determine the real width of character_frame, so that I can set the width of main_flow? If you want the container sizes, you must give the inner objects a fixed size. Problem: The width of main_flow should be the ...