Jump to content




Tip: How to create an already running Computer/Turtle

help

10 replies to this topic

#1 exosceleton

  • Members
  • 52 posts
  • LocationUmm... Mars.

Posted 12 August 2016 - 09:10 AM

This is a question I've been asked by many of my friends who have just began to use Command Computers, so I decided to post this tip here to help share the knowledge. ^_^

When setting a block using the setblock command, you can specify what nbt data the block will get. All Computer types that come in block form (Computers,Advanced Computers,Turtles,Advanced Turtles,Command Computers) have a tag called on. this tag can be set to 1b or 0b. (defaults to 0b.) Setting this tag to 1b manually will have the Computer already active without the need to right-click it.
Another useful tag is id which specifies what computer ID that Computer will have.
So, using the id tag we can create a Computer with the ID of a Computer that has premade files, and by setting on to 1b we can make it run it's startup file automatically.

Edited by exoskeleton, 12 August 2016 - 09:37 AM.


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 12 August 2016 - 02:17 PM

Moved to Tutorials.

#3 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 12 August 2016 - 02:27 PM

Can you fill a turtles inventory?

#4 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 12 August 2016 - 06:35 PM

View PostLupus590, on 12 August 2016 - 02:27 PM, said:

Can you fill a turtles inventory?

Yes: items are stored in the "Items" tag so you can do something like: {Items:[{id:1,Slot:0,Count:1,Damage:0}]} to put a piece of stone in the 1st slot. In 1.8 you can use replaceitem: /replaceitem block <x> <y> <z> slot.container.0 1 1 (slot 0 with item 1 of stack size 1).

#5 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 12 August 2016 - 07:59 PM

Note on inventory: My CC Jam 2016 project successfully copied a turtle plus inventory. You can view it on github.

#6 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 12 August 2016 - 11:22 PM

So I could teleport turtles with this?

#7 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 13 August 2016 - 12:47 AM

View PostLupus590, on 12 August 2016 - 11:22 PM, said:

So I could teleport turtles with this?

Yep. Just make sure to copy the nbt data with commands.blockdata - that includes the id, tools, and inventory.

#8 moomoomoo3O9

  • Members
  • 82 posts
  • LocationPork roll land

Posted 13 August 2016 - 02:02 AM

View PostKingofGamesYami, on 12 August 2016 - 07:59 PM, said:

Note on inventory: My CC Jam 2016 project successfully copied a turtle plus inventory. You can view it on github.
Yep. WorldEdit can as well with deepcopy and paste.

Only thing about reading NBT's that you have to wait for the command to yield, so it's 1 block/tick at most afaik (unless you can make coroutines which'll each get one block and do it that way?)

Edited by moomoomoo3O9, 13 August 2016 - 02:03 AM.


#9 Bomb Bloke

    Hobbyist Coder

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

Posted 13 August 2016 - 11:34 AM

You can also generate brand new systems if you play around with peripheral calls and disk drives. Spawn a new system next to your command computer, boot it and get its ID, shift it near a disk drive (or perhaps INTO a disk drive) so it can be configured, then finally shift it to where ever you actually want it to end up...

View Postmoomoomoo3O9, on 13 August 2016 - 02:02 AM, said:

(unless you can make coroutines which'll each get one block and do it that way?)

You probably can; I never rigged my world scanner to use command.getBlockInfos(), but use of coroutines still allowd it to read over a hundred blocks per server tick. So presumably it'd operate at about half speed if it started using blockdata in addition to getBlockInfo (well, probably something like 90% speed, bearing in mind that it could be rigged to skip NBT reading on most blocks which are known not to be tile entities, such as air / dirt / stone...).

Note that yielding does not, in itself, take "a server tick" - it's pretty much instant, and you can effectively resume as soon as the event you're after appears in the queue. In this particular case ("commands API functions") it takes longer than a tick for each event to show up (which can fortunately be dealt with by requesting tons of the things concurrently), but the time varies depending on the event you're talking about (most are also pretty much instant - it's usually only those related to third-party peripherals that have any notable delay).

#10 TheRockettek

  • Members
  • 547 posts
  • LocationRem is best girl

Posted 13 August 2016 - 09:23 PM

View PostBomb Bloke, on 13 August 2016 - 11:34 AM, said:

I never rigged my world scanner to use command.getBlockInfos(),

Its a shame getBlockInfos limit is a 16 cube tho...

#11 moomoomoo3O9

  • Members
  • 82 posts
  • LocationPork roll land

Posted 24 October 2016 - 04:05 PM

View PostTheRockettek, on 13 August 2016 - 09:23 PM, said:

View PostBomb Bloke, on 13 August 2016 - 11:34 AM, said:

I never rigged my world scanner to use command.getBlockInfos(),

Its a shame getBlockInfos limit is a 16 cube tho...
It's a big pain to work with, but I worked around it in WorldEdit.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users