[spoiler]your stuff here[/spoiler]
For a named spoiler,
[namedspoiler="name"]stuff here[/namedspoiler]
Side note: large amounts of code are usually put on pastebin, as it makes debugging easier because line numbers are given.
Posted 04 December 2015 - 08:43 PM
[spoiler]your stuff here[/spoiler]
[namedspoiler="name"]stuff here[/namedspoiler]
Posted 05 December 2015 - 12:03 AM
the_hyren, on 04 December 2015 - 08:21 PM, said:
while true do command = listen("infuser1:") prefix = string.sub(command, 1, 6) print("1") chat.say("Running command: " .. prefix) print("2") if prefix == "infuse" then print("3") txtnum = string.sub(command, 8) chat.say("Getting recipe " .. txtnum) num = tonumber(txtnum) print("4") end print("5") end
Posted 07 December 2015 - 04:54 AM
Posted 07 December 2015 - 05:52 AM
the_hyren, on 07 December 2015 - 04:54 AM, said:
chat.say("Running command: "..prefix)
pcall(chat.say, "Running command: "..prefix)
Posted 07 December 2015 - 08:37 PM
Posted 07 December 2015 - 08:48 PM
Posted 07 December 2015 - 09:24 PM
Posted 08 December 2015 - 02:10 AM
for item in recipes[recipenum] do grabItem(item) end
for _, item in ipairs(recipes[recipenum]) do grabItem(item) end
local thisRecipe = recipes[recipenum] -- Cache the first table lookup so we don't need to repeat it. for i = 1, #thisRecipe do -- Repeats an amount equal to the "length" of the sub-table. grabItem(thisRecipe[i]) -- Get the i'th element from the sub-table and pass to grabItem. end
Edited by Bomb Bloke, 08 December 2015 - 02:14 AM.
Posted 08 December 2015 - 02:21 AM
Posted 11 December 2015 - 06:51 PM
Posted 12 December 2015 - 02:14 AM
the_hyren, on 11 December 2015 - 06:51 PM, said:
local function writeAt(text, x, y, tCol, bCol) if not (x and y) then local curX, curY = term.getCursorPos() x, y = x or curX, y or curY end term.setCursorPos(x, y) if tCol then term.setTextColour(tCol) end if bCol then term.setBackgroundColour(bCol) end term.write(text) end
the_hyren, on 11 December 2015 - 06:51 PM, said:
the_hyren, on 11 December 2015 - 06:51 PM, said:
Posted 12 December 2015 - 07:38 AM
Posted 12 December 2015 - 11:37 AM
the_hyren, on 12 December 2015 - 07:38 AM, said:
Edited by Bomb Bloke, 12 December 2015 - 11:38 AM.
Posted 12 December 2015 - 06:04 PM
infusersrunning = {0, 0, 0, 0} recipefile = "recipes" function trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end function load(filename) file = fs.open(filename, "r") data = file.readAll() file.close() return textutils.unserialize(data) end screen = peripheral.wrap("back") modem = peripheral.wrap("top") modem.open(5) recipes = loadRecipes(recipefile) sorter = peripheral.wrap("left") escape = false while escape == false do while sorter.pull("east") do sleep(10) end item = sorter.analyze() if item[stringId] == "minecraft:cobblestone" then command = "infuse "..tostring(item[amount]) searching = true channel = 0 while searching do for i=1, #infusersrunning do if infusersrunning[i] < 1 then channel = i infusersrunning[i] = item[amount] searching = false end end end modem.transmit(channel, 5, command) end while sorter.push("south") do sleep(5) end end
Posted 12 December 2015 - 07:10 PM
Posted 13 December 2015 - 06:27 AM
funct = parallel.waitForAny(channel,searching = waitForOpenInfuser(), infusionCompletionListener())Is that a valid way to get results from a function run by parallel? If not how can I do that?
Edited by the_hyren, 13 December 2015 - 06:24 AM.
Posted 13 December 2015 - 06:29 AM
the_hyren, on 13 December 2015 - 06:22 AM, said:
funct = parallel.waitForAny(channel,searching = waitForOpenInfuser(), infusionCompletionListener())Is that a valid way to get results from a function run by parallel? If not how can I do that?
Posted 13 December 2015 - 03:30 PM
Edited by the_hyren, 13 December 2015 - 03:30 PM.
Posted 13 December 2015 - 04:17 PM
func = parallel.waitForAny(pullItem("east"), infusionCompletionListener())
func = parallel.waitForAny( function() pullItem("east") end, infusionCompletionListener )
Posted 14 December 2015 - 03:45 PM
if num > #recipes then
Edited by the_hyren, 14 December 2015 - 03:48 PM.
0 members, 1 guests, 0 anonymous users