68 posts
Location
USA
Posted 08 September 2014 - 03:20 PM
Here's the code below.
p = peripheral.wrap("back")
while true do
x = p.getPressure()
print(x)
if x > 3 then
rs.setOutput("left", true)
else
rs.setOutput("left", false)
end
sleep(5)
end
The idea behine this is to monitor the pressure from the pipes from a PneumaticCraft air pipes. It reads the pressure from the back of the pc from the pipes. When the pressure gets over 3.0 bars, It stops sending a redstone signal and stops the air compresser. When the pressure gets below 3.0 bars it starts the compressor again.
When I run the code. All I get is attemp to call nil.
656 posts
Posted 08 September 2014 - 03:44 PM
Always post the full error, with line number.
I assume the line number is 3. Are you sure the peripheral is on the back of the computer? If so, do you have openperipherals installed? Type this in the terminal:
openp/docs back
What does that output?
Edited on 08 September 2014 - 01:44 PM
68 posts
Location
USA
Posted 08 September 2014 - 04:13 PM
No, Line 3 is not the error then again I don't know. and I don't know what openperipherals is. so No I don't have it installed.
and as for the
openp/docs back
command I get "No Such Program". and I did post the error. "attempt to call nil" << This is the error I got.
Edited on 08 September 2014 - 02:14 PM
8543 posts
Posted 08 September 2014 - 04:16 PM
I wonder if PneumaticCraft exposes a peripheral interface itself. If it doesn't, OpenPeripheral probably adds it. It may be helpful to look through the documentation for PC and see if this is the case.
7083 posts
Location
Tasmania (AU)
Posted 08 September 2014 - 04:21 PM
It sounds like the functionality is added by PneumaticCraft.
Presumably the block is being wrapped correctly, as there's no error stating p isn't a table.
We'd expect the full error to include a script name and line number, though.
8543 posts
Posted 08 September 2014 - 04:24 PM
Perhaps the output of this line run in the Lua prompt could elucidate, then:
textutils.tabulate(peripheral.getMethods("back"))
The culprits I see as being likely are either a misspelled peripheral.wrap in the code but not here, or getPressure not being one of the peripheral methods.
68 posts
Location
USA
Posted 08 September 2014 - 04:46 PM
Guys, It's like I said. The video I saw could have been an older video and it has older code. The problem is that I didn't want to have to add more mods to my server and client. There has to be a way to do this. I can't under stand why no way would even try o add this option in some where.
Let me explain what I'm trying to do.
I have PneumaticCraft installed for the doors and elevators. The problem is how to add air with out over loading the system and blowing it up. I'm using the Kinetic compresser and I'm using EnderIO to generate power for it. The Kinetic compresser can be setup to allow a redstone signal to be sent to it when pressure falls. The problems is how to do it.
I don't want to install any more mods. I have to try with what I have.
7083 posts
Location
Tasmania (AU)
Posted 08 September 2014 - 04:52 PM
Righto.
Try going into the Lua prompt (just type "lua" into your computer and hit return), enter the line Lyqyd posted above, and post here what it tells you. Preferably in screenshot form.
68 posts
Location
USA
Posted 08 September 2014 - 05:05 PM
I ran this code
textutils.tabulate(peripheral.getMethods("back"))
And I got this answer. Sorry I didn't know I had to be in lua before I could type these commands.
getPressure getDangerPressure
GetCriticalPressure getDefaultVolume
656 posts
Posted 08 September 2014 - 05:10 PM
Are you sure the code you posted matches the code on the computer exactly?
Could you post the full error, maybe a screenshot?
Edited on 08 September 2014 - 03:10 PM
68 posts
Location
USA
Posted 08 September 2014 - 05:19 PM
?, I told you. I'm getting an "attempt to call nil". THAT'S The error I'm getting
Let me put another pc down and run the program again and see if that does any thing. I don't know. I need to get rid of the dots on the PC's screen. That part sucks.,
68 posts
Location
USA
Posted 08 September 2014 - 05:26 PM
Hmmm, This is strange. Now it's working. I busted the pc and put a new one down and coded it and ran the progam and it's working. So I guess you still have some bugs.
How do I exit from a lua program that's in a loop.
656 posts
Posted 08 September 2014 - 05:48 PM
Hold Ctrl + T for a few seconds.
68 posts
Location
USA
Posted 08 September 2014 - 06:00 PM
Thank you. One last question. This seems to be working. Any idea when the coders will get the dots off the screen. This makes it hard for me to read the screen.
68 posts
Location
USA
Posted 08 September 2014 - 06:12 PM
Thank you. One last question. This seems to be working. Any idea when the coders will get the dots off the screen. This makes it hard for me to read the screen.
I added a screen shot of what I'm seeing.
376 posts
Location
[string "FindMe"]:23143: bad argument #1 to 'returnPos' (vector expected, got nil)
Posted 08 September 2014 - 06:20 PM
Thank you. One last question. This seems to be working. Any idea when the coders will get the dots off the screen. This makes it hard for me to read the screen.
I added a screen shot of what I'm seeing.
That is your texture pack
Makes spaces look like "."s
68 posts
Location
USA
Posted 08 September 2014 - 06:35 PM
WOW. I didn't want to change packs. I like this pack. I'll have to contact the coders for it and let them know. Thanks
8543 posts
Posted 08 September 2014 - 07:40 PM
Try launching the game with the default texture pack before switching to your custom one. For reference, "attempt to call ? (a nil value)" isn't the full error message, there is also a file name and line number that precedes it and is part of the full error message. That information can be helpful in debugging, which is why you were asked for it repeatedly.
68 posts
Location
USA
Posted 08 September 2014 - 08:27 PM
Sorry the was no other error message. That's all it said. Right now it works so I'm not too worried about the error right now. and I'll try you idea on the resource packs/
Your right, It's the resource pack. I'll have to try again and contact them.