Macro Megathread

Post your coolest Hexcasting creations here.

New topics are NOT for chatting or asking help, put those in the comments of a post or in a different forum.
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Macro Megathread

Post by [object Object] »

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]
Last edited by [object Object] on Tue Mar 14, 2023 3:49 am, edited 4 times in total.
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Flow Control

Post by [object Object] »

Conditional Continue
See this post.

Conditional Charon
bool
As above, but for the break operator. Calls Charon if the input is true.
aqdeed
Patterns
qqqqqqCharon's GambitBookkeeper's Gambit: Keep 1eeeFlock's DisintegrationAugur's ExaltationHermes' Gambiteee

Code: Select all

#define Conditional Charon (SOUTH_WEST aqdeed) = bool ->
{
    {
        Charon's Gambit
        Bookkeeper's Gambit: -
    }
    Flock's Disintegration
    Augur's Exaltation
    Hermes' Gambit
}
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Math

Post by [object Object] »

Minimization Distillation
num, numnum
Returns the smaller of the inputs.
qaa
Patterns
qqqDioscuri GambitMinimus DistillationRotation Gambit IIAugur's Exaltationeee

Code: Select all

#define Minimization Distillation (SOUTH_WEST qaa) = num, num -> num
{
    Dioscuri Gambit
    Minimus Distillation
    Rotation Gambit II
    Augur's Exaltation
}
Maximization Distillation
num, numnum
Returns the larger of the inputs.
edd
Patterns
qqqDioscuri GambitMaximus DistillationRotation Gambit IIAugur's Exaltationeee

Code: Select all

#define Maximization Distillation (SOUTH_EAST edd) = num, num -> num
{
    Dioscuri Gambit
    Maximus Distillation
    Rotation Gambit II
    Augur's Exaltation
}
Sign Purification
num1 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.
awdda
Patterns
qqqGemini DecompositionNumerical Reflection: 0Maximus DistillationNumerical Reflection: 1Numerical Reflection: 0Augur's ExaltationJester's GambitNumerical Reflection: 0Minimus DistillationNumerical Reflection: -1Rotation GambitAugur's Exaltationeee

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
}
Vector Sign Purification
vecvec
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)).
awddaqqqq
Patterns
qqqVector DisintegrationawddaRotation GambitawddaRotation GambitawddaRotation GambitVector Exaltationeee

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
}
Hadamard's Distillation
vec, vecvec
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).
awaqawa
Patterns
qqqVector DisintegrationNumerical Reflection: 4Fisherman's GambitVector DisintegrationNumerical Reflection: 50Swindler's GambitMultiplicative Dstl.Rotation Gambit IIMultiplicative Dstl.Numerical Reflection: 22Swindler's GambitMultiplicative Dstl.Rotation Gambit IIVector Exaltationeee

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
}
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Save Macro

Post by [object Object] »

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.
ewweeewwedwww
Patterns
qqqProspector's GambitqwqqqwqawwRotation Gambit IIDioscuri GambitNumerical Reflection: 5Fisherman's GambitAkasha's GambitUndertaker's Gambitqwqqqwqaeaqaaweweeewedwweee

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
}
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

distance from line

Post by kristi fristi »

Distance from line*
vector, vector, vectornumber
returns the distance of the third vector form the line between the first and the second
aaqwqaqw
Patterns
qqqDioscuri GambitSubtractive DistillationJester's GambitNumerical Reflection: 3Fisherman's Gambit IISubtractive DistillationDivision Dstl.Length PurificationRotation Gambit IISubtractive DistillationLength PurificationDivision Dstl.eee

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
*I'm open to suggestions for a better name
Last edited by kristi fristi on Tue Mar 14, 2023 12:25 pm, edited 1 time in total.
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

atan2

Post by kristi fristi »

Inverse Tangent Distillation
number, numbernumber
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
deadeeeeewd
Patterns
qqqaadaaawaqaeaaeaaNumerical Reflection: 2ewdqdwededqNumerical Reflection: 1Numerical Reflection: 2ewdqdweawddddqaaNumerical Reflection: 1deeedaadaaNumerical Reflection: 0qqdwdqNumerical Reflection: 0awddddqddwdedweadeeeeewwaawaadaaNumerical Reflection: 0qNumerical Reflection: -0.5Numerical Reflection: 0.5awddqdwdqwaqawaaeaaNumerical Reflection: 0deeedddqddawddeee
awdd

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.
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

Bury

Post by kristi fristi »

Bury Gambit
many, any, numberany, 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
ddqddaa
Patterns
qqqFlock's GambitRetrograde PurificationSpeaker's DecompositionJester's GambitRetrograde PurificationFlock's Disintegrationeee

Code: Select all

Flock's Gambit
Retrograde Purification
Speaker's Decomposition
Jester's Gambit
Retrograde Purification
Flock's Disintegration
User avatar
[object Object]
Posts: 70
Joined: Fri Dec 02, 2022 12:37 am

Armor Compensator

Post by [object Object] »

Armor Compensator
entity, numnum
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.
wqqqqwwdd
Patterns
qqqProspector's GambitaeqqqqeaRotation GambitwqqqqwNumerical Reflection: 1Prospector's GambitNumerical Reflection: 125Division Dstl.Subtractive DistillationNumerical Reflection: 3Fisherman's Gambit IIJester's GambitDivision Dstl.Rotation Gambit IINumerical Reflection: 25Subtractive DistillationJester's GambitNumerical Reflection: 8Additive DistillationDioscuri GambitMultiplicative Dstl.Rotation Gambit IIUndertaker's GambitNumerical Reflection: 0.5Power DistillationRotation Gambit IINumerical Reflection: 2Power DistillationMultiplicative Dstl.Numerical Reflection: 5Fisherman's GambitNumerical Reflection: 400Multiplicative Dstl.Additive DistillationNumerical Reflection: 0.5Power DistillationMultiplicative Dstl.Additive DistillationNumerical Reflection: 8Division Dstl.eddeee

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
}
User avatar
kristi fristi
Posts: 26
Joined: Mon Dec 12, 2022 7:23 am

counting queue

Post by kristi fristi »

Incrementer's Queue
number, number, numberlist
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
Muninn's ReflectionNumerical Reflection: 4ddqddaawaawaqJester's GambitHuginn's Gambit
Or just swindler's gambit like this
save ravenmind with swindler's
Muninn's ReflectionNumerical Reflection: 18Swindler's GambitwaawaqJester's GambitHuginn's Gambit
waawaq
Patterns
qqqRotation Gambit IIProspector's GambitSubtractive DistillationNumerical Reflection: 2Fisherman's Gambit IIDivision Dstl.Floor PurificationHuginn's GambitqqqGemini DecompositionqqqBookkeeper's Gambit: Keep 1eeeFlock's DisintegrationAdditive DistillationeeeNumerical Reflection: 2Numerical Reflection: 4Fisherman's GambitSurgeon's ExaltationMuninn's ReflectionGemini GambitqqqCombination DistillationeeeFlock's DisintegrationMuninn's ReflectionNumerical Reflection: 1Subtractive DistillationGemini GambitMuninn's ReflectionNumerical Reflection: 1Subtractive DistillationFlock's GambitHermes' GambitHermes' GambitMuninn's ReflectionNumerical Reflection: 1Additive DistillationFlock's Gambiteee

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.
Master_Bw3
Posts: 7
Joined: Mon Dec 26, 2022 9:49 pm

Repeat N

Post by Master_Bw3 »

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,

Code: Select all

Numerical Reflection: 0
{
	Numerical Reflection: 1
	Additive Distillation
}
Numerical Reflection: 20
Repeat N
Reveal
prints 20 in the chat.

dad
Patterns
qqqqqqqqqBookkeeper's Gambit: Keep 1Bookkeeper's Gambit: Keep 1eeeqwaeawqqqqqqqqBookkeeper's Gambit: Keep 1eeeqwaeawqdeaqqqeewdweddwaadaaNumerical Reflection: 1deeedNumerical Reflection: 1waawNumerical Reflection: 1aawddwqaeaqwaadaaeqqwawqaawdeaqqeeeqqqeeeawdddeaqqeeeNumerical Reflection: 1Numerical Reflection: 0wqaeaqwNumerical Reflection: 2aaeaawqaeaqwNumerical Reflection: 8aaeaawqaeaqwaadaaeqqwawqaawdeaqqdeqqwawqaaweee

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.