Search found 69 matches

by yaim904
Sat Jul 30, 2022 11:04 am
Forum: Modding help
Topic: Select character on event on_player_changed_force
Replies: 6
Views: 159

Re: Select character on event on_player_changed_force

That looks wrong. Character will be "false" if the table is empty, or nil if it is not. The second "and" should be "or": You are right, this was a mistake. I still can't find a way to add the items I want to users (automatically) when starting the game or connecting, e...
by yaim904
Wed Jul 27, 2022 12:30 pm
Forum: Modding help
Topic: How do I call the vanilla tooltip?
Replies: 3
Views: 334

Re: How do I call the vanilla tooltip?

Hello,

I think I was wrong,
I found this MOD that does what you want and is quite easy to understand.

Stack Size Tooltip

I hope it is helpful.
by yaim904
Tue Jul 26, 2022 10:30 pm
Forum: Modding help
Topic: Select character on event on_player_changed_force
Replies: 6
Views: 159

Re: Select character on event on_player_changed_force

This is the test code I have. -- Control.lua local function Test( Event ) GPrefix.Log( "1" ) local Player = game.players[ Event.player_index ] if not Player then return end if not Player.character then GPrefix.Log( "2" ) Player.insert( { count = 1, name = "rocket-silo" ...
by yaim904
Tue Jul 26, 2022 3:28 pm
Forum: Modding help
Topic: Select character on event on_player_changed_force
Replies: 6
Views: 159

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...
by yaim904
Tue Jul 26, 2022 3:03 pm
Forum: Modding help
Topic: GUI and textfield focus
Replies: 3
Views: 295

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"...
by yaim904
Tue Jul 26, 2022 1:36 pm
Forum: Modding help
Topic: GUI and textfield focus
Replies: 3
Views: 295

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...
by yaim904
Tue Jul 26, 2022 12:54 pm
Forum: Modding help
Topic: How do I call the vanilla tooltip?
Replies: 3
Views: 334

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.
by yaim904
Tue Jul 26, 2022 11:14 am
Forum: Modding help
Topic: Select character on event on_player_changed_force
Replies: 6
Views: 159

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.
by yaim904
Sun May 22, 2022 8:55 pm
Forum: Modding help
Topic: Identify game mode
Replies: 2
Views: 269

Re: Identify game mode

Pi-C wrote: ↑
Sun May 22, 2022 6:54 pm
That's what I was looking for.
Thanks a lot!!
by yaim904
Sun May 22, 2022 4:15 pm
Forum: Modding help
Topic: Identify game mode
Replies: 2
Views: 269

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.
by yaim904
Thu May 12, 2022 9:03 pm
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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...
by yaim904
Wed May 11, 2022 8:09 pm
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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...
by yaim904
Wed May 11, 2022 3:54 pm
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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...
by yaim904
Tue May 10, 2022 6:14 pm
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

Re: How to get the translation?

robot256 wrote: ↑
Tue May 10, 2022 5:12 pm
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.
Xorimuth wrote: ↑
Tue May 10, 2022 6:01 pm
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.
by yaim904
Tue May 10, 2022 4:36 pm
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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 ...
by yaim904
Tue May 10, 2022 1:46 pm
Forum: Modding help
Topic: Help with GUI - stretch scroll-pane
Replies: 2
Views: 196

Re: Help with GUI - stretch scroll-pane

I get it.

This option does not always work as it is supposed to do.

Code: Select all

Element.style.vertically_stretchable = true
I had to give specific heights to many of the elements, which affects it when I change the scale.
by yaim904
Tue May 10, 2022 1:18 pm
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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...
by yaim904
Mon May 09, 2022 11:09 am
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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...
by yaim904
Mon May 09, 2022 12:10 am
Forum: Modding help
Topic: How to get the translation?
Replies: 19
Views: 817

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...
by yaim904
Wed May 04, 2022 11:45 am
Forum: Modding help
Topic: Help with GUI - stretch scroll-pane
Replies: 2
Views: 196

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.

Code: Select all

Element.style.vertically_stretchable = true

Go to advanced search