Difference between revisions of "Turtle.getSelectedSlot"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page)
 
(Removing the old "see also".)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{NeedsWork|This page should be made ASAP. - [[User:Oeed|Oeed]] 01:11, 29 March 2014 (GMT)}}
 
 
 
{{lowercase}}
 
{{lowercase}}
 +
{{Function
 +
|name=turtle.getSelectedSlot
 +
|api=turtle
 +
|returns={{Type|number}} selected slot
 +
|addon=ComputerCraft
 +
|desc=Added by version 1.6 of ComputerCraft, this command returns the currently selected inventory slot. In builds prior this value must be tracked manually by the scripter.
 +
|examples=
 +
{{Example
 +
|desc=Checks to see if the current inventory slot contains items.
 +
|code= if turtle.getItemCount( turtle.getSelectedSlot() ) > 0 then
 +
print("I have items in my selected slot.")
 +
else
 +
print("I'm out of items in my selected slot.")
 +
end
 +
|output=Whether or not the currently selected slot contains items.
 +
}}
 +
}}
 +
 +
==See also==
 +
*[[turtle.select]]
 +
 +
[[Category:API_Functions]]

Latest revision as of 23:21, 26 April 2015


Grid Redstone.png  Function turtle.getSelectedSlot
Added by version 1.6 of ComputerCraft, this command returns the currently selected inventory slot. In builds prior this value must be tracked manually by the scripter.
Syntax turtle.getSelectedSlot()
Returns number selected slot
Part of ComputerCraft
API turtle

Examples

Grid paper.png  Example
Checks to see if the current inventory slot contains items.
Code
if turtle.getItemCount( turtle.getSelectedSlot() ) > 0 then
	print("I have items in my selected slot.")
else
	print("I'm out of items in my selected slot.")
end
Output Whether or not the currently selected slot contains items.


See also