ON THIS WIKI
|Source Mod||RedPower 2|
|Affected by Gravity||No|
The Sortron is an advanced computer-controlled version of the Sorting Machine. It can be connected to an adjacent inventory or inline in a tube system, allowing you to select what is pulled from it or what it will allow to pass through it respectively. It is controlled from a Redpower computer and requires blutricity to function.
Unlike the Manager, the Sortron can only filter one item type at a time and cannot accept items from its output side to supply an inventory.
- 1 Recipe
- 2 Forth Words
- 3 Video
A number of Forth words are available to control the Sortron, but to use these you will need to boot your computer using an Extended Forth Disk.
SORTINCOL! / SORTINCOL@
Sets/gets what color items the Sortron will accept from tubes. Setting this to 0 will accept any color.
> 2 SORTINCOL! (Sortron will only accept orange-colored items)
SORTPAT! / SORTPAT@
Sets/gets the item hash that needs to be matched for the item to be accepted from tubes (The hash of an item can be found with the SORTSLOT@ word). Only a single item hash can be accepted at a time, however setting this to 0 0 will allow any item to pass.
> 28677 -24831 SORTPAT! ( Only accept sandstone )
Accept a specific number of items that match the patterns given by SORTPAT@ and SORTINCOL@. The number of items to accept is taken from the stack.
> 2 SORTINCOL! 28677 -24831 SORTPAT! 2 SORTMATCH (Sortron will accept 2 orange-colored sandstone)
SORTCOLOR! / SORTCOLOR@
Sets/gets what color the Sortron will paint items it outputs
> 2 SORTCOLOR! (Sortron will output orange-colored items)
Puts the number of slots in the inventory next to the Sortron onto the stack
> SORTSLOTS CR . 27
Pulls items from an inventory slot into the tube network. The slot number to pull is taken from the top of the stack (Slot numbers start at 0)
> 1 0 SORTPULL (Pulls 1 item from slot 0)
Puts the item hash and item count of an inventory slot onto the stack. The item hash is 2 numbers that uniquely identify the item type (they should not depend on block ids). The slot number to look at is taken from the top of the stack.
> 0 SORTSLOT@ CR . S 15852 -23718 1
Puts the damage value of the item last looked at using SORTSLOT@ on the stack
> 0 SORTSLOT@ SORTDMG@ CR .5
Puts the maximum potential damage value of the item last looked at using SORTSLOT@ on the stack
> 0 SORTSLOT@ SORTDMGMAX@ CR . 250
A low-level function to interrogate the Sortron. It takes a single value from the stack which corresponds to a Sortron instruction. Arguments and outputs need to be written to the memory after address RP0. More information is available at the Redpower wiki
> 4 RBP! 1 SORTCMD RP0 2 + @ CR . (Print the number of inventory slots in the Sortron at bus id 4) 27
A variable containing the bus id of the current Sortron. By default Sortrons have a bus id of 4; if multiple Sortrons are connected to a single CPU you can select between them by changing this variable.
> 4 SORTADDR ! (Set the bus id for sortrons to 4) > SORTADDR @ CR . (Print the current bus id) 4