Jump to content




[1.51+] Using Network Cables (for dummies)


  • You cannot reply to this topic
106 replies to this topic

#61 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 27 June 2013 - 12:30 AM

View PostLarandar, on 27 June 2013 - 12:27 AM, said:

Good tutorial.

BTW can we use the modem.transmit( freq, chan, message ) but with wireless modem ?
Because rednet change and frequency and channel are gone...

Thanks
Wireless modems work in the same way as wired modems, so yes.

#62 kao

  • Members
  • 4 posts

Posted 29 June 2013 - 01:34 PM

Hello, I am a dummy, which is why I was drawn to your post about network cables. I can't seem to get the program for the right side computer to work. I get the error:

bios:337: [string "modemcompR"]:7: unexpected symbol


Just to be clear, "modemcompR" is the name I gave to the right-side computer program. It is just the code you posted in your tutorial:


local modem = peripheral.wrap('left')
modem.open(1)

local _, side, freq, rfreq, message = os.pullEvent('modem_message')

print('The message came on the '..side..' modem.')
print('It was on frequency '..freq..' and wants a reply on '..rfreq)
print('The message was: '..message)


Any suggestions for what I might need to do? Would greatly appreciate any feedback.

#63 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 29 June 2013 - 05:07 PM

Is that the text of your program, or mine? According to the error, there's something off about line 7 or 8 of your program.

#64 kao

  • Members
  • 4 posts

Posted 30 June 2013 - 11:33 PM

It is the text from your program. I used the code which you listed for the right side computer, and it gave me the error code "bios:337: [string "modemcompR"]:7: unexpected symbol" when I ran it. I have not written any new code of my own, but I saved your code as "modemcompR"

#65 BlankWolf

  • Members
  • 51 posts

Posted 01 July 2013 - 12:52 AM

Thanks that is an awesome tutorial. But I have 1 question.
Is it possibile to provent a computer in that network to shutdown or reboot by an other?

#66 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 01 July 2013 - 02:51 AM

View Postkao, on 30 June 2013 - 11:33 PM, said:

It is the text from your program. I used the code which you listed for the right side computer, and it gave me the error code "bios:337: [string "modemcompR"]:7: unexpected symbol" when I ran it. I have not written any new code of my own, but I saved your code as "modemcompR"
Make sure you copied the code correctly to your program. There's nothing wrong with what you pasted here.

View PostBlankWolf, on 01 July 2013 - 12:52 AM, said:

Thanks that is an awesome tutorial. But I have 1 question.
Is it possibile to provent a computer in that network to shutdown or reboot by an other?
Only by deactivating its connection. If it can be seen as a peripheral, once other computers can wrap it, its theirs to control, and there's nothing you can do about it.

#67 BlankWolf

  • Members
  • 51 posts

Posted 01 July 2013 - 03:27 AM

View PostKingdaro, on 01 July 2013 - 02:51 AM, said:

View PostBlankWolf, on 01 July 2013 - 12:52 AM, said:

Thanks that is an awesome tutorial. But I have 1 question.
Is it possibile to provent a computer in that network to shutdown or reboot by an other?
Only by deactivating its connection. If it can be seen as a peripheral, once other computers can wrap it, its theirs to control, and there's nothing you can do about it.
I can't test this yet, but when you have a wireless modem and wrap it like the modem, can you shutdown an other computer with wireless modem?

#68 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 01 July 2013 - 03:39 AM

Wireless? No. You can only access another computer through wired modems, and if the computer's wired modem has an active peripheral connection.

#69 BlankWolf

  • Members
  • 51 posts

Posted 01 July 2013 - 03:53 AM

View PostKingdaro, on 01 July 2013 - 03:39 AM, said:

Wireless? No. You can only access another computer through wired modems, and if the computer's wired modem has an active peripheral connection.
ok thanks

#70 kao

  • Members
  • 4 posts

Posted 02 July 2013 - 11:10 AM

Thankyou for creating your tutorial, and for your help with my problem. It turns out I was using commas instead of periods for the .. at the end of line 7. They look very similar to my eyes on the CC screen and I couldn't find it after going over it many times.

Do you know if there is a way to copy text directly from the ComputerCraft screen so that I can paste it into something else for troubleshooting purposes in the future? I had to transcribe my code by hand last time, which is of course why the commas didn't show up in the text I showed you since my brain transformed them into periods.

Thanks again for your help!

#71 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 02 July 2013 - 11:25 AM

View Postkao, on 02 July 2013 - 11:10 AM, said:

Thankyou for creating your tutorial, and for your help with my problem. It turns out I was using commas instead of periods for the .. at the end of line 7. They look very similar to my eyes on the CC screen and I couldn't find it after going over it many times.

Do you know if there is a way to copy text directly from the ComputerCraft screen so that I can paste it into something else for troubleshooting purposes in the future? I had to transcribe my code by hand last time, which is of course why the commas didn't show up in the text I showed you since my brain transformed them into periods.

Thanks again for your help!

No problem!

Your CC scripts are stored in your world, in the path .minecraft/saves/(your world folder)/computer/(your computer id), where your computer id is the number you get by typing "id" into your computer console. You can open the script in that folder with an editor such as Notepad, then copy and paste it here.

For future reference, when you do paste code here, it's good practice to use [code][/code] tags,

function soYour()
  if code then
    looks = likeThis()
  end
end


#72 That_Guy

  • New Members
  • 1 posts

Posted 19 July 2013 - 12:24 PM

Hello, I was wondering if

local _, side, freq, rfreq, message = os.pullEvent('modem_message')

was possible to use with a timeout number like rednet.receive()

#73 acesoyster

  • Members
  • 6 posts
  • LocationBuckinghamshire, UK

Posted 20 July 2013 - 05:55 AM

Embarrassingly simple, glad someone wrote it down or I'd never have used these.

Thanks a lot (:

#74 Dejected

  • Members
  • 48 posts
  • LocationPhiladelphia, Pennsylvania

Posted 22 July 2013 - 12:38 AM

Thank You

#75 Kingdaro

    The Doctor

  • Members
  • 1,636 posts
  • Location'MURICA

Posted 22 July 2013 - 12:52 AM

View PostThat_Guy, on 19 July 2013 - 12:24 PM, said:

Hello, I was wondering if

local _, side, freq, rfreq, message = os.pullEvent('modem_message')

was possible to use with a timeout number like rednet.receive()

It's possible, but involves a bit of tricky logic. The key is to wait for a timer event in conjunction with a modem message event, and keep pulling events until either are received. This function should do the trick (untested, keep that in mind):

function modemTimeout(time)
  local timeout = os.startTimer(time)
  while true do
    local ev, p1, p2, p3, p4 = os.pullEvent()
    if ev == 'timer' and p1 == timeout then
      return nil
    elseif ev == 'modem_message' then
      return p1, p2, p3, p4
    end
  end
end

Usage to, for example, wait a max 10 seconds for a modem message:
local side, freq, rfreq, message = modemTimeout(10)

And to check if we actually got a message:
if message then
  -- do stuff
end

Of course, you could check for any other variable, but this probably makes the most sense.

#76 jmarko

  • Members
  • 10 posts

Posted 24 July 2013 - 03:15 PM

Thanks, now I'm understand this too!

#77 deefster1000

  • Members
  • 5 posts
  • LocationAt Home(And Totally Not Under Your Bed)

Posted 08 August 2013 - 06:29 AM

How would i use modems to send a command to another computer?
i would like to make it so if someones doing something on their computer that would obviously damage the network, i could delete the program(s) from home, or turn off their computer before they save it, as just destroying it and replacing it is a bit too... simple.

#78 AngryTubersLP

  • Banned
  • 8 posts
  • LocationCologne

Posted 27 August 2013 - 07:00 AM

xD

#79 YuvonDovah

  • Members
  • 28 posts

Posted 27 August 2013 - 02:34 PM

Thanks Really Helpful.

#80 MayContainVennom

  • Members
  • 47 posts

Posted 30 August 2013 - 11:16 AM

Hey guys,

Is there a way I can edit a program on a floppy disk in a drive through a network? For instance I want to edit disk/test in drive_0 on a computer on the network. How would I go about doing this?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users