Jump to content




[tekkit]8monitors displays all info. [Tables/data]


  • You cannot reply to this topic
4 replies to this topic

#1 Goof

  • Members
  • 751 posts

Posted 28 March 2013 - 09:01 PM

Hi:D

EDIT: Sorry.. the [code.] tags didnt indent the code

im on a tekkit server with my friend, and he asked me to make list above all our chests, which contains "Copper", "Tin" etc. but.
im a bit tired right now, and cant figure out, how to do this automatically.

local mon = peripheral.wrap("left")
local length = mon.getSize()
local sp = mon.setCursorPos
local w = mon.write

function getData()
data = fs.open("data", "r")
data.readAll()
data.close()
end
function saveData()
data1 = fs.open("data", "w")
for i = 1, #data do
fs.writeLine(data[i])
end
data1.close()
end

local ores = {
		[1] = { ['Copper'] = 32,
		['Iron'] = 32,
		['Gold'] = 32, } -- monitor 1 (above the 1 chest, should print "Copper", Iron, Gold --
		-- all of them ... (8 monitors at all)
}
local mon = peripheral.wrap('left')

for i, v in pairs( ores ) do
sp(v,v)
w(v)
end


could anyone please help me making that to happen?

more information comming soon
screenie:
Spoiler

old code:(my first attempt)
local mon = peripheral.wrap("left")
local length = mon.getSize()
local sp = mon.setCursorPos
local w = mon.write

function getData()
data = fs.open("data", "r")
data.readAll()
data.close()
end
function saveData()
data1 = fs.open("data", "w")
for i = 1, #data do
fs.writeLine(data[i])
end
data1.close()
end

local ores = {
		[1] = { ['Copper'] = 32,
		['Iron'] = 32,
		['Gold'] = 32, } -- monitor 1 (above the 1 chest, should print "Copper", Iron, Gold --
		-- all of them ...
}
local mon = peripheral.wrap('left')
-- this is what i did, quickly. but that is what i want to be automated. (checking the ores table and printing the containing data)
sp(1,1)
w(ores[1][1])
sp(1,2)
w(ores[1][2])
sp(1,3)
w(ores[1][3])
-- etc...




thanks in advance

#2 Goof

  • Members
  • 751 posts

Posted 29 March 2013 - 12:57 AM

Any help?

Please

Quick screenie of the result with "my first attempt"
Posted Image

#3 LordIkol

  • Members
  • 197 posts
  • LocationSwitzerland

Posted 29 March 2013 - 03:01 AM

hi Mikk,

From what i get you want to use the Monitors instead of a Sign?

If i got it correct you want sth that does this things
1. Write a Setup file like "monitor 1 = Tin Copper Silver Monitor 2 = Gold Iron Diamon etcc
2. a File that can Load this setup and display the Data on the correct Monitor

did i get it right?

#4 Goof

  • Members
  • 751 posts

Posted 29 March 2013 - 03:16 AM

Yup... but i actually got all the program to work... EXCEPT that save, and read part... my code is the following... (look for the few comments on saveData, and getData)
Spoiler
but, everything you said, is correct

#5 Goof

  • Members
  • 751 posts

Posted 29 March 2013 - 06:16 AM

Ehm.. im sorry to say, but after several hours of thinking/coding, i've found an idea: (this post is now solved)
Spoiler

Thanks helping me :D





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users