Vending Machine Spell Circle
Posted: Mon May 08, 2023 1:17 am
A spell circle designed for selling items to other people on servers. Requires Hexal and MoreIotas.
To purchase an item, drop the payment on the impetus, and activate it. If you have provided enough of the correct payment item (determined by comparing the item you dropped to an example item already in the nexus, NBT-sensitive) it will dispense the item(s) it is configured to sell. If you drop more than needed, you get your change back. After dispensing item(s), it checks if it has enough left for another transaction. If it does not, it replaces the lime concrete with red concrete, and any transactions attempted while the red concrete is there will be cancelled.
Consumes between 2 and 5 dust per transaction.
The indicator must be set back to green manually when restocking. The item frame atop the indicator is for keeping track of how many purchases have been made.
The format for the transaction information is a list, {{[Itemtype to be sold],[quantity to be sold]},{[Itemtype for payment],[payment quantity]}}.
This circle is selling 3 akashic records for 2 diamond blocks.
The code on the slates is as follows:
The visible purple block right next to the impetus in the image is the mote nexus, and the akashic record is directly below the bookshelves.
The code of the main program is:
This hex has no built-in support for restocking items or withdrawing profits, you'll need to use something else for that. Perhaps my Pseudo-Corporea hex for withdrawing?
Video demonstration
To purchase an item, drop the payment on the impetus, and activate it. If you have provided enough of the correct payment item (determined by comparing the item you dropped to an example item already in the nexus, NBT-sensitive) it will dispense the item(s) it is configured to sell. If you drop more than needed, you get your change back. After dispensing item(s), it checks if it has enough left for another transaction. If it does not, it replaces the lime concrete with red concrete, and any transactions attempted while the red concrete is there will be cancelled.
Consumes between 2 and 5 dust per transaction.
The indicator must be set back to green manually when restocking. The item frame atop the indicator is for keeping track of how many purchases have been made.
The format for the transaction information is a list, {{[Itemtype to be sold],[quantity to be sold]},{[Itemtype for payment],[payment quantity]}}.
This circle is selling 3 akashic records for 2 diamond blocks.
The code on the slates is as follows:
Code: Select all
Waystone Reflection
Vector Reflection -X (this, as well as all other -X reflections and hardcoded vectors in the main program, should be changed based on the orientation of the circle)
Gemini Decomposition
Additive Distillation
Additive Distillation
Consideration
(pattern key for the bookshelf holding the main program)
Akasha's Distillation
Hermes' Gambit
The code of the main program is:
Code: Select all
Waystone Reflection
//all the -x patterns in here are subject to change based on the orientation of the trade station
Vector Reflection -X
Additive Distillation
Gemini Decomposition
Gemini Decomposition
Vector Reflection -X
Vector Reflection +Y
Numerical Reflection: 3
Multiplicative Distillation
Additive Distillation
Additive Distillation
Sorter's Purification
{
//embedded iota: lime concrete itemtype
}
Flock's Disintegration
Equality Distillation
{
Bind Storage - Temporary
Vector Reflection -X
Additive Distillation
{
//embedded iota: pattern corresponding to the bookshelf with the transaction info
}
Flock's Disintegration
//grab payment
Akasha's Distillation
Gemini Decomposition
Huginn's Gambit
Numerical Reflection: 1
Selection Distillation
Numerical Reflection: 0
Selection Distillation
Stocktake Purification
Numerical Reflection: 0
Selection Distillation
Waystone Reflection
Vector Reflection +Y
Additive Distillation
Entity Purification: Item
Mediafy Item
//part one breakpoint
Undertaker's Gambit
Stacking Distillation II
Prospector's Gambit
Weighing Purification
Muninn's Reflection
Numerical Reflection: 1
Selection Distillation
Numerical Reflection: 1
Selection Distillation
Undertaker's Gambit
Maximus Distillation II
Rotation Gambit
Conjunction Distillation
{
Splitting Gambit
//return change if there is any
Jester's Gambit
Gemini Decomposition
Augur's Purification
{
Bookkeeper's Gambit: v
Waystone Reflection
Vector Reflection +Y
Additive Distillation
Return Item
}
//take the v out of the pattern list
Speaker's Decomposition
Augur's Exaltation
Hermes' Gambit
//merge payment with existing payment in the nexus
Gemini Decomposition
Stocktake Purification
Numerical Reflection: 0
Selection Distillation
Stacking Distillation
Bookkeeper's Gambit: v
//dispense purchased item
Muninn's Reflection
Numerical Reflection: 0
Selection Distillation
Flock's Disintegration
Jester's Gambit
Stocktake Purification
Numerical Reflection: 0
Selection Distillation
Jester's Gambit
Splitting Gambit
Waystone Reflection
Vector Reflection +Y
Additive Distillation
Return Item
//part two breakpoint
//check if item is now out of stock, and if so, turn indicator block red
Gemini Decomposition
Augur's Purification
{
Weighing Purification
Muninn's Reflection
Numerical Reflection: 0
Selection Distillation
Numerical Reflection: 1
Selection Distillation
Maximus Distillation II
}
{
False Reflection
}
Augur's Exaltation
Hermes' Gambit
//do nothing if stock is >= output
Vacant Reflection
//redden
{
Waystone Reflection
//hardcoded vector subject to change, as with the -x reflections
Numerical Reflection: -2
Numerical Reflection: 3
Numerical Reflection: 0
Vector Exaltation
Gemini Decomposition
Gemini Decomposition
//break green block, import to nexus
Break Block
Entity Purification: Item
Mediafy Item
Gemini Decomposition
Stocktake Purification
Numerical Reflection: 0
Selection Distillation
Stacking Distillation
Bookkeeper's Gambit: v
{
//embedded iota: red concrete itemtype
}
Flock's Disintegration
Stocktake Purification
Numerical Reflection: 0
Selection Distillation
Jester's Gambit
Place Block II
}
Augur's Exaltation
Hermes' Gambit
//part 3 breakpoint
//increment trade counter
Waystone Reflection
Numerical Reflection: -2
Numerical Reflection: 4
Numerical Reflection: 0
Vector Exaltation
Additive Distillation
Entity Purification
Gemini Decomposition
Chronicler's Purification
Numerical Reflection: 1
Additive Distillation
Chronicler's Gambit
}
{
{
//embedded iota: string saying "Insufficient or incorrect payment."
}
Flock's Disintegration
Reveal
Bookkeeper's Gambit: vv
Waystone Reflection
Vector Reflection +Y
Additive Distillation
Return Item
}
Augur's Exaltation
Hermes' Gambit
}
{
{
//embedded iota: string saying "Out of stock."
}
Flock's Disintegration
Reveal
}
Augur's Exaltation
Hermes' Gambit
Video demonstration