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

Problem with my new gui

Started by KeeganDeathman, 05 October 2014 - 03:10 AM
KeeganDeathman #1
Posted 05 October 2014 - 05:10 AM
Im making a gui for an old nitro program, his tree network. Im making it using bedrock, and i have it simplistic.
I am working on the master server for now, and it was working, but then it stopped.

I want to show the number of servers and routers linked to this server. I had it working with routers alone, but once i added servers, it stopped.
I also want to display the latest messgae sent to the server, and this is displayed much the same way, including how it doesnt work. But it should. Why isnt it.

Code:

program:Run(function()
program:LoadView('main')
rednet.open("top")
local requestid, request = rednet.receive()
processRequest(requestid, request)
while true do
requestid, request = rednet.receive()
processRequest(requestid, request)
program:GetObject('Routers').Text = 'Routers: '..#routers
if #routers == 0 then
  program:GetObject('Routers').Text = "Routers: 0"
end
program:GetObject('Servers').Text = 'Servers: '..#servers
if #servers == 0 then
  program:GetObject('Servers').Text = "Servers: 0"
end
program:GetObject('Message').Text = 'Latest request: '..request
end
end)
KeeganDeathman #2
Posted 05 October 2014 - 11:53 PM
I'd just like to say that servers and routers are tables containing info on all connected servers and routers.
KeeganDeathman #3
Posted 06 October 2014 - 01:42 AM
I have updated the code, I can get it to show a request, but i cant get it to keep listening afterwards or, so I've deduced, request is overwritten by nothing, as there isn't always something in the air.

Code:

function main()
local requestid, request = rednet.receive()
if table.getn(routers) >= 1 then
  program:GetObject('Routers').Text = 'Routers: '..table.getn(routers)
end
if table.getn(servers) >= 1 then
  program:GetObject('Servers').Text = 'Servers: '..table.getn(servers)
end
program:GetObject('Message').Text = 'Latest Request: '..request
processRequest(requestid, request)
while request ~= rednet.receive() do
  main()
end
end
Like in this one it doesn't work. The while loop should only execute if the saved request is different than whats in the air right?
Bomb Bloke #4
Posted 06 October 2014 - 02:56 AM
It may be worth PM'ing oeed to get his attention, as he's likely in the best position to help out here.
KeeganDeathman #5
Posted 09 October 2014 - 12:43 AM
No. He says to post here instead of pming him.
I fixed it anyway