9 posts
Posted 16 August 2014 - 02:55 AM
I was looking for the peripherals used to control applied energistics with computercraft computers but when I made a simple script for the computer to print the peripherals I cant see them all. I need a way to page up or find a way to print this in a text document so I can see the rest.
Edited on 16 August 2014 - 01:56 PM
7083 posts
Location
Tasmania (AU)
Posted 16 August 2014 - 04:06 AM
Without seeing the code you're using to get and print that list, it's difficult to comment.
So probably the easiest advice to give is to dump into a file. Works like this:
local myFile = fs.open("filename","w") -- Open a file called "filename" in write mode, accessible via the variable "myFile".
myFile.write("some text") -- The write function works much like "term.write()".
myFile.writeLine("some more text") -- The writeLine function works much like "print()".
myFile.close() -- When you're done with the file.
You should be able to alter your current code to use file writes instead of regular prints/writes without much issue.
8543 posts
Posted 16 August 2014 - 06:39 AM
An easier solution for quick reference is, in the Lua prompt:
textutils.pagedTabulate(peripheral.getMethods("side"))
Replacing "side" with the actual side/peripheral name, of course. If you want to save the list of available functions for later, you should indeed write it to a file like Bomb Bloke suggests.
9 posts
Posted 16 August 2014 - 03:34 PM
Without seeing the code you're using to get and print that list, it's difficult to comment.
So probably the easiest advice to give is to dump into a file. Works like this:
local myFile = fs.open("filename","w") -- Open a file called "filename" in write mode, accessible via the variable "myFile".
myFile.write("some text") -- The write function works much like "term.write()".
myFile.writeLine("some more text") -- The writeLine function works much like "print()".
myFile.close() -- When you're done with the file.
You should be able to alter your current code to use file writes instead of regular prints/writes without much issue.
I might use this later but I was just looking for a single peripheral so Lyqyd's solution was easier.. Thanks anyway.
An easier solution for quick reference is, in the Lua prompt:
textutils.pagedTabulate(peripheral.getMethods("side"))
Replacing "side" with the actual side/peripheral name, of course. If you want to save the list of available functions for later, you should indeed write it to a file like Bomb Bloke suggests.
This worked very well. Thanks.
9 posts
Posted 16 August 2014 - 04:04 PM
OK, now that I have the method I was looking for I cant seem to get it working.
a = peripheral.wrap("left")
a.requestCrafting("2750")
I get this error.
2750 is the id im trying to request crafting.
1080 posts
Location
In the Matrix
Posted 16 August 2014 - 04:06 PM
OK, now that I have the method I was looking for I cant seem to get it working.
a = peripheral.wrap("left")
a.requestCrafting("2750")
I get this error.
2750 is the id im trying to request crafting.
I believe at some point you have to specify how many you want crafted. Which means that most likely you should probably use:
a.requestCrafting(1,2750)
Edited on 16 August 2014 - 02:07 PM
9 posts
Posted 16 August 2014 - 04:17 PM
OK, now that I have the method I was looking for I cant seem to get it working.
a = peripheral.wrap("left")
a.requestCrafting("2750")
I get this error.
2750 is the id im trying to request crafting.
I believe at some point you have to specify how many you want crafted. Which means that most likely you should probably use:
a.requestCrafting(1,2750)
I got the same error but the error included the item count also.
1220 posts
Location
Earth orbit
Posted 16 August 2014 - 06:02 PM
Try this
a.requestCrafting({id=2750,qty=1})
Edited on 16 August 2014 - 04:04 PM