ComputerCraft Archive

Reactor information wireless [Server/Pocket computer]

pocket networking unknown forum

Description

Hello there! :)/>I made a program that can show you the stats of a Big Reactor on a Pocket Computer.Now, I made it myself, but i will not update it big scale, so feel free to use my code in anyway. If...

Installation

Copy one of these commands into your ComputerCraft terminal:

Pastebin:pastebin get bkc8M1Bi reactor_information_wireless_[server/pocket_computer]
wget:wget https://pastebin.com/raw/bkc8M1Bi reactor_information_wireless_[server/pocket_computer]
Archive:wget https://cc.shobie.xyz/cc/get/pb-bkc8M1Bi reactor_information_wireless_[server/pocket_computer]
Quick Install: wget https://cc.shobie.xyz/cc/get/pb-bkc8M1Bi Reactor information wireless [Server/Pocket computer]

Usage

Run the program after downloading

Tags

networkingforumpocket-programs

Source

View Original Source

Code Preview

local function openRednet()
local listOfSides = rs.getSides()
local listofPossibles = {}
local counter1 = 0
while true do
  counter1 = counter1 +1

  if peripheral.isPresent(tostring(listOfSides[counter1])) and peripheral.getType(listOfSides[counter1]) == "modem" then
   table.insert(listofPossibles,tostring(listOfSides[counter1]))
  end

  if counter1 == 6 and table.maxn(listofPossibles) == 0 then
   print("no modem present")
   return nil
  end

  if counter1 == 6 and table.maxn(listofPossibles) ~= 0 then
   rednet.open(listofPossibles[1])
   return listofPossibles[1]
  end
end
end
modemOn = openRednet()
if modemOn == nil then
print("No Modem")
print("Will shutdown in 3 seconds")
sleep(3)
os.shutdown()
else
print("Opened modem on "..modemOn.." side")
end

rednet.send(19, "request")
id, message = rednet.receive()
print ("Reactor Computer " .. id .. " answered")
print ("-" .. message .. " ")
i, m = rednet.receive()
print ("-" .. m .. " ")
id2, m2 = rednet.receive()
print ("-" .. m2 .. " ")
os.sleep(4)
term.clear()
term.setCursorPos(1,1)
error()

-- This is some simple code i made to get information about a Big Reactor wireless using a Pocket computer.
-- Place a computer with a wireless modem on the left side and the Computercraft Big Reactor port right behind it.
-- UPDATE! you need to input the right computer IDs in both programs respectivly
-- The Server computer program is at /AGq32UqZ
-- Made by Dukrobber