Posted 12 October 2012 - 04:32 PM
I'm BRAND NEW to Lua.
So I'm making a script to be able to get sensor readings on a monitor instead of a console itself, in realtime.
Problem is: The example I found on youtube only showed how the data got outputted within a console (computer) in a string array of sorts. I've done several attempts and searched the net for hours. At some point I thought I was onto something, but the problem is, the array outputted on a console can't be outputted on a monitor seeing as a monitor needs a new line for just about everything it seems…
So the entire bash goes into one line, which means I would have to make a screen a mile long and things would be not very user friendly or organized at all..
Am I just doing this a very hard way?
Anyone got a good solution/explanation to my problem here?
Also, on a different note, I can never use any advanced code on multiplayer tekkit, due to my Alt Gr button being registered as a Ctrl button, and my right Ctrl button doing nothing, so in other words I'm unable to make the [] {} symbols.. among others.
Suggestions are greatly appreciated!
Keep in mind, I know I can add a function and a loop to my script to make it realtime, but one thing at a time here.
So I'm making a script to be able to get sensor readings on a monitor instead of a console itself, in realtime.
Problem is: The example I found on youtube only showed how the data got outputted within a console (computer) in a string array of sorts. I've done several attempts and searched the net for hours. At some point I thought I was onto something, but the problem is, the array outputted on a console can't be outputted on a monitor seeing as a monitor needs a new line for just about everything it seems…
So the entire bash goes into one line, which means I would have to make a screen a mile long and things would be not very user friendly or organized at all..
Cursor1 = 8
Cursor2 = 8
os.unloadAPI("sensors")
os.loadAPI("/rom/apis/sensors")
revfunc = {}
mon = peripheral.wrap("right")
mon.clear()
mon.setCursorPos(5,1)
mon.setTextScale(1)
mon.write("test")
function printDict(data)
for i,v in pairs(data) do
mon.write (tostring(i).." - "..tostring(v))
end
end
ctrl = sensors.getController()
mon.setCursorPos(6,2)
mon.write(ctrl)
data = sensors.getSensors(ctrl)
mon.setCursorPos(7,3)
EnergySensor = data[1]
Engine = data[2]
data = sensors.getSensorInfo(ctrl,Engine)
mon.setCursorPos(7,4)
printDict(data)
mon.setCursorPos(9,10)
mon.write(data[9])
mon.write(data[2])
Am I just doing this a very hard way?
Anyone got a good solution/explanation to my problem here?
Also, on a different note, I can never use any advanced code on multiplayer tekkit, due to my Alt Gr button being registered as a Ctrl button, and my right Ctrl button doing nothing, so in other words I'm unable to make the [] {} symbols.. among others.
Suggestions are greatly appreciated!
Keep in mind, I know I can add a function and a loop to my script to make it realtime, but one thing at a time here.