Posted 01 May 2013 - 04:07 PM
so….
I guess you are intrested in finding out how rednet works.
First of all, you need a wireless modem, you craft them by surounding a redstone torch in stone in a crafting table.
So you will ofcourse also need a computer and/or turtle.
Once you've got that you are ready to program.
So first things first you have to open the wireless modem.
You will have to type (either type lua or edit a program)
Do you want to send? (send a message to a specific computer)
Or do you want to receive a message from a different pc/turtle.
So first off I will explain you what you do if you are on the transmitting end
So you do
You will have to use
Then you type your message, what should this be? Whatever you want…. do you want to type random shiz? do
Next up!
Now the receiving side.
Basicly you want to do
And message is the message the other computer send.
So if you want to only accept messages from a specific pc, you can do for example:
If you want to accept messages from any id, you can just do nothing with the id.
So… now you get a message.. so? what do we do with it?
First off, what do you want to do with it?
Example:
You want to make a chat system.
example2:
Do you want a program with the same name as the message
do
example3:
Do you want the computer to do something ONLY if you get that specific message?
do
So…. I guess this is it?
If you want to know anything ask me in the comments
I guess you are intrested in finding out how rednet works.
First of all, you need a wireless modem, you craft them by surounding a redstone torch in stone in a crafting table.
So you will ofcourse also need a computer and/or turtle.
Once you've got that you are ready to program.
So first things first you have to open the wireless modem.
You will have to type (either type lua or edit a program)
rednet.open("right") --- this can also be left/top/bottom/back/front
Then you will have to choose, do you want to broadcast? (sends a message to all computers in range)Do you want to send? (send a message to a specific computer)
Or do you want to receive a message from a different pc/turtle.
So first off I will explain you what you do if you are on the transmitting end
So you do
rednet.send(ID,"message")
or rednet.broadcast("message")
So… first off: rednet.sendYou will have to use
rednet.send(ID,"message")
The ID is the computer id you want to send the message to, you can find this by typing id in a computer on turtle.Then you type your message, what should this be? Whatever you want…. do you want to type random shiz? do
rednet.send(ID,"random shiz")
So this is all you have to do on the sending side.Next up!
rednet.broadcast()
This basicly does the exact same thing except you can leave out the ID because it will send it to every computer wich is receiving.Now the receiving side.
Basicly you want to do
id,message=rednet.receive() --- This WILL wait until you get a message you can't do anything in the meantime.
Id is the id from the computer who send you send the message.And message is the message the other computer send.
So if you want to only accept messages from a specific pc, you can do for example:
if
id==(ID you want to accept from)
then
the random code you want to do
else ---(optional)
end
If you want to accept messages from any id, you can just do nothing with the id.
So… now you get a message.. so? what do we do with it?
First off, what do you want to do with it?
Example:
You want to make a chat system.
do print(message)
example2:
Do you want a program with the same name as the message
do
shell.run(message)
example3:
Do you want the computer to do something ONLY if you get that specific message?
do
if
message==("COOKIES") --- cookies may be anything you want
then
do some random code
else -- (optional)
end
So…. I guess this is it?
If you want to know anything ask me in the comments