Sortron | |
---|---|
![]() | |
Name | Sortron |
Type | Block |
Stackable | Yes (64) |
Data Value | 764 |
Source Mod | RedPower 2 |
The Sortron is an advanced, computer-controlled version of the sorting machine. It can be connected adjacent to an 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.
Recipe[]
Forth Words[]
A number of Forth words are available to control the Sortron, to use these you will need to boot your computer using an Extended Forth Disk.
Tube input[]
SORTINCOL! / SORTINCOL@[]
Sets/gets what colour items the Sortron will accept from tubes. Setting this to 0 will accept any colour.
> 2 SORTINCOL! ( Sortron will only accept orange-coloured 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 )
SORTMATCH[]
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-coloured sandstone )
SORTCOLOR! / SORTCOLOR@[]
Sets/gets what colour the Sortron will paint items it outputs
> 2 SORTCOLOR! ( Sortron will output orange-coloured items )
Inventory access[]
SORTSLOTS[]
Puts the number of slots in the inventory next to the Sortron onto the stack
> SORTSLOTS CR . 27
SORTPULL[]
Pulls a single item 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)
> 0 SORTPULL ( Pulls an item from slot 0 )
SORTSLOT@[]
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
SORTDMG@[]
Puts the damage value of the item last looked at using SORTSLOT@ on the stack
> 0 SORTSLOT@ SORTDMG@ CR .
5
SORTDMGMAX@[]
Puts the maximum potential damage value of the item last looked at using SORTSLOT@ on the stack
> 0 SORTSLOT@ SORTDMGMAX@ CR .
250
Low-level functions[]
SORTCMD[]
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
SORTADDR[]
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
|