Jump to content

Recommended Posts

Posted

So... Since I have lot of ressources, I wanted to do some program on my turtles (which have a wireless modem) using a wireless modem on my computer (not an Advanced one.), but I cannot activate my wireless modem... Can you help me, please?

Posted

Take a look here. This api works for both wired and wireless modems. You call peripheral.wrap('side') then open a channel you wish to receive messages on. You don't have to open the channel to send them just to receive them. See if you can figure it out and ask again if you can't.

Posted

Wrapping a modem (or more generally a peripheral) is the term used when you execute something like:


modem = peripheral.wrap("back")



 

which then allows you to do this:

 



modem.open(2)



 

instead of:

 



peripheral.call("back", "open", 2)

So it's a convenience more than anything. The peripheral.wrap function works on any peripheral not just modems.

As to where you would wrap the modem and open the network channel would be early if not first before the rest of your functionality. Typically you'd have some form of configuration and setup to do before the meat of your code comes into play.

Just a question, and I'm making an assumption that you're new to CC programming at least, why did you jump to using modems as a first step? You don't have to wirelessly send it commands. In fact, that's more work to make that function properly. You can place a turtle down and get the same basic console as you would when using a computer. You can place a disk drive next to a turtle just like a computer and be able to access the files on it. In fact, if there is a script named "startup" on a disk the turtle will execute that script on the disk when the turtle boots up. A turtle boots up when first placed or when you press and hold ctrl + R (command + R on a mac I think).

With turtles I recommend that approach because it's so easy to impulsively remove a turtle to move it and after the fact realize that had your code on it. The files are recoverable but not while in game. Someone with access to the server files would have to retrieve it for you. Pain in the ass.

Posted

Just put a label on the turtel and all programs will remain when you breake the turtle. But still backup all programs to a disk since there is a chance that an active turtle will be reseted into an new created normal turtleif the server crash or is rebooting. So that means you have lost all programs in it and the tool if you had on on it.

But what you said about "startup" from a diskdrive sounds intresting. Is it a program I have to program and name it to startup or is it a buildin program in turles?

Posted

Okay... thanks, but where should I put the "wrapping code"? I mean... Do I need to create a new program, or something else? Oh, and...

-I am not on a server.

-I can't use disk because I need some paper, but there's any reeds or sugar canes...

Posted

Maybe put the turtle on hold for awhile and start to get the basic thing working first. Start mining and exploring some so you get some build material first or play on a creative map so you can create the things you need.

Posted

Just put a label on the turtel and all programs will remain when you breake the turtle. But still backup all programs to a disk since there is a chance that an active turtle will be reseted into an new created normal turtleif the server crash or is rebooting. So that means you have lost all programs in it and the tool if you had on on it.

But what you said about "startup" from a diskdrive sounds intresting. Is it a program I have to program and name it to startup or is it a buildin program in turles?

Just like real computers, CC computers (and turtles, which are literally computers with the ability to move and perform certain actions) are able to be booted off a removable media device. In CC's case that mean's disk drives with disks in them. It's already a feature of CC to execute any script (program) named startup in the root directory. If there is a disk drive attached to a computer with a disk inside with a script named startup it will run that instead. It's a file you would create as or rename to startup and not a built in program.

I once used a "swarm" based turtle mining script which utilized a "master" turtle placing blank "slave" turtles next to a previously positioned disk drive. The slave turtles would boot up, run the startup script from the disk and head off on their way to dig the hole I'd requested. It was complicated as hell to get to work but it was pretty cool to have 16 turtles digging a 64x64xbedrock hole when I did have it working. It was far too error prone to use as a primary mining technique though.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...