[MOD 0.12.x] Lua Combinator 0.0.1
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Working on an update... Will be done shortly.
Last edited by aahaxor on Mon Jul 31, 2017 8:35 pm, edited 1 time in total.
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Sorry that this has taken so long... I've had a busy summer...
But here it is!
https://mods.factorio.com/mods/aahaxor/LuaCombinator
But here it is!
https://mods.factorio.com/mods/aahaxor/LuaCombinator
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Can some one upgrade it to 0.16?
Re: [MOD 0.12.x] Lua Combinator 0.0.1
It is now updated to 0.16. Sorry for the wait!
Link: https://mods.factorio.com/mod/LuaCombinator
Link: https://mods.factorio.com/mod/LuaCombinator
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Hi,
the latest version of factorio doesn't support the set_circuit_condition method on entities. So the output command crashs.
To fix that put the modified "output.lua" file into the mod zip and overwrite it:
Also i changed the script input field to multiline textbox
You need to alter the data.lua in the zip at end and replace gui-style tags:
Need to look how factorio handles scrollbars on gui
the latest version of factorio doesn't support the set_circuit_condition method on entities. So the output command crashs.
To fix that put the modified "output.lua" file into the mod zip and overwrite it:
Code: Select all
require("new_class")
output = {}
local output_mt = new_class(output)
function output:new(entity)
return setmetatable( {entity=entity}, output_mt)
end
function output:clear(output)
self.entity.get_or_create_control_behavior().parameters = {parameters={}}
end
-- function output:insert_count(type,name,count)
-- local condition = self.entity.get_circuit_condition(1)
-- local old_count = self.get_count(name)
-- self.set_count(type,name,count)
-- end
function output:get_count(name)
local condition = self.entity.get_or_create_control_behavior()
if condition.parameters.parameters[1].signal.name == nil then
return 0
end
return condition.parameters.parameters[1].signal.count
end
function output:set_count(type,name,count)
local condition = self.entity.get_or_create_control_behavior()
local params = {parameters={
{index=1,signal={type=type,name=name},count=count},
}
}
self.entity.get_or_create_control_behavior().parameters = params
end
return output
Also i changed the script input field to multiline textbox
You need to alter the data.lua in the zip at end and replace gui-style tags:
Code: Select all
data.raw["gui-style"].default["wide_textbox_style_lua"] =
{
type = "textfield_style",
parent = "textfield",
}
Last edited by jdarko on Fri Jan 11, 2019 11:18 pm, edited 3 times in total.
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Simple 7 segment display using lamps to visualize numbers (in this case a simple counter)
Note, Lua Combinator executes the script on repeat every 0.5 second. Thats why the the state.interval variable is used to change the counter every 1 second.
Code: Select all
if state.interval == nil or state.interval >= 2 then
local mainentity = output.entity
local disp = {}
disp[0] = {segments = {"A","B","C","D","E","F"} }
disp[1] = {segments = {"B","C"} }
disp[2] = { segments = {"A","B","G","D","E"} }
disp[3] = { segments = {"A","B","C","D","G"} }
disp[4] = { segments = {"C","F","G"} }
disp[5] = { segments = {"A","C","D","F","G"} }
disp[6] = {segments = {"A","C","D","E","F","G"} }
disp[7] = {segments = {"A","B","C"} }
disp[8] = {segments = {"A","B","C","D","E","F","G"} }
disp[9] = {segments = {"A","B","C","D","F","G"} }
local params = {parameters={ } }
if state.a == nil or state.a >= 10 then state.a = 0 end
local i = 1
for bla,segment in pairs(disp[state.a].segments) do
params.parameters[i] = { index=i,signal={type="virtual",name="signal-"..segment},count=1}
i = i + 1
end
local control = mainentity.get_or_create_control_behavior()
control.parameters = params;
state.a = state.a + 1
state.interval = 0
end
state.interval = state.interval + 1
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Your first change fixes the error message on screen when trying to set_count, thanks.jdarko wrote: ↑Fri Jan 11, 2019 10:40 pmTo fix that put the modified "output.lua" file into the mod zip and overwrite it:
...edit...
Also i changed the script input field to multiline textbox
You need to alter the data.lua in the zip at end and replace gui-style tags:
Code: Select all
data.raw["gui-style"].default["wide_textbox_style_lua"] = { type = "textfield_style", parent = "textfield", }
Your second change appears to have no effect. The code in the mod is:
Code: Select all
data.raw["gui-style"].default["wide_textbox_style_lua"] =
{
type = "textfield_style",
parent = "textfield",
minimal_width = 300,
maximal_width = 300,
}
I assume we need some sort of:
"text-box": A multi-line text box that supports selection and copy-paste.
https://lua-api.factorio.com/latest/LuaGuiElement.html
but I wasn't able to get it working as I have zero modding experience.
The only place I found a reference to wide_textbox_style_lua was in control.lua
Code: Select all
lua_command = gui_or_new(command,"lua_command",{type="textfield", name="lua_command", text=lamp.command , style="wide_textbox_style_lua", parent="wide_textbox_style_lua"})
I'm guessing this is needed:Error while running event
LuaCombinator::on_tick (ID 0)
__LuaCombinator__/control.lua:226: bad argument #1 to 'pairs' (table expected, got nil)
Code: Select all
if network_r.signals ~= nil then
Re: [MOD 0.12.x] Lua Combinator 0.0.1
Code: Select all
function banner(text,position,color,player)
player.surface.create_entity{name="flying-text-banner_lua", position=position, text="Hello", color=color}
end
Code: Select all
function banner(text,position,color,player)
player.surface.create_entity{name="flying-text-banner_lua", position=position, text=text, color=color}
end