8 posts
Posted 14 June 2016 - 05:30 AM
So I posted this on the FTB forums and didnt get a reply, I assume Id get more help here.
If youve seen my other post, about liquid sorting from a smeltery, then you have some idea what this is.
Basically I have a smeltery I want to control VIA ComputerCraft with Redstone Signals. I have 48 tanks connected with Ender Fluid Ducts with Bundled Cabled connected to them.
My Monitor is connected with a network cable, on the bottom. Sides Left, Back, and Right all have bundled cables connected to tanks, with all 16 colors. Side Top is to the smeltery. White is for taking liquids out.
My error is Tinkers:16: Attempt to compare nil with number
My code:
http://pastebin.com/cvyyYjLH
Original post: http://forum.feed-the-beast.com/threads/computercraft-help.158448/
1220 posts
Location
Earth orbit
Posted 14 June 2016 - 05:49 AM
line 15 should read…
event, side, xPos, yPos = os.pullEvent("monitor_touch")
note the quotes around monitor_touch
Right now you're pulling all events since monitor_touch (without quotes) is a variable that is undefined and therefor nil. That's why you're getting attempt to compare nil with number because an event other than "monitor_touch" is triggering your os.pullEvent line but isn't supplying values for xPos, and/or yPos.
8 posts
Posted 14 June 2016 - 06:01 AM
line 15 should read…
event, side, xPos, yPos = os.pullEvent("monitor_touch")
note the quotes around monitor_touch
Right now you're pulling all events since monitor_touch (without quotes) is a variable that is undefined and therefor nil. That's why you're getting attempt to compare nil with number because an event other than "monitor_touch" is triggering your os.pullEvent line but isn't supplying values for xPos, and/or yPos.
Thank you, and later in the code I have
if event == monitor_touch
Is that right? Because it isnt stopping the redstone signal. (Well, bundled cable-white signal, lol)
Edit: Or going back to the beginning of the main loop. ("while true do" line 14)
Edited on 14 June 2016 - 04:49 AM
7083 posts
Location
Tasmania (AU)
Posted 14 June 2016 - 06:49 AM
As Dog just explained, "monitor_touch" is a string (which is what you want here), and monitor_touch is a variable (which you haven't defined, so it has no content).
Edited on 14 June 2016 - 04:49 AM
8 posts
Posted 14 June 2016 - 07:46 AM
As Dog just explained, "monitor_touch" is a string (which is what you want here), and monitor_touch is a variable (which you haven't defined, so it has no content).
So on line 24, I need quotes around it? I've tried that. Is there a specific way to make it a string?
Sorry, I'm fairly new to thing language.
7083 posts
Location
Tasmania (AU)
Posted 14 June 2016 - 08:18 AM
Yes, you wrap it in quotes. It'd be worth reading
this tutorial.