←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

[turtle command question] How to name the...

harlekintiger's Photo harlekintiger 21 Dec 2012

Hello,
I searched in this forum, in the wiki and in goggle, but I can't find the command how to
give a turtle a name to collect it without loosing the programms ect.
(I know that there is a command, I used it already on another one, but can't remember it...)
A nice thing also would be, I anyone know a site whith all the computercraft commands!
For example I didn't get the "funktion" command on the wiki... and I also didn't find information about
how to copy all from one programm to anther (a normal and a advanced version...)
i would make it with the "if" command, but I didn't get how that works on the wiki, too!
(It is a bad and outdated wiki, isn't it?!)

Hope anyone can help me,
have a good day!
~harlekintiger
Quote

Orwell's Photo Orwell 21 Dec 2012

In the command line on the turtle, just run this command:
label set TurtleName
From Lua you can do:
os.setComputerLabel("LabelName")

By the way, the wiki is getting quite awesome and isn't outdated at all. Some of the things your mentioning there are Lua specific and should be sought for on the Lua wiki and sites.
Quote

Orwell's Photo Orwell 21 Dec 2012

View Postcmurtheepic, on 21 December 2012 - 07:40 PM, said:

NOOBY! question
no offense
but that question was sooo NOOBY!
P.S. just look up for a tutorial on youtube DUH!
How isn't that offensive? There's nothing wrong with asking questions here, that's what the forums are made for. It's funny to hear this from someone with 140 posts whereof about 100 were questions themselves. Also noobish questions in my eyes, but I don't look at it that way because I'm trying to help people and believe that asking questions is the best way to get better at something. I would like to see you help someone else before you make another post that contributes zero to the forums.

(I'm not backseat modding here, I'm just very bothered by respectlessness).

Edit: thanks for bumping this thread yourself, it makes a great example: http://www.computerc...-and-functions/
Quote

harlekintiger's Photo harlekintiger 21 Dec 2012

View PostOrwell, on 21 December 2012 - 12:24 PM, said:

In the command line on the turtle, just run this command:
label set TurtleName
From Lua you can do:
os.setComputerLabel("LabelName")

By the way, the wiki is getting quite awesome and isn't outdated at all. Some of the things your mentioning there are Lua specific and should be sought for on the Lua wiki and sites.

Thanks alot! ;D
I just lost my notepad whith this on... now I have a new one!
(You don't need this that much, so it can happen that you forgett it!...)
I'll look again at the wiki and the lua wiki... maybe I missed something...

View Postcmurtheepic, on 21 December 2012 - 07:40 PM, said:

NOOBY! question
no offense
but that question was sooo NOOBY!
P.S. just look up for a tutorial on youtube DUH!

Wow! Thats just THAT helpful! (little hint: It's NOT!) I watched enough youtube tutorials! I just stoped because
I can't find godd ones... there are so many turtorial-maker which just don't know that command!
Don't come in the "Ask a Pro" topic while you are not a pro or want help from one!
Quote

ChunLing's Photo ChunLing 22 Dec 2012

Sorry about that. It happens. This forum is more for people to get help with actually writing a new program rather than using the default programs.

In that vein, the command to do this in program is os.setComputerLabel(), which is documented in the wiki but a little hard to find and less convenient to use (in most cases) than the label program unless you edit your rom or have an automated turtle factory or something (you know, I should update my Rednet Host Array launcher with a snippet that puts labels on the computers when it places them).
Quote

harlekintiger's Photo harlekintiger 04 Jan 2013

View PostChunLing, on 22 December 2012 - 12:15 AM, said:

Sorry about that. It happens. This forum is more for people to get help with actually writing a new program rather than using the default programs.

In that vein, the command to do this in program is os.setComputerLabel(), which is documented in the wiki but a little hard to find and less convenient to use (in most cases) than the label program unless you edit your rom or have an automated turtle factory or something (you know, I should update my Rednet Host Array launcher with a snippet that puts labels on the computers when it places them).

It's very hard to find on the wiki! Can you please give me a little hint how to find commands like that there?
I just know the very very basic ones...
(For example I have no idea how to make a programm name like "mine X" to make the turtle mine X)
Quote

ChunLing's Photo ChunLing 04 Jan 2013

Oh, I don't even know if that's in the wiki at all. It has more to do with the basic structure of Lua...though the precise method you need to use isn't all that easy to find in the Lua documentation either.

What you do is assign a variable equal to the argument table, with a line like:
local tArg = {...}
When the shell runs a program, it will pass any additional command line parameters into the program using the argument table (represented by {...}), and so once you assign it the command line parameters will be there, accessible by tArg[1] for the first, tArg[2] for the second, and so on.

The command line parameters are always passed as strings, so it is good practice to convert them into the types you need to use them as. In your suggested case, X would presumably be a number so you'd want to use "parameterX = tonumber(tArg[1])".

The CC wiki is best searched by using the API page, in my experience. If you have a general idea of the sort of function you want, there are usually only a couple of apis where it would likely be found. And there are few enough CC specific apis that you should be able to be familiar with what sorts of things are in which api.
Quote

Loki's Photo Loki 04 Jan 2013

Usually if i want to find something on the wiki i just use the search feacture. It works much better than the forums searcher and it tends to come up with alot of results. If it doesnt come up with a result then your searching for something that simply doesnt exist. Also, try to search small things like "computer label" and not "setting turtle name os.computerlabel" Or something silly along those lines. ;).







If I helped, press DAT little green fellah! :o-->
Quote