quick question with control.lua
Posted: Wed Jan 18, 2017 2:43 am
Hello all!
I have a quick question on setting up a control.lua file. I'd like to enable several specific techs from the start of the game. What is the syntax for in a control.lua file so I do not need to use in-game /c scripts for each tech/game?
Example techs (from console commands wiki):
/c game.player.force.technologies['electric-energy-distribution-1'].researched=true
/c game.player.force.technologies['steel-processing'].researched=true
I have this example from arumba's accelerated start mod but I haven't had luck in using the above commands in the file to any success:
~~~~~~~~~~~~~~~~~~~~
script.on_event(defines.events.on_player_created, function(event)
game.players[event.player_index].color = {r = 0, g = 0, b = 1, a = .7}; -- change player color to blue
local player = game.players[event.player_index]
local inventory = player.get_inventory(defines.inventory.player_quickbar)
inventory.clear()
inventory.set_filter(1,"transport-belt")
inventory.set_filter(2,"inserter")
-- materials
player.insert{name="steel-axe", count=20}
.....
end)
~~~~~~~~~~~~~~~~~~~~~
Thank you so much for your help!
I have a quick question on setting up a control.lua file. I'd like to enable several specific techs from the start of the game. What is the syntax for in a control.lua file so I do not need to use in-game /c scripts for each tech/game?
Example techs (from console commands wiki):
/c game.player.force.technologies['electric-energy-distribution-1'].researched=true
/c game.player.force.technologies['steel-processing'].researched=true
I have this example from arumba's accelerated start mod but I haven't had luck in using the above commands in the file to any success:
~~~~~~~~~~~~~~~~~~~~
script.on_event(defines.events.on_player_created, function(event)
game.players[event.player_index].color = {r = 0, g = 0, b = 1, a = .7}; -- change player color to blue
local player = game.players[event.player_index]
local inventory = player.get_inventory(defines.inventory.player_quickbar)
inventory.clear()
inventory.set_filter(1,"transport-belt")
inventory.set_filter(2,"inserter")
-- materials
player.insert{name="steel-axe", count=20}
.....
end)
~~~~~~~~~~~~~~~~~~~~~
Thank you so much for your help!