This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Selim's profile picture

OpenPeripheral Storage Systen

Started by Selim, 18 June 2014 - 11:46 PM
Selim #1
Posted 19 June 2014 - 01:46 AM
I am trying to make a system where I can remote request items via the OpenPeripheral Terminal Glasses, by pulling items through a Logistics Pipes' Request Pipe. I would like the syntax of the command to be "$$request id dmg amount" but I can't figure out how to get arguments to work with the glasses. This is what I have so far for testing:

local g = peripheral.wrap("right")
local lg = peripheral.wrap("left")
local e, msg = os.pullEvent("chat_command")
if string.match(msg, "request") then
  print("Requesting")
end
theoriginalbit #2
Posted 19 June 2014 - 03:34 AM
well you'll find that the message will come through all as one, you can use patterns to break this up like so


local id, dmg, amount = msg:match("request (%d+) (%d+) (%d+)")
Selim #3
Posted 19 June 2014 - 01:12 PM
Ok, I will try that out.
Selim #4
Posted 19 June 2014 - 01:44 PM
That solved that problem, thanks ;)/>
Selim #5
Posted 19 June 2014 - 04:14 PM
Ok, that works now, and the code now looks like the below after some work and additional lines for debug reasons:
local g = peripheral.wrap("right")
local lg = peripheral.wrap("left")
local e, msg = os.pullEvent("chat_command")
local id, dmg, amount = msg:match("request (%d+) (%d+) (%d+)")
local arg = {...}
if string.match(msg, "request") then
  print("Requesting")
  print(id)
  print(dmg)
  print(amount)
  local requestedID = lg.getItemIdentifierIDFor(id, dmg)
  print(requestedID)
  local requestName = lg.getUnlocalizedName(requestedID)
  print(requestName)
  lg.makeRequest(requestedID, amount)
end

But, it returns:
SpoilerRequesting
1
0
4
test:10: No such
method.getItemIdentifierIDFor(java.lang.Double,
java.lang.Double)

When I enter: $$request 1 0 4 through my Terminal Glasses.
I am using this website to get the methods for Logistics Pipes: http://rs485.thezorr...mputerCraft_API
Edited on 19 June 2014 - 02:15 PM
theoriginalbit #6
Posted 19 June 2014 - 04:26 PM
This has been discussed before here, please read that for a resolution to your problem.
Selim #7
Posted 19 June 2014 - 04:44 PM
Ok, thanks
Selim #8
Posted 19 June 2014 - 05:01 PM
I added the classes to the config now, but the program will not return anything when I enter $$request 1 0 4. It doesn't even register that I sent anything. The weird thing is, when I am typing this into the Lua interface directly, it works fine.
Edited on 19 June 2014 - 03:01 PM
theoriginalbit #9
Posted 20 June 2014 - 06:32 AM
re-sync your terminal glasses to the glasses bridge. something may have caused them to be desynchronised.
Selim #10
Posted 20 June 2014 - 06:54 PM
Ok, got it, but now it returns the same error as before.
Edited on 20 June 2014 - 06:51 PM
theoriginalbit #11
Posted 21 June 2014 - 04:14 AM
then you've either got a version of OpenPeripheral where the blacklist was buggy (in which case update if you can) or you've not blocked logistics pipes correctly, so recheck the config (also perhaps try the mod id blacklist).
Selim #12
Posted 24 June 2014 - 01:37 AM
What would I use for the mod blacklist?