Page 1 of 1

[1.1.0] Control scripts in tips/tricks

Posted: Tue Nov 24, 2020 2:58 pm
by PFQNiet
I'm trying to customise the tips/tricks scenes to better fit my mod. It's slow going but I'm making progress.

Before I dive too far into it though, is it possible to have my mod's control.lua run at all? The reason I ask is because I have entities being built that trigger additional things with events, but they aren't working.

I also quickly discovered that I can't use "require" to get access to things I would normally use - notably require("util"). Presumably my only option there is to copy-paste the functions I need directly into the simulation.

I've also noticed there seem to be some undocumented functions being used in these simulations, particularly surface.create_entities_from_blueprint_string, game.create_test_player and a few others. Are these exclusively available in simulations? I imagine the documentation will be updated at some point but are there any particular features that would be useful to know about?

And just in general, any tips on editing these simulations or creating my own would be much appreciated :)

Re: [1.1.0] Control scripts in tips/tricks

Posted: Wed Nov 25, 2020 1:28 pm
by Bilka
PFQNiet wrote: Tue Nov 24, 2020 2:58 pm Before I dive too far into it though, is it possible to have my mod's control.lua run at all? The reason I ask is because I have entities being built that trigger additional things with events, but they aren't working.
Over in another thread I had the idea to use scenario code in the save file for this, and it seems to work. So, essentially you just make a custom scenario for your tips and tricks save files that requires your mod's control.lua.
PFQNiet wrote: Tue Nov 24, 2020 2:58 pm I've also noticed there seem to be some undocumented functions being used in these simulations, particularly surface.create_entities_from_blueprint_string, game.create_test_player and a few others. Are these exclusively available in simulations? I imagine the documentation will be updated at some point but are there any particular features that would be useful to know about?
They are indeed simulation only. Afaik these aren't planned to be documented; currently they are marked as "internal" which excludes them from the pages on lua-api.factorio.com.

Re: [1.1.0] Control scripts in tips/tricks

Posted: Wed Nov 25, 2020 1:54 pm
by PFQNiet
Since the "internal" functions are rather essential to making good tips/tricks sims (ie. mouse cursor movement, camera position...) I feel like they should be documented somewhere.

Thanks for the pointer on scenario scripts. I'll take a look at that.