My idea (Omg , so creative) is to make a … is it function? that returns the selected slot as a number- possible?
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
getSelected function?
Started by Apfeldstrudel, 04 June 2013 - 08:53 AMPosted 04 June 2013 - 10:53 AM
Hi! I was messing around with the turtle API and found that there is no way of seing what slot you have selected.
My idea (Omg , so creative) is to make a … is it function? that returns the selected slot as a number- possible?
My idea (Omg , so creative) is to make a … is it function? that returns the selected slot as a number- possible?
Posted 04 June 2013 - 10:59 AM
This is a fairly common suggestion, and has been denied repeatedly. I'll leave this open, but don't be surprised if it gets denied again.
Posted 04 June 2013 - 11:09 AM
Okay, but.. WHY?
Posted 04 June 2013 - 11:42 AM
local selected = 1
local native_select = turtle.select
function turtle.select(slot)
if type(slot) ~= "number" then
error("Not a number", 2)
elseif slot > 16 or slot < 1 then
error("Number ot of range", 2)
end
selected = slot
native_select(slot)
end
Should work :)/>/>
Posted 04 June 2013 - 06:53 PM
Actually, I would very much like this functionality to be implemented. It would be nice if I could specify which items are in which slots, and then when I compare, I can get that item slot, and switch to it. This could help manage sorting systems for ComputerCraft.
Posted 04 June 2013 - 07:05 PM
It does seem like something that should be implemented as the workaround of keeping track of the slot number is limited to programs, and even when a startup file is created or overwritten in turtles, the functionality isn't hardcoded, therefore third-party programs can't rely on users having this implementation.
I'll rate this a 3.5/5, as it's not completely needed, but would be pretty convenient.
I'll rate this a 3.5/5, as it's not completely needed, but would be pretty convenient.
Posted 05 June 2013 - 08:01 AM
Selection tracking is among the many, many features of turtlex… Along with position and inventory tracking, inventory labeling, and enhanced versions of most turtle API functions… Just throwing that out there… :shifty:
Posted 06 June 2013 - 04:22 AM
Nice idea but it can be done very easly, so…
Posted 26 June 2013 - 06:30 PM
Eh… Its too easy to make yourself with a custom function… I would never use it…
Posted 26 June 2013 - 07:06 PM
Well if you got two programs running at the same time it would be harder(not inpossible) to keep track of which slot is selected with a custom function if both of the programs are changing the selected slot. So this would be usefull
Posted 26 June 2013 - 07:51 PM
Not really. You just set up the custom function in your startup script and be done with it.
Locked.
Locked.