Search found 11 matches

by Fiend
Tue Jul 18, 2023 8:56 pm
Forum: Modding help
Topic: Is it possible to change the image you see when you check an item's inventory?
Replies: 1
Views: 378

Is it possible to change the image you see when you check an item's inventory?

Basically when you click an item that has inventory you get a window that shows your own character's inventory to the left and the item's inventory to the bottom right, as well as any progress going own which is the case for assemblers...etc., or the fuel consumption in case of a vehicle. but on top...
by Fiend
Sun Jul 16, 2023 1:43 pm
Forum: Modding help
Topic: How to use .Insert if I already know the Unit_Number of the chest?
Replies: 10
Views: 986

Re: How to use .Insert if I already know the Unit_Number of the chest?

I tried using #global.my_table but it always returns the value Zero! There are gaps in the table (non-consecutive index numbers), so #global.my_table won't work, and neither will ipairs(global.my_table). You can use these safely if you know that your table will be indexed with consecutive numbers, ...
by Fiend
Sun Jul 16, 2023 12:43 pm
Forum: Modding help
Topic: How to use .Insert if I already know the Unit_Number of the chest?
Replies: 10
Views: 986

Re: How to use .Insert if I already know the Unit_Number of the chest?

There's no built-in way do get an entity (the chest) from the unit number. What modders usually do is to store a reference to the entity in global. Something like function on_created(entity) global.my_chests[entity.unit_number] = entity end function insert_stuff(unit_number) local entity = global.m...
by Fiend
Sat Jul 15, 2023 1:13 pm
Forum: Modding help
Topic: Teleport Inventory from chest to chest
Replies: 1
Views: 326

Teleport Inventory from chest to chest

So I want to "teleport" inventory from one chest to another, I have two questions: 1. Is there a way to actually teleport inventory? or should I use .insert in one chest and remove from the other? 2. I am trying out insert/remove and I'm able to use .insert in the destination chest but wha...
by Fiend
Fri Jul 14, 2023 8:21 am
Forum: Modding help
Topic: How to use .Insert if I already know the Unit_Number of the chest?
Replies: 10
Views: 986

Re: How to use .Insert if I already know the Unit_Number of the chest?

Thanks, this is why I see mods using find_entity every time they want to reference that entity. Using find_entity, find_entities, and find_entities_filtered every time you want to reference an entity is bad practice: If you only have a unit_number, you don't know anything about the entity. However,...
by Fiend
Fri Jul 14, 2023 7:22 am
Forum: Modding help
Topic: How to use .Insert if I already know the Unit_Number of the chest?
Replies: 10
Views: 986

Re: How to use .Insert if I already know the Unit_Number of the chest?

There's no built-in way do get an entity (the chest) from the unit number. What modders usually do is to store a reference to the entity in global. Something like function on_created(entity) global.my_chests[entity.unit_number] = entity end function insert_stuff(unit_number) local entity = global.m...
by Fiend
Fri Jul 14, 2023 6:18 am
Forum: Modding help
Topic: How to use .Insert if I already know the Unit_Number of the chest?
Replies: 10
Views: 986

How to use .Insert if I already know the Unit_Number of the chest?

I'm new to LUA and modding, assume I already created a chest in a previous save and stored its unit_number in a table, now I want to use the unit_number as a reference to .insert stuff into the chest, how do I do that?
by Fiend
Tue Sep 08, 2020 9:28 pm
Forum: Gameplay Help
Topic: Combinators Resulting in NULL Values
Replies: 14
Views: 2958

Re: Combinators Resulting in NULL Values

If your two signals result in zero, you can use a Decider Combinator with the condition Everything = 0 and output a different signal with a non zero value to indicate the zero result. If that's what you need. [Edit for clarity] But Null does not equal Zero, that's what I meant by "you can't ch...
by Fiend
Tue Sep 08, 2020 8:31 pm
Forum: Gameplay Help
Topic: Combinators Resulting in NULL Values
Replies: 14
Views: 2958

Re: Combinators Resulting in NULL Values

I think the key is to approach it the opposite way. Make the Factory do something when there is a non-zero result, rather than when there is a zero result. Just as an example, the use of a negative Constant Combinator added to the (positive, by default) contents of some chests to determine when to ...
by Fiend
Tue Sep 08, 2020 8:22 pm
Forum: Gameplay Help
Topic: Combinators Resulting in NULL Values
Replies: 14
Views: 2958

Re: Combinators Resulting in NULL Values

you get a null value but you can't use a combinator to check if the value is null!! and there doesn't seem to be a reasonable solution for it in game. can't you use decider combinator, with condition set as "everything = 0" => "output 1 red signal " ? for example Problem is the ...
by Fiend
Tue Sep 08, 2020 7:59 pm
Forum: Gameplay Help
Topic: Combinators Resulting in NULL Values
Replies: 14
Views: 2958

Combinators Resulting in NULL Values

Hi, It seems to be a common issue with combinators that they give a NULL value as a result of their logic, I am building a base strongly dependent on combinators and the problem is sometimes crippling, you get a null value but you can't use a combinator to check if the value is null!! and there does...

Go to advanced search