don't add values if they already exists
This commit is contained in:
parent
42b098cbb7
commit
38c239a77b
|
|
@ -1,55 +1,58 @@
|
||||||
local function createui()
|
local function createui()
|
||||||
if mem.controls then return end
|
--if mem.controls then return end
|
||||||
|
|
||||||
mem.controls = {
|
mem.controls = {
|
||||||
{
|
{
|
||||||
command = "clear"
|
command = "clear"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command = "adddropdown",
|
|
||||||
Y = 1.2,
|
|
||||||
label = "Drawer Controller",
|
|
||||||
selected_id = 1,
|
|
||||||
W = 10,
|
|
||||||
X = 0.4,
|
X = 0.4,
|
||||||
H = 0.8,
|
H = 0.8,
|
||||||
name = "ddController",
|
command = "adddropdown",
|
||||||
choices = {
|
choices = {
|
||||||
"drawercontroller"
|
"drawercontroller"
|
||||||
}
|
},
|
||||||
|
W = 10,
|
||||||
|
label = "Drawer Controller",
|
||||||
|
selected_id = 1,
|
||||||
|
Y = 1.2,
|
||||||
|
name = "ddController"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command = "adddropdown",
|
|
||||||
Y = 3.2,
|
|
||||||
label = "Item name",
|
|
||||||
selected_id = 1,
|
|
||||||
X = 0.4,
|
|
||||||
W = 10,
|
|
||||||
H = 0.8,
|
|
||||||
name = "ddItem",
|
|
||||||
choices = {
|
choices = {
|
||||||
"basic_materials:oil_extract",
|
"basic_materials:oil_extract",
|
||||||
|
"default:coal_lump",
|
||||||
"default:cobble",
|
"default:cobble",
|
||||||
"default:copper_ingot",
|
"default:copper_ingot",
|
||||||
|
"default:copper_lump",
|
||||||
"default:gold_ingot",
|
"default:gold_ingot",
|
||||||
|
"default:gravel",
|
||||||
"default:iron_lump",
|
"default:iron_lump",
|
||||||
"default:mese_crystal",
|
"default:mese_crystal",
|
||||||
|
"default:silver_sand",
|
||||||
|
"default:steel_ingot",
|
||||||
"default:stone",
|
"default:stone",
|
||||||
|
"farming:chocolate_dark",
|
||||||
|
"farming:cocoa_beans",
|
||||||
"flowers:tulip_black",
|
"flowers:tulip_black",
|
||||||
"mesecons_materials:glue",
|
"mesecons_materials:glue",
|
||||||
"moreblocks:cobble_compressed",
|
"moreblocks:cobble_compressed",
|
||||||
"moretrees:rubber_tree_trunk"
|
"moretrees:rubber_tree_trunk",
|
||||||
}
|
"technic:chromium_lump",
|
||||||
|
"technic:sulfur_lump"
|
||||||
},
|
},
|
||||||
{
|
H = 0.8,
|
||||||
command = "adddropdown",
|
label = "Item name",
|
||||||
Y = 5.2,
|
|
||||||
label = "Destination",
|
|
||||||
selected_id = 1,
|
selected_id = 1,
|
||||||
W = 10,
|
W = 10,
|
||||||
|
command = "adddropdown",
|
||||||
|
Y = 3.2,
|
||||||
|
X = 0.4,
|
||||||
|
name = "ddItem"
|
||||||
|
},
|
||||||
|
{
|
||||||
X = 0.4,
|
X = 0.4,
|
||||||
H = 0.8,
|
H = 0.8,
|
||||||
name = "ddDestination",
|
command = "adddropdown",
|
||||||
choices = {
|
choices = {
|
||||||
"Tacit:cobblecompress",
|
"Tacit:cobblecompress",
|
||||||
"Tacit:extract",
|
"Tacit:extract",
|
||||||
|
|
@ -60,81 +63,92 @@ mem.controls = {
|
||||||
"Tacit:obsidian",
|
"Tacit:obsidian",
|
||||||
"Tacit:plasticin",
|
"Tacit:plasticin",
|
||||||
"Tacit:refab"
|
"Tacit:refab"
|
||||||
}
|
},
|
||||||
|
W = 10,
|
||||||
|
label = "Destination",
|
||||||
|
selected_id = 1,
|
||||||
|
Y = 5.2,
|
||||||
|
name = "ddDestination"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default = "99",
|
default = "99",
|
||||||
label = "Stack size",
|
|
||||||
X = 0.7,
|
|
||||||
W = 1.2,
|
|
||||||
command = "addfield",
|
command = "addfield",
|
||||||
Y = 7.1,
|
|
||||||
name = "fldStackSize",
|
name = "fldStackSize",
|
||||||
H = 0.8
|
W = 1.2,
|
||||||
|
X = 0.7,
|
||||||
|
Y = 7.1,
|
||||||
|
H = 0.8,
|
||||||
|
label = "Stack size"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default = "1",
|
default = "1",
|
||||||
label = "Stacks count",
|
|
||||||
X = 1.9,
|
|
||||||
W = 1.6,
|
|
||||||
command = "addfield",
|
command = "addfield",
|
||||||
Y = 7.1,
|
|
||||||
name = "fldStacksCount",
|
name = "fldStacksCount",
|
||||||
H = 0.8
|
W = 1.6,
|
||||||
|
X = 1.9,
|
||||||
|
Y = 7.1,
|
||||||
|
H = 0.8,
|
||||||
|
label = "Stacks count"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label = "Order",
|
command = "addbutton",
|
||||||
|
name = "btnOrder",
|
||||||
W = 1.6,
|
W = 1.6,
|
||||||
X = 3.2,
|
X = 3.2,
|
||||||
command = "addbutton",
|
Y = 6.8,
|
||||||
H = 0.8,
|
H = 0.8,
|
||||||
name = "btnOrder",
|
label = "Order"
|
||||||
Y = 6.8
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
default = "",
|
default = "",
|
||||||
label = "Enter drawer controller or select one",
|
|
||||||
X = 0.7,
|
|
||||||
W = 9.2,
|
|
||||||
command = "addfield",
|
command = "addfield",
|
||||||
Y = 0.7,
|
|
||||||
name = "fldController",
|
name = "fldController",
|
||||||
H = 0.8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
default = "",
|
|
||||||
label = "Enter item id or select one",
|
|
||||||
W = 9.2,
|
W = 9.2,
|
||||||
X = 0.7,
|
X = 0.7,
|
||||||
command = "addfield",
|
Y = 0.7,
|
||||||
Y = 2.7,
|
|
||||||
name = "fldItem",
|
|
||||||
H = 0.8
|
|
||||||
},
|
|
||||||
{
|
|
||||||
default = "",
|
|
||||||
label = "Enter destination name or select one",
|
|
||||||
X = 0.7,
|
|
||||||
W = 9.2,
|
|
||||||
command = "addfield",
|
|
||||||
H = 0.8,
|
H = 0.8,
|
||||||
|
label = "Enter drawer controller or select one"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default = "",
|
||||||
|
command = "addfield",
|
||||||
|
name = "fldItem",
|
||||||
|
W = 9.2,
|
||||||
|
X = 0.7,
|
||||||
|
Y = 2.7,
|
||||||
|
H = 0.8,
|
||||||
|
label = "Enter item id or select one"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
default = "",
|
||||||
|
command = "addfield",
|
||||||
|
X = 0.7,
|
||||||
|
W = 9.2,
|
||||||
name = "fldDestination",
|
name = "fldDestination",
|
||||||
Y = 4.7
|
Y = 4.7,
|
||||||
|
H = 0.8,
|
||||||
|
label = "Enter destination name or select one"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
command = "addlabel",
|
command = "addlabel",
|
||||||
label = "Created with SX Digi labs Touch Designer",
|
|
||||||
Y = 8.11,
|
Y = 8.11,
|
||||||
X = 7.18
|
X = 7.18,
|
||||||
|
label = "Created with SX Digi labs Touch Designer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
||||||
local function addvalues(control, value)
|
local function addvalues(control, value)
|
||||||
local controls = mem.controls
|
local controls = mem.controls
|
||||||
|
|
||||||
for k,v in pairs(controls) do
|
for k,v in pairs(controls) do
|
||||||
if v.name and v.name == control then
|
if v.name and v.name == control then
|
||||||
|
|
||||||
|
for kc,vc in pairs(v.choices) do
|
||||||
|
if vc == value then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
table.insert(v.choices, value)
|
table.insert(v.choices, value)
|
||||||
table.sort(v.choices)
|
table.sort(v.choices)
|
||||||
end
|
end
|
||||||
|
|
@ -144,11 +158,8 @@ local function addvalues(control, value)
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.type == "program" then
|
if event.type == "program" then
|
||||||
mem = {}
|
|
||||||
createui()
|
createui()
|
||||||
digiline_send("touch", mem.controls)
|
digiline_send("touch", mem.controls)
|
||||||
mem.orderNumber = 0
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if event.type == "digiline" then
|
if event.type == "digiline" then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user