Jump to content




Set name of disk over network

networking

5 replies to this topic

#1 cmdpwnd

  • Members
  • 128 posts
  • LocationHere

Posted 06 March 2016 - 05:07 PM

anyone know how to set the name of a floppy disk when attached to a disk drive over the network?

#2 doublequestionmark

  • Members
  • 118 posts
  • LocationI honestly don't know

Posted 06 March 2016 - 05:12 PM

this code requires computer b, the receiving computer, to have a drive on the left. and for both computers to have wireless modems on the top

btw, this is by no means secure

computer a:
rednet.open('top')
write('Label: ')
r = read()
rednet.broadcast(r) 

computer b:
rednet.open('top')
i, m = rednet.receive()
shell.run('label set left ' .. m)


#3 cmdpwnd

  • Members
  • 128 posts
  • LocationHere

Posted 06 March 2016 - 05:14 PM

so in short, you can't set it directly

Edited by jacky500, 06 March 2016 - 05:14 PM.


#4 doublequestionmark

  • Members
  • 118 posts
  • LocationI honestly don't know

Posted 06 March 2016 - 05:23 PM

you MIGHT be able to set it directly using wired modems and just wrapping it as a peripheral.
sadly i dont have access to a mc installation rn so i cant test.

these wonderful pages on the wiki might be able to help:
http://www.computerc...wiki/Disk_(API)
http://www.computerc...eripheral_(API)
http://www.computerc...Peripheral_APIs

and here is some code that *MIGHT* work:

ModemID = 'disk_0'
d = peripheral.wrap(ModemID)
d.setLabel('ThisIsALabel')

Edited by doublequestionmark, 06 March 2016 - 05:24 PM.


#5 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 06 March 2016 - 10:34 PM

When using the disk API, you'd simply do:

disk.setLabel("drive_0", "NewLabel")

If you wanted to wrap the drive as a peripheral, you'd do:

local drive = peripheral.wrap("drive_0")
drive.setDiskLabel("NewLabel")

DQM, please don't post code unless you know it works. If you have to wait to test it, then by all means wait - it's better than causing confusion by posting incorrect info.

#6 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 07 March 2016 - 11:47 AM

View Postdoublequestionmark, on 06 March 2016 - 05:23 PM, said:


and here is some code that *MIGHT* work:

View PostBomb Bloke, on 06 March 2016 - 10:34 PM, said:


DQM, please don't post code unless you know it works. If you have to wait to test it, then by all means wait - it's better than causing confusion by posting incorrect info.

There is always the wiki to check that you are using an API correctly

Edited by Lupus590, 07 March 2016 - 11:47 AM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users