This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Chlorek's profile picture

[1.4] Add/Remove/Change some functions to more usbale

Started by Chlorek, 11 March 2012 - 09:10 AM
Chlorek #1
Posted 11 March 2012 - 10:10 AM
I have some ideas that should be great to be added in the future. I know if these changes appear, so many programs stop to work and they will need to update. However my ideas:
1. turtle.getPos()
Example:

local x,y,z
x,y,z = turtle.getPos() -- returns turtle position in X, Y, Z
2. Remove some functions and add params
That would be great, intead of:

turtle.select(1)
turtle.drop()
there should be:

-- remove this function turtle.select(1)
turtle.drop(1, 64) -- where 1 is slot and 64 is value how many items you want to drop
Same turtle.dig/up/down. There should be:

turtle.dig("down")
turtle.dig("up")
turtle.dig("front")
3. turtle.detect()
This function should return block ID, it's much more usable and will let to make more advenced programs
4. print()
This functions should not make new lines itself (I know there is another function to print), instead of this to go to the next line should be:

print("First Line!nLine no.2n...no.3")
print(" and again no.3")

Sorry for bad english, I am Polish, but I try to write correctly.
Thank you, Chlorek.
Casper7526 #2
Posted 11 March 2012 - 10:19 AM
I have some ideas that should be great to be added in the future. I know if these changes appear, so many programs stop to work and they will need to update. However my ideas:
1. turtle.getPos()
Example:

local x,y,z
x,y,z = turtle.getPos() -- returns turtle position in X, Y, Z
2. Remove some functions and add params
That would be great, intead of:

turtle.select(1)
turtle.drop()
there should be:

-- remove this function turtle.select(1)
turtle.drop(1, 64) -- where 1 is slot and 64 is value how many items you want to drop
Same turtle.dig/up/down. There should be:

turtle.dig("down")
turtle.dig("up")
turtle.dig("front")
3. turtle.detect()
This function should return block ID, it's much more usable and will let to make more advenced programs
4. print()
This functions should not make new lines itself (I know there is another function to print), instead of this to go to the next line should be:

print("First Line!nLine no.2n...no.3")
print(" and again no.3")

Sorry for bad english, I am Polish, but I try to write correctly.
Thank you, Chlorek.

#1, it won't be like that, but we are hoping for a way to tell their relative position, return coords is kinda "magic"
#2, I agree drop could take a parameter on how many you wanna drop, select is there for another reason so it should stay.
#3, Not everyone's block id's are the same so if you wrote a program it might not be the same for everyone, also it's "magic".
#4, use write()
Liraal #3
Posted 11 March 2012 - 10:22 AM
casper was a bit quicker :mellow:/>/>

BTW, can you make it at least recognize Vanilla blocks?
Casper7526 #4
Posted 11 March 2012 - 10:23 AM
The'll be peripherals for things like this, don't worry :mellow:/>/>
Liraal #5
Posted 11 March 2012 - 10:24 AM
But will there be peripheral docs? :mellow:/>/>
Casper7526 #6
Posted 11 March 2012 - 10:25 AM
Yes, wait for 1.31, if Dan doesn't have them done by then I'll write them my damn self :mellow:/>/>
Sebra #7
Posted 11 March 2012 - 02:39 PM
#3, Not everyone's block id's are the same so if you wrote a program it might not be the same for everyone, also it's "magic".
At least block name is not magic. Even if it can be changed by localization. Allow us to get name at least.
passinglurker #8
Posted 11 March 2012 - 02:48 PM
functions to compare with blocks already in the turtles inventory to get block IDs or names to a limited degree? (basically what we do right now but with out the digging)
Casper7526 #9
Posted 11 March 2012 - 10:33 PM
There is a feature in 1.31 that will allow you to determine what you are digging more realistically.
passinglurker #10
Posted 11 March 2012 - 11:07 PM
so turtles will still visualize their world destructively i take it (unless some one uses a peripheral)
Casper7526 #11
Posted 11 March 2012 - 11:52 PM
You will be able to have a more realistic way to determine if you should dig or not, you also have a realistic way to determine your position in the world :mellow:/>/>
Sebra #12
Posted 12 March 2012 - 02:37 PM
But it seems there is no way to detect liquids. Moving turtle just destroy water/lava source.
Chlorek #13
Posted 12 March 2012 - 03:47 PM
But I really don't know how you can make turtle coords another way than just "normal" coords :mellow:/>/>. However, that would be useful to tell turtle it must go to given coords and e.g. start mining, then come back to you. That's possible with getting its coords.
Liraal #14
Posted 12 March 2012 - 03:59 PM
it's actually possible right now, you just have to give the turtle its starting coords.
passinglurker #15
Posted 12 March 2012 - 04:57 PM
and the have the turtle do the math its not like the turtle can loose track like us