Posted 08 April 2015 - 07:46 PM
CC Noob here, while I'm sorta-kinda-OK with the code, this one's bugging me.
I am trying to set up a monitoring system for my factory. To start with, it will be using OpenCCSensors to monitor energy levels, and add coal to generators as needed. The computer monitoring energy levels will send those levels via rednet to a central PC, which will then display at-a-glance info. In the interest of portability since I may want to port this to a different server, I registered the hostname of both computers using rednet.host. The energy-monitoring computer then looks up the hostname of the central computer, and tries to send energy data every 5 seconds. However, therein lies my problem.
I can't figure out how to take the ID number generated by a lookup event - i.e, 5 - and put it into a rednet.send event. It wants a number - not a variable. Should I consider using the Modem API instead? I can hardcode the computer ID's in for now, but should I ever put it in a different place, it'll be hard and rather annoying to replace 20-25 variables on multiple PC's.
I am trying to set up a monitoring system for my factory. To start with, it will be using OpenCCSensors to monitor energy levels, and add coal to generators as needed. The computer monitoring energy levels will send those levels via rednet to a central PC, which will then display at-a-glance info. In the interest of portability since I may want to port this to a different server, I registered the hostname of both computers using rednet.host. The energy-monitoring computer then looks up the hostname of the central computer, and tries to send energy data every 5 seconds. However, therein lies my problem.
I can't figure out how to take the ID number generated by a lookup event - i.e, 5 - and put it into a rednet.send event. It wants a number - not a variable. Should I consider using the Modem API instead? I can hardcode the computer ID's in for now, but should I ever put it in a different place, it'll be hard and rather annoying to replace 20-25 variables on multiple PC's.