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

URGENT SERVER PROGRAM HELP!

Started by hockeyb48, 09 March 2016 - 08:13 PM
hockeyb48 #1
Posted 09 March 2016 - 09:13 PM
Hello everyone! I am in need for a program ASAP that I have attempted to write and I failed. I just deleted it. This is for my city server which has an airport. It would be awesome if someone in the community to help but here is what I need.

I need:
A wireless flight board system (displaying 8 flights, departure and arrival time and gate, and whether it is on time or not)
I would like to have multiple flight displays and one with a computer.
(Its more of a role-play server and we have actual planes, so I need to be able to type a command on the computer and change the information fast. Not fumbling around in the edit menus.

2nd: 10 different wireless displays for each baggage claim, I just need to have the screen Baggage Claim 1,2,3,3 etc. and have a flight name on it.

It would be awesome if someone could help me out with this!
(I can set it up, as long as you give me instructions and pasterns)
Lyqyd #2
Posted 09 March 2016 - 10:24 PM
Moved to General.
Creator #3
Posted 09 March 2016 - 10:55 PM
Nobody is going to write such a huge program for you. The better option is to start yourself, and we will guide and correct you.
Bomb Bloke #4
Posted 10 March 2016 - 12:12 AM
More to the point, this sounds like the sort of thing best "set up" by the guy coding it. Writing such a series of scripts without immediate access to the world would be like painting in the dark.
hockeyb48 #5
Posted 10 March 2016 - 11:11 PM
Ok, I will simplify it. All I need is a basic program, where I turn on a computer in a office and easily type text. The text that I type would be on about 4 monitors. It would all be transmitted via wireless modems.
KingofGamesYami #6
Posted 10 March 2016 - 11:49 PM

local t, mons = term.current(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
    rednet.open( name )
    return true
  end
end )

setmetatable( mons, {__index = function( t, k ) --#spoofing a window which draws to everything
  return function( ... )
    for i, v in ipairs( t ) do --#iterate through the windows, calling the method on each
      v[ k ]( ... )
    end
    return t[ k ]( ... )
  end
end})

term.redirect( mons ) --#redirect to spoofed window

while true do --#forever
  rednet.broadcast( read() ) --#read and broadcast your input
end

http://www.computercraft.info/wiki/Term.current
http://www.computercraft.info/wiki/Peripheral.find
http://computercraft.info/wiki/Modem.isWireless
http://computercraft.info/wiki/Rednet.open
http://www.computercraft.info/wiki/Term.redirect
http://computercraft.info/wiki/Rednet.broadcast
Edited on 12 March 2016 - 02:03 AM
hockeyb48 #7
Posted 11 March 2016 - 09:31 PM

local t, mons = term.current(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
	rednet.open( name )
	return true
  end
end )

setmetatable( mons, {__index = function( t, k ) --#spoofing a window which draws to everything
  return function( ... )
	for i, v in ipairs( t ) do --#iterate through the windows, calling the method on each
	  v[ k ]( ... )
	end
	return t[ k ]( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

while true do --#forever
  rednet.broadcast( read() ) --#read and broadcast your input
end

http://www.computerc...ki/Term.current
http://www.computerc...Peripheral.find
http://computercraft...odem.isWireless
http://computercraft...iki/Rednet.open
http://www.computerc...i/Term.redirect
http://computercraft...ednet.broadcast

A little confused, all I have is code where do I put it. I made a pastebin for it, and downloaded it on computer all I got is an error message.
Where do I put the code you gave me and where do I put the monitor computer code for the wireless monitors.
Thanks
KingofGamesYami #8
Posted 11 March 2016 - 11:39 PM
What error did you get? The way i designed it, the location of peripherals is irrelevant.
hockeyb48 #9
Posted 12 March 2016 - 02:17 AM
What error did you get? The way i designed it, the location of peripherals is irrelevant.

I think I am doing something wrong. How do I set it up? Do I install the program on the host computer and then install it on the other wireless receiving computers with monitors?

ERROR MESSAGE:::


bios.lua:14: [string "host"]:19: '}' expected (to close '{' at line 10)



Not sure what that means, but I am kind of a noob to computer craft.

Thanks again.
KingofGamesYami #10
Posted 12 March 2016 - 03:05 AM
Ah that's my fault. Edited my other post to fix.

Bad me! Test code more! *facedesks*
hockeyb48 #11
Posted 12 March 2016 - 03:09 AM
Ah that's my fault. Edited my other post to fix.

Bad me! Test code more! *facedesks*

I just don't want to mess this up, so what are your recommendations on setting this up. Does this code go on both computers (main computer and receive computer)? One more question, is there anything I have to do code wise, (like changing the id's so they match).


Thanks
KingofGamesYami #12
Posted 12 March 2016 - 03:39 AM
Hmm.. I hadn't written a receiving program. It's a very simple modification of the "master" program, simply replacing the rednet.broadcast( read() ) with a print( select( 2, rednet.receive()) )


local t, mons = term.current(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
        rednet.open( name )
        return true
  end
end )

setmetatable( mons, {__index = function( t, k ) --#spoofing a window which draws to everything
  return function( ... )
        for i, v in ipairs( t ) do --#iterate through the windows, calling the method on each
          v[ k ]( ... )
        end
        return t[ k ]( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

while true do
  print( select( 2, rednet.receive() ) )
end
hockeyb48 #13
Posted 12 March 2016 - 03:57 AM
Hmm.. I hadn't written a receiving program. It's a very simple modification of the "master" program, simply replacing the rednet.broadcast( read() ) with a print( select( 2, rednet.receive()) )
 local t, mons = term.current(), { peripheral.find( "monitor" ) } --#getting the current window and monitors peripheral.find( "modem", function( name, obj ) --#opening up rednet if obj.isWireless() then rednet.open( name ) return true end end ) setmetatable( mons, {__index = function( t, k ) --#spoofing a window which draws to everything return function( ... ) for i, v in ipairs( t ) do --#iterate through the windows, calling the method on each v[ k ]( ... ) end return t[ k ]( ... ) end end term.redirect( mons ) --#redirect to spoofed window while true do print( select( 2, rednet.receive() ) ) end 


No luck :(/>…
Same error on the receive and on the send computer nothing happens. I think I am doing something wrong, can you give me a step by step please?

Thanks.
KingofGamesYami #14
Posted 12 March 2016 - 04:05 AM
That's strange. I'd expect the error to at least change.

I don't have the time to help for the moment, I've got to get some sleep. Someone else may be able to help you though.
hockeyb48 #15
Posted 12 March 2016 - 04:07 AM
That's strange. I'd expect the error to at least change.

I don't have the time to help for the moment, I've got to get some sleep. Someone else may be able to help you though.


Ok, thanks for the help so far. I am in Eastern Time Zone so I should get some sleep soon too.

Thanks
manu_03 #16
Posted 12 March 2016 - 09:10 AM
hockeyb48 said:
URGENT SERVER PROGRAM HELP!
ou
I have a couple of things to say.

1. Urgent? Your server could run until now. Why do you need it now?
2. Don't use caps. It makes it to appear like it's urgent.
3. Make it yourself. When you're stuck, ask a pro.
hockeyb48 #17
Posted 12 March 2016 - 03:56 PM
hockeyb48 said:
URGENT SERVER PROGRAM HELP!
ou
I have a couple of things to say.

1. Urgent? Your server could run until now. Why do you need it now?
2. Don't use caps. It makes it to appear like it's urgent.
3. Make it yourself. When you're stuck, ask a pro.

1. It is urgent, I can't start my server without this because I plan to use it as a leaderboard (for my pvp room, this is important) and flight board for my airport.

2. Because it is urgent.

3. I have good computer skills but NOT coding.
KingofGamesYami #18
Posted 12 March 2016 - 04:50 PM
Right, I installed minecraft & CC and tested stuff, this should work:
Spoiler

local t, mons = term.native(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
    rednet.open( name )
    return true
  end
end )

for k, v in pairs( t ) do
  mons[ k ] = function( ... )
    for i, v in ipairs( mons ) do
      v[ k ]( ... )
    end
    return v( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

while true do --#forever
  rednet.broadcast( read() ) --#read and broadcast your input
end

Spoiler

local t, mons = term.native(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
    rednet.open( name )
    return true
  end
end )

for k, v in pairs( t ) do
  mons[ k ] = function( ... )
    for i, v in ipairs( mons ) do
      v[ k ]( ... )
    end
    return v( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

while true do --#forever
  print( select( 2, rednet.receive() ) ) --#read and broadcast your input
end
hockeyb48 #19
Posted 12 March 2016 - 05:12 PM
Right, I installed minecraft & CC and tested stuff, this should work:
Spoiler

local t, mons = term.native(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
	rednet.open( name )
	return true
  end
end )

for k, v in pairs( t ) do
  mons[ k ] = function( ... )
	for i, v in ipairs( mons ) do
	  v[ k ]( ... )
	end
	return v( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

while true do --#forever
  rednet.broadcast( read() ) --#read and broadcast your input
end

Spoiler

local t, mons = term.native(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
	rednet.open( name )
	return true
  end
end )

for k, v in pairs( t ) do
  mons[ k ] = function( ... )
	for i, v in ipairs( mons ) do
	  v[ k ]( ... )
	end
	return v( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

while true do --#forever
  print( select( 2, rednet.receive() ) ) --#read and broadcast your input
end
'

No luck on the host, on the receive nothing happens, however the wireless modem lights up. Can you please give me a step by step, if you got it to work I have a feeling I am not setting this up right. Nothing happens on either.

Thanks
Edited on 12 March 2016 - 04:16 PM
KingofGamesYami #20
Posted 12 March 2016 - 05:45 PM
Well, I did this:

1) place computer
2) attach peripherals
3) run program
4) type
hockeyb48 #21
Posted 12 March 2016 - 06:52 PM
Well, I did this: 1) place computer 2) attach peripherals 3) run program 4) type

No luck, here is exactly what I did.

1. Copy each code and make a paste bin for each.
2. Place one regular computer and wireless modem behind.
3. Placed another computer with wireless modem behind and 4 monitors on the right.
4. Installed the host on the host computer and receive on the receiving computer.
5. run both programs
6. Nothing happens on either (on host after 20 secs it shutdown.)

The programs did nothing except freeze and nothing could be typed.
KingofGamesYami #22
Posted 12 March 2016 - 09:27 PM
Are you sure you're using the code from this post (in the spoilers)? The only difference between your setup and mine is that I have a monitor attached to the host as well.
hockeyb48 #23
Posted 13 March 2016 - 12:25 AM
Well, I did this: 1) place computer 2) attach peripherals 3) run program 4) type

GOT IT!!!
Thank you very MUCH!! I can now open my PVP area and finally put the finish touch on the airport!

You have been helpful thanks!
hockeyb48 #24
Posted 13 March 2016 - 12:37 AM
Are you sure you're using the code from this post (in the spoilers)? The only difference between your setup and mine is that I have a monitor attached to the host as well.

One quick thing, when I send text. How do I clear it when I want to change it.

Thanks
KingofGamesYami #25
Posted 13 March 2016 - 01:57 AM
Short answer: You don't, not the way I made it. The receivers are only able to receive updated messages, not respond to other commands. Myself, I find networking like this a pain. I'd just connect the monitors via networking cable and run everything off one computer.
hockeyb48 #26
Posted 13 March 2016 - 02:02 AM
Short answer: You don't, not the way I made it. The receivers are only able to receive updated messages, not respond to other commands. Myself, I find networking like this a pain. I'd just connect the monitors via networking cable and run everything off one computer.

Ok, can you write me an updated version using wired modems (and still keep old just in case).
Thanks
KingofGamesYami #27
Posted 13 March 2016 - 03:03 AM
Sure, I'm going to cheat a bit though. Basically what I'm doing is redirecting the terminal to every monitor connected to the computer, and then running the 'edit' program.

Spoiler

local t, mons = term.native(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
    rednet.open( name )
    return true
  end
end )

for k, v in pairs( t ) do
  mons[ k ] = function( ... )
    for i, v in ipairs( mons ) do
      v[ k ]( ... )
    end
    return v( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

shell.run( "edit .temp" )
hockeyb48 #28
Posted 15 March 2016 - 07:36 PM
Sure, I'm going to cheat a bit though. Basically what I'm doing is redirecting the terminal to every monitor connected to the computer, and then running the 'edit' program.

Spoiler

local t, mons = term.native(), { peripheral.find( "monitor" ) } --#getting the current window and monitors

peripheral.find( "modem", function( name, obj ) --#opening up rednet
  if obj.isWireless() then
	rednet.open( name )
	return true
  end
end )

for k, v in pairs( t ) do
  mons[ k ] = function( ... )
	for i, v in ipairs( mons ) do
	  v[ k ]( ... )
	end
	return v( ... )
  end
end

term.redirect( mons ) --#redirect to spoofed window

shell.run( "edit .temp" )

Program is working great Thanks!!

However, I was wondering if you could create another program that would allow me to extend the distance of my rednet wired network (like an extender that would repeat what I put on the screens. That would be great.

Thanks.
Lupus590 #29
Posted 15 March 2016 - 09:30 PM
However, I was wondering if you could create another program that would allow me to extend the distance of my rednet wired network (like an extender that would repeat what I put on the screens. That would be great.
Like this one? http://computercraft.info/wiki/Repeat
hockeyb48 #30
Posted 16 March 2016 - 12:08 AM
However, I was wondering if you could create another program that would allow me to extend the distance of my rednet wired network (like an extender that would repeat what I put on the screens. That would be great.
Like this one? http://computercraft.info/wiki/Repeat

Just wondering, how would I do this. I am very non-experienced coder, can you give me some instructions.

Thanks
KingofGamesYami #31
Posted 16 March 2016 - 03:28 AM
If you are wanting to simply repeat rednet messages, then the program Lupus590 linked would be of use. If you are looking to attach additional monitors via this network, it will not work because my program does not use rednet to do that.

However, if you wish, I can make the computers talk to each other. It would require some setup on your part, which I always try to avoid.
hockeyb48 #32
Posted 16 March 2016 - 09:31 PM
If you are wanting to simply repeat rednet messages, then the program Lupus590 linked would be of use. If you are looking to attach additional monitors via this network, it will not work because my program does not use rednet to do that.

However, if you wish, I can make the computers talk to each other. It would require some setup on your part, which I always try to avoid.

It would just be nice to add more monitors to my network.

Thanks
hockeyb48 #33
Posted 17 March 2016 - 08:34 PM
If you are wanting to simply repeat rednet messages, then the program Lupus590 linked would be of use. If you are looking to attach additional monitors via this network, it will not work because my program does not use rednet to do that.

However, if you wish, I can make the computers talk to each other. It would require some setup on your part, which I always try to avoid.




If I were to go the route where you said there was some setup. I am willing to give it a shot.

Thanks