Jump to content




Base Monitor Program


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

#1 shinigamiblack

  • Members
  • 3 posts

Posted 19 April 2014 - 11:00 AM

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 by shinigamiblack, 20 April 2014 - 11:03 PM.


#2 RoD

  • Members
  • 313 posts

Posted 19 April 2014 - 09: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 by RoD, 19 April 2014 - 09:23 PM.


#3 shinigamiblack

  • Members
  • 3 posts

Posted 20 April 2014 - 01: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.

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 20 April 2014 - 01:40 AM

Where's the other script?

#5 shinigamiblack

  • Members
  • 3 posts

Posted 20 April 2014 - 02: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






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users