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

Base Monitor Program

Started by shinigamiblack, 19 April 2014 - 10:00 AM
shinigamiblack #1
Posted 19 April 2014 - 12:00 PM
Hello, I have zero programming experience but decided to give it a try utilizing the wiki and forums. What I have so far is a touch screen setup that turns on/off various machines in my base. It worked great so I decided to try and build a 2x3 monitor setup that displays status'. I pretty much have it drawing all the static text how I want, but the variable text (i.e. closed/open doors) is a bit out of my league. I am hoping someone can point me in the right direction. Thank you in advance

http://pastebin.com/qYM1UKDn

Edit: The problem I am having is getting the received red net messages to write to the proper lines, I can't figure out how to set the message from each computer to its own variable(if thats even possible).
Edited on 20 April 2014 - 10:03 PM
RoD #2
Posted 19 April 2014 - 10:23 PM
I see you set the variable id to _
This may cause some errors.

A breif explanations of variables:


var = "hello" -- String
numb = 123 -- Numbers (int)
other = var -- other variables (in this case "hello")

You have more but lets stick to these for the basics.

For the numbers you can do math operations like +, -, /, * and %.

The Strings are the most used, as you can process user input and test it:


input = read() --assigned variable input to read()
print("Hello "..input) -- you can use the two dots to add a variable to a normal string, this will output, for example, if the used typed in "Joe": #"Hello Joe"

Hope you learned something. Any questions, i will be glad to help :)/>
Edited on 19 April 2014 - 08:23 PM
shinigamiblack #3
Posted 20 April 2014 - 02:38 AM
Thanks for the response. Im not getting any errors, the code is working the problem I am having is processing the while loop at the bottom. I will edit my initial post to better explain my problem.
Bomb Bloke #4
Posted 20 April 2014 - 02:40 AM
Where's the other script?
shinigamiblack #5
Posted 20 April 2014 - 03:10 AM
Here is the one that pushes status updates for an enderio capacitor bank:


capBank = peripheral.wrap("tile_enderio_blockcapacitorbank_name_1")
m = peripheral.wrap("top")
id = 32 --Display ComputerID

rednet.close("top")
rednet.open("top")

print("ComputerID : "..os.getComputerID())

function getEnergy()
    lvlStored = capBank.getEnergyStored("left")
    rednet.send(id, lvlStored, dis)
end

function maxEnergy()
	 maxStored = capBank.getMaxEnergyStored("left")
    rednet.send(id, maxStored, dis)
end

while true do
    getEnergy()
    sleep(1)
    maxEnergy()
    sleep(10)
end