Macro Megathread
- [object Object]
- Posts: 70
- Joined: Fri Dec 02, 2022 12:37 am
Macro Megathread
Post your macros here!
Macros are a post-enlightenment feature added by the addon Hexal. You can use Brigh's Gambit to mark an entry in your Everbook as a macro. When you draw that pattern, it will either be executed (if you're staff-casting normally) or its contents will be inserted into the list of patterns you're creating (if you're within an intro/retro block). This can basically be used to create your own reusable patterns/functions.
Post Template
[size=150]Name[/size]
[b][u]input[/u] → [u]output[/u][/b]
description
[pat= dir=]
[spoiler=Patterns]tags[/spoiler]
[code]hexpattern[/code]
Macros are a post-enlightenment feature added by the addon Hexal. You can use Brigh's Gambit to mark an entry in your Everbook as a macro. When you draw that pattern, it will either be executed (if you're staff-casting normally) or its contents will be inserted into the list of patterns you're creating (if you're within an intro/retro block). This can basically be used to create your own reusable patterns/functions.
Post Template
[size=150]Name[/size]
[b][u]input[/u] → [u]output[/u][/b]
description
[pat= dir=]
[spoiler=Patterns]tags[/spoiler]
[code]hexpattern[/code]
Last edited by [object Object] on Tue Mar 14, 2023 3:49 am, edited 4 times in total.
- [object Object]
- Posts: 70
- Joined: Fri Dec 02, 2022 12:37 am
Flow Control
Conditional Continue
See this post.
Conditional Charon
bool →
As above, but for the break operator. Calls Charon if the input is true.
See this post.
Conditional Charon
bool →
As above, but for the break operator. Calls Charon if the input is true.
Patterns
Code: Select all
#define Conditional Charon (SOUTH_WEST aqdeed) = bool ->
{
{
Charon's Gambit
Bookkeeper's Gambit: -
}
Flock's Disintegration
Augur's Exaltation
Hermes' Gambit
}
- [object Object]
- Posts: 70
- Joined: Fri Dec 02, 2022 12:37 am
Math
Minimization Distillation
num, num → num
Returns the smaller of the inputs.
Maximization Distillation
num, num → num
Returns the larger of the inputs.
Sign Purification
num → 1 or 0 or -1
Returns the sign of the input: 1 if it's positive, 0 if it's 0, or -1 if it's negative.
Vector Sign Purification
vec → vec
Returns a vector where Sign Purification (above) has been called on each component. In other words, given (x, y, x), returns (sign(x), sign(y), sign(z)).
Hadamard's Distillation
vec, vec → vec
Given two vectors, returns the Hadamard product, also known as the element-wise product. In other words, given two vectors (a, b, c) and (x, y, z), returns (ax, by, cz).
num, num → num
Returns the smaller of the inputs.
Patterns
Code: Select all
#define Minimization Distillation (SOUTH_WEST qaa) = num, num -> num
{
Dioscuri Gambit
Minimus Distillation
Rotation Gambit II
Augur's Exaltation
}
num, num → num
Returns the larger of the inputs.
Patterns
Code: Select all
#define Maximization Distillation (SOUTH_EAST edd) = num, num -> num
{
Dioscuri Gambit
Maximus Distillation
Rotation Gambit II
Augur's Exaltation
}
num → 1 or 0 or -1
Returns the sign of the input: 1 if it's positive, 0 if it's 0, or -1 if it's negative.
Patterns
Code: Select all
#define Sign Purification (SOUTH_EAST awdda) = num -> 1 or 0 or -1
{
Gemini Decomposition
Numerical Reflection: 0
Maximus Distillation
Numerical Reflection: 1
Numerical Reflection: 0
Augur's Exaltation
Jester's Gambit
Numerical Reflection: 0
Minimus Distillation
Numerical Reflection: -1
Rotation Gambit
Augur's Exaltation
}
vec → vec
Returns a vector where Sign Purification (above) has been called on each component. In other words, given (x, y, x), returns (sign(x), sign(y), sign(z)).
Patterns
Code: Select all
#define Vector Sign Purification (SOUTH_EAST awddaqqqq) = vec -> vec
// (sign(x), sign(y), sign(z))
{
Vector Disintegration
Sign Purification
Rotation Gambit
Sign Purification
Rotation Gambit
Sign Purification
Rotation Gambit
Vector Exaltation
}
vec, vec → vec
Given two vectors, returns the Hadamard product, also known as the element-wise product. In other words, given two vectors (a, b, c) and (x, y, z), returns (ax, by, cz).
Patterns
Code: Select all
#define Hadamard's Distillation (WEST awaqawa) = vec, vec -> vec
// (AxBx, AyBy, AzBz)
{
Vector Disintegration
Numerical Reflection: 4
Fisherman's Gambit
Vector Disintegration
Numerical Reflection: 50
Swindler's Gambit
Multiplicative Distillation
Rotation Gambit II
Multiplicative Distillation
Numerical Reflection: 22
Swindler's Gambit
Multiplicative Distillation
Rotation Gambit II
Vector Exaltation
}
- [object Object]
- Posts: 70
- Joined: Fri Dec 02, 2022 12:37 am
Save Macro
Save Macro
vector, pattern, list →
A macro that creates a macro! Pass it the same arguments you would to Akasha's Gambit. The library shouldn't already have data stored under the key you want to use. The suggested pattern is just Brigh's Gambit but one unit longer.
vector, pattern, list →
A macro that creates a macro! Pass it the same arguments you would to Akasha's Gambit. The library shouldn't already have data stored under the key you want to use. The suggested pattern is just Brigh's Gambit but one unit longer.
Patterns
Code: Select all
#define Save Macro (SOUTH_WEST ewweeewwedwww) = vector, pattern, list ->
{
Prospector's Gambit
Lethe's Gambit
Rotation Gambit II
Dioscuri Gambit
Numerical Reflection: 5
Fisherman's Gambit
Akasha's Gambit
Undertaker's Gambit
Elysium's Gambit
Brigh's Gambit
}
- kristi fristi
- Posts: 26
- Joined: Mon Dec 12, 2022 7:23 am
distance from line
Distance from line*
vector, vector, vector → number
returns the distance of the third vector form the line between the first and the second
*I'm open to suggestions for a better name
vector, vector, vector → number
returns the distance of the third vector form the line between the first and the second
Patterns
Code: Select all
Dioscuri Gambit
Subtractive Distillation
Jester's Gambit
Numerical Reflection: 3
Fisherman's Gambit II
Subtractive Distillation
Division Distillation
Length Purification
Rotation Gambit II
Subtractive Distillation
Length Purification
Division Distillation
Last edited by kristi fristi on Tue Mar 14, 2023 12:25 pm, edited 1 time in total.
- kristi fristi
- Posts: 26
- Joined: Mon Dec 12, 2022 7:23 am
atan2
Inverse Tangent Distillation
number, number → number
Takes the inverse tangent of a Y and X value, gives the angle between the X-axis and a line from the origin to that point. it's pretty big but just fits with a lens and efficient use of space, and leaves room for scribe's gambit
number, number → number
Takes the inverse tangent of a Y and X value, gives the angle between the X-axis and a line from the origin to that point. it's pretty big but just fits with a lens and efficient use of space, and leaves room for scribe's gambit
Patterns
Code: Select all
Gemini Decomposition
Augur's Purification
True Reflection
Rotation Gambit
Numerical Reflection: 2
Flock's Gambit
False Reflection
Numerical Reflection: 1
Numerical Reflection: 2
Flock's Gambit
Augur's Exaltation
Undertaker's Gambit
Numerical Reflection: 1
Selection Distillation
Gemini Decomposition
Numerical Reflection: 0
Minimus Distillation
Arc's Reflection
Numerical Reflection: 0
Augur's Exaltation
Rotation Gambit II
Division Distillation
Inverse Tangent Purification
Additive Distillation
Gemini Decomposition
Numerical Reflection: 0
Minimus Distillation
Numerical Reflection: -0.5
Numerical Reflection: 0.5
Augur's Exaltation
Arc's Reflection
Multiplicative Distillation
Rotation Gambit
Numerical Reflection: 0
Selection Distillation
Rotation Gambit II
Augur's Exaltation
Gemini Decomposition
Numerical Reflection: 0
Minimus Distillation
Circle's Reflection
Numerical Reflection: 0
Augur's Exaltation
Additive Distillation
Last edited by kristi fristi on Sat Jan 06, 2024 9:55 am, edited 2 times in total.
- kristi fristi
- Posts: 26
- Joined: Mon Dec 12, 2022 7:23 am
Bury
Bury Gambit
many, any, number → any, many
Buries the top iota to the given index in the stack. it's 1-indexed meaning inputing 1 does nothing, 2 is jester's and 3 is rotation II
many, any, number → any, many
Buries the top iota to the given index in the stack. it's 1-indexed meaning inputing 1 does nothing, 2 is jester's and 3 is rotation II
Patterns
Code: Select all
Flock's Gambit
Retrograde Purification
Speaker's Decomposition
Jester's Gambit
Retrograde Purification
Flock's Disintegration
- [object Object]
- Posts: 70
- Joined: Fri Dec 02, 2022 12:37 am
Armor Compensator
Armor Compensator
entity, num → num
Macros: Maximization Distillation
Given an entity and an amount of damage you want to deal, this macro returns the damage that you actually need to do, taking armour into account. For example, if you want an entity to take 20 points of damage wearing full diamond armour, you actually need to deal 35.83 damage (which is what this macro returns).
Note that this ignores enchantments, because Hexal doesn't provide a pattern to get those; if you want to be safe and assume the maximum possible reduction, just multiply the desired damage by 5 to get the required damage (don't use this macro in that case). See this Desmos link (derived from this formula) for the underlying math.
entity, num → num
Macros: Maximization Distillation
Given an entity and an amount of damage you want to deal, this macro returns the damage that you actually need to do, taking armour into account. For example, if you want an entity to take 20 points of damage wearing full diamond armour, you actually need to deal 35.83 damage (which is what this macro returns).
Note that this ignores enchantments, because Hexal doesn't provide a pattern to get those; if you want to be safe and assume the maximum possible reduction, just multiply the desired damage by 5 to get the required damage (don't use this macro in that case). See this Desmos link (derived from this formula) for the underlying math.
Patterns
Code: Select all
#define Armor Compensator (NORTH_WEST wqqqqwwdd) = entity, num -> num
{
// get d and t
Prospector's Gambit
Boxer's Purification
Rotation Gambit
Squire's Purification
// find D_0A
Numerical Reflection: 1
Prospector's Gambit
Numerical Reflection: 125
Division Distillation
Subtractive Distillation
Numerical Reflection: 3
Fisherman's Gambit II
Jester's Gambit
Division Distillation
// find D_0B
Rotation Gambit II
Numerical Reflection: 25
Subtractive Distillation
Jester's Gambit
Numerical Reflection: 8
Additive Distillation
Dioscuri Gambit
Multiplicative Distillation
Rotation Gambit II
Undertaker's Gambit
Numerical Reflection: 0.5
Power Distillation
Rotation Gambit II
Numerical Reflection: 2
Power Distillation
Multiplicative Distillation
Numerical Reflection: 5
Fisherman's Gambit
Numerical Reflection: 400
Multiplicative Distillation
Additive Distillation
Numerical Reflection: 0.5
Power Distillation
Multiplicative Distillation
Additive Distillation
Numerical Reflection: 8
Division Distillation
// return whichever one is correct
Maximization Distillation
}
- kristi fristi
- Posts: 26
- Joined: Mon Dec 12, 2022 7:23 am
counting queue
Incrementer's Queue
number, number, number → list
Takes a lower bound, upper bound,(both inclusive) and step size then creates a list counting from the lower bound to the upper bound(or slightly below depending on step size) in steps defined by the third argument.
Mishaps if the arguments don't make sense e.g. lower bound is higher than upper bound or step size is 0.
It has a limit of somewhat under 200 steps.
It uses the ravenmind, but the ravenmind can be saved with bury gambit like this
Or just swindler's gambit like this
number, number, number → list
Takes a lower bound, upper bound,(both inclusive) and step size then creates a list counting from the lower bound to the upper bound(or slightly below depending on step size) in steps defined by the third argument.
Mishaps if the arguments don't make sense e.g. lower bound is higher than upper bound or step size is 0.
It has a limit of somewhat under 200 steps.
It uses the ravenmind, but the ravenmind can be saved with bury gambit like this
save ravenmind with bury
save ravenmind with swindler's
Patterns
Code: Select all
Rotation Gambit II
Prospector's Gambit
Subtractive Distillation
Numerical Reflection: 2
Fisherman's Gambit II
Division Distillation
Floor Purification
Huginn's Gambit
{
Gemini Decomposition
{
Bookkeeper's Gambit: -
}
Flock's Disintegration
Additive Distillation
}
Numerical Reflection: 2
Numerical Reflection: 4
Fisherman's Gambit
Surgeon's Exaltation
Muninn's Reflection
Gemini Gambit
{
Combination Distillation
}
Flock's Disintegration
Muninn's Reflection
Numerical Reflection: 1
Subtractive Distillation
Gemini Gambit
Muninn's Reflection
Numerical Reflection: 1
Subtractive Distillation
Flock's Gambit
Hermes' Gambit
Hermes' Gambit
Muninn's Reflection
Numerical Reflection: 1
Additive Distillation
Flock's Gambit
Last edited by kristi fristi on Fri Mar 17, 2023 2:55 pm, edited 1 time in total.
-
- Posts: 7
- Joined: Mon Dec 26, 2022 9:49 pm
Repeat N
Repeat N
pattern list, integer
takes a list of patterns and an integer (n) and executes the list of patterns n times. The stack state will not be overwritten/cleared between executions. The Ravenmind will be overwritten, however.
For example,
prints 20 in the chat.
pattern list, integer
takes a list of patterns and an integer (n) and executes the list of patterns n times. The stack state will not be overwritten/cleared between executions. The Ravenmind will be overwritten, however.
For example,
Code: Select all
Numerical Reflection: 0
{
Numerical Reflection: 1
Additive Distillation
}
Numerical Reflection: 20
Repeat N
Reveal
Patterns
Code: Select all
{
{
{
Bookkeeper's Gambit: -
Bookkeeper's Gambit: -
}
Flock's Disintegration
Minimus Distillation
{
{
Bookkeeper's Gambit: -
}
Flock's Disintegration
Hermes' Gambit
Muninn's Reflection
Gemini Decomposition
Numerical Reflection: 1
Selection Distillation
Numerical Reflection: 1
Additive Distillation
Numerical Reflection: 1
Jester's Gambit
Surgeon's Exaltation
Gemini Decomposition
Huginn's Gambit
Hermes' Gambit
}
{
}
Augur's Exaltation
Hermes' Gambit
}
Numerical Reflection: 1
Numerical Reflection: 0
Surgeon's Exaltation
Numerical Reflection: 2
Rotation Gambit
Surgeon's Exaltation
Numerical Reflection: 8
Rotation Gambit
Surgeon's Exaltation
Gemini Decomposition
Huginn's Gambit
Hermes' Gambit
Nullary Reflection
Huginn's Gambit
}
Last edited by Master_Bw3 on Fri Jul 21, 2023 6:07 am, edited 1 time in total.