24 posts
Posted 24 February 2014 - 02:38 PM
hey, i am trying to write my first program. and its for the startup of my turtels, it is supposed to say 'hello my name is (get id) and my fuel level is (get fuel level) but i don't know how to make a turtle get its own id, since i set id's on all my turtles, and give them names like Barry, Bernard. dig_bik and such. i was just going to re do the code each time i get the startup pastebin, but thought i should dive deeper than that. here is the code as of current, and what i am aiming for
currently:
http://pastebin.com/MZ5r2S0Dwhat my aim is:
http://pastebin.com/501YkzpUthanks in advance.
8543 posts
Posted 24 February 2014 - 02:50 PM
os.getComputerLabel() will return the label of the computer if one is set.
882 posts
Location
Behind you.
Posted 24 February 2014 - 03:43 PM
os.getComputerLabel() will return the label of the computer if one is set.
I believe he asked for ID, but it's basically the same code c:
os.getComputerID() returns the computer's ID
571 posts
Location
Some Fish Bowl in Ohio.
Posted 24 February 2014 - 03:51 PM
So to sum it up;
local Id = os.getComputerID()
print(Id)
134 posts
Posted 24 February 2014 - 04:13 PM
print("Hello my name is wilson, i got ", turtle.getFuelLevel() , " Fuel currently. and my ID is: ", os.getComputerID())
That should do i think :D/>
8543 posts
Posted 24 February 2014 - 05:08 PM
os.getComputerLabel() will return the label of the computer if one is set.
I believe he asked for ID, but it's basically the same code c:
os.getComputerID() returns the computer's ID
If you read the post more carefully, he uses the word ID, but talks about labels he has set on them.
24 posts
Posted 26 February 2014 - 05:49 PM
os.getComputerLabel() will return the label of the computer if one is set.
I believe he asked for ID, but it's basically the same code c:
os.getComputerID() returns the computer's ID
If you read the post more carefully, he uses the word ID, but talks about labels he has set on them.
was that not correct? im sorry, i didnt realise they were diffrent things, i want to do label set wilson, and in the startup code, it prints its label, instead of me entering it manually every time.
24 posts
Posted 26 February 2014 - 06:22 PM
right! i got it, thank you very much people :)/> a great help. heres the final product!
http://pastebin.com/GG3UcLax