Tabletop Simulator – Lua Script (2023)

Introduction

Developed by the ingenious mind behind Dimension Beyond, this script introduces groundbreaking features to objects tagged with the mystical “Thoughtform.”

Delving into the Enchantment

Automatic Scaling – Unveiling Visibility

One of the script’s enchanting features is automatic scaling. When objects adorned with the “Thoughtform” tag grace your tabletop, they undergo a transformation, scaling up for enhanced visibility. The magic behind this lies in the following snippet:

-- Inside onObjectEnterZone(zone, obj)
if obj.tag == "Deck" or obj.tag == "Card" or obj.tag == "Token" and hasTag(zone.getTags(), "Table") then
    originalScales[obj] = obj.getScale()
    local scale = { x = scalingFactor, y = 1, z = scalingFactor }
    obj.setScale(scale)
end

Here, as an object enters a specific zone, its original scale is stored, and a new scale is applied based on the defined scalingFactor.

Health Points Management – The Pulse of the Game

Thoughtform Summoner simplifies health points management with intuitive buttons. The following snippets handle the logic behind adjusting and displaying health points:

-- Inside onPlusButtonClick(obj)
local currentHP = obj.getVar("currentHP") or 0
obj.setVar("currentHP", currentHP + 1)
onUpdateCounterDisplay(obj)
-- Inside onMinusButtonClick(obj)
local currentHP = obj.getVar("currentHP") or 0
obj.setVar("currentHP", currentHP - 1)
onUpdateCounterDisplay(obj)
-- Inside onUpdateCounterDisplay(obj)
local currentHP = obj.getVar("currentHP")
if currentHP then
    local buttonIndex = 2
    local button = obj.getButtons()[buttonIndex]

    if button then
        button.label = "HP: " .. currentHP
        obj.editButton({
            index = buttonIndex,
            label = button.label,
        })
    end
end

These snippets showcase the logic for increasing, decreasing, and updating the health points display.

Stall and Equip Controls – Ready or Not

Thoughtform Summoner introduces buttons for toggling between “Ready” and “Stall” states and managing equipment. The snippet below handles the toggle logic:

-- Inside onChangeStall(obj)
local stall = obj.getVar("stall") or false

if stall then
    obj.editButton({
        index = 3,
        label = "S T A L L",
        color = {252/255, 215/255, 3/255},
    })
    obj.setVar("stall", false)
else
    obj.editButton({
        index = 3,
        label = "R E A D Y",
        color = {90/255, 252/255, 3/255},
    })
    obj.setVar("stall", true)
end

This snippet showcases the toggle logic between “Stall” and “Ready” states.

Duplicate Placement – Crafting Clones

The script introduces a fascinating feature where picking up objects creates duplicates arranged in a grid. Dropping the object gracefully disposes of these duplicates. The magic happens in the following snippet:

-- Inside onObjectPickUp(player_color, picked_up_object)
-- ... (previous code)
for i = 1, numRows do
    for j = 1, numCols do
        if cellSelection[i][j] then
            local offsetX = (j - math.ceil(numCols / 2)) * spacing * 0.78
            local offsetZ = (i - math.ceil(numRows / 2)) * spacing * 1.15

            local duplicate, offset = createDuplicate(picked_up_object, pos.x + offsetX, pos.y + yOffset, pos.z + offsetZ, spacing)
            table.insert(duplicatesTable, { duplicate = duplicate, offset = offset, originalObject = picked_up_object })
        end
    end
end

This snippet captures the creation of duplicates, each intelligently positioned in a grid around the original object.

createDuplicate(originalObject, x, y, z, scaleFactor)

This function is the architect behind the creation of duplicates. Let’s break down its key components:

  • originalObject: The object from which duplicates will be created.
  • x, y, z: The specified position for the new duplicate.
  • scaleFactor: The factor by which the duplicate is scaled in comparison to the original.

Inside this function, a clone of the original object is created with the specified position and scaling. The clone is named appropriately and marked as a duplicate.

function createDuplicate(originalObject, x, y, z, scaleFactor)
    local rangeind = getObjectFromGUID("193593")
    local duplicate = rangeind.clone({ position = { x, y, z} })
    duplicate.setName(rangeind.getName() .. "_duplicate")
    duplicate.setLock(true)
    duplicate.setVar("isDuplicate", true)

    local originalPos = originalObject.getPosition()

    local offset = {
        x = (x - originalPos.x) * scaleFactor,
        y = (y - originalPos.y) * scaleFactor,
        z = (z - originalPos.z) * scaleFactor
    }

    return duplicate, offset
end

Here, the clone is intelligently named, locked to prevent unintended interactions, and marked as a duplicate. The offset is calculated based on the original and duplicate positions, facilitating precise positioning.

Unveiling the Source

For a deeper understanding and to harness the full power of Thoughtform Summoner, explore the complete Lua script on the GitHub repository. Feel free to contribute, provide feedback, or weave your own magic into the script.

Enhance your Tabletop Simulator adventures with the enchanting Thoughtform Summoner Lua script!


Feel free to adapt and customize the content further based on your preferences and specific details you want to highlight.

Gematria Calculator (2022)

This is a python program that runs in the console. It loops through a dictionary, and adds the item values of each key in the dictionary. Gematria is a cryptic system that gives numerical values to each letter. Adding each of these numerical values for each word will give you its gematriac value.

AI describes English gematria as..

In English gematria, a letter or symbol of the alphabet is assigned a numeric value, allowing words and phrases to be converted into numbers. Each letter of the English alphabet has a corresponding integer, with A=1, B=2, and so on, but other systems within English gematria associate other values with the letter. The sum of the individual digits in a word or phrase can provide insight into deeper or hidden meanings of the message. This practice of assigning numerical values to letters can be traced back to ancient civilizations including the Greeks, Romans, and Hebrew.

Card Flip Edit (2019)

This code represents my creation of an interactive card-flipping UI that can be seamlessly integrated into various projects, such as card games or dynamic content displays. Feel free to replace the placeholder text (“front” and “back”) with your desired content to personalize the experience.

Features:

  1. Card Flipping: I’ve implemented a captivating card-flipping effect using a checkbox input (#flip). When checked, the .back of the card is revealed, and when unchecked, the .front is displayed.
  2. 3D Perspective: I’ve utilized the CSS perspective property in the .cardholder div to create an immersive 3D effect during the card flip.
  3. CSS Transitions: I’ve added a smooth transition to the .card class, ensuring the card-flipping animation is visually appealing.
  4. Checkbox Hack: I’ve cleverly used the #flip:checked selector along with the adjacent sibling combinator (+) to dynamically style the .front and .back elements based on the checkbox state.
  5. Hidden Faces: To maintain a polished appearance during flipping, I’ve employed the backface-visibility: hidden; property, ensuring the back faces of the card remain hidden during animation.
  6. Checkbox Styling: I’ve hidden the actual checkbox (display: none;), and its state is effectively controlled by the label element.

Moving Square (2022)

This code is a JavaScript implementation for a canvas-based web application, primarily focusing on physics and user interaction. It creates a responsive canvas element where a rectangle can be controlled using keyboard inputs, simulating gravity and jump dynamics.
Key Features:

  • Gravity Simulation: Variables control gravity strength and jump force.
  • Linear Interpolation (lerp) Function: Smooths the movement transitions.
  • Dynamic Canvas Resizing: Adjusts to window size changes.
  • Rectangle Movement: Controlled by arrow keys and spacebar for jumping.
  • Event Listeners: Handles key presses for interactive movement.
  • Class-Based Rectangle Management: Simplifies creation and updating of canvas elements.

This script effectively merges basic physics principles with interactive elements for web-based games or animations.

Animated Navigation Menu (2019)

The “Navigation-Menu” project, originally created for an old website, is now shared for wider use. Its key features include:

  • Clean, responsive design.Compatibility with various screen sizes.Easy web project integration.Customizable layout.Comprehensive installation and usage instructions.Open for contributions and improvements.
This project serves as a handy resource for developers aiming to incorporate or enhance navigation menus in web applications. For more details, see the GitHub page.

You can also view the project here.

Opening Gate GLSL Shader (2023)

This code is a GLSL fragment shader, typically used in graphical applications for creating dynamic visual effects. The shader manipulates pixel colors to generate a unique visual pattern on the screen. Here’s an overview of its functionality:
Key Functions and Operations:

  • 2D Rotation Function (rotate2D):
  • Takes a 2D point p and a float tf to perform a rotation transformation.
  • Utilizes sine (sin) and cosine (cos) functions to create a rotation matrix, allowing the point p to be rotated by tf radians.
  • Main Image Processing (mainImage):
  • The main function that defines the pixel color output (fragColor) for each pixel coordinate (fragCoord).
  • Calculates standardized texture coordinates (st) from the fragment coordinates and aspect ratio of the resolution (iResolution).
  • Waveform and Color Manipulation:
  • Samples a texture (iChannel0) to create a wave effect (wave and waver variables).
  • Defines color vectors (color, rColor) using the wave value, which are then used in the final color calculation.
  • Dynamic Color Composition:
  • Utilizes trigonometric functions (sin and cos) and mathematical operations to dynamically modify the variables a, b, and d.
  • Applies the rotate2D function to p and st coordinates, adding a time-dependent rotational effect.
  • Loop for Visual Complexity:
  • A loop iteratively adjusts the b variable and recalculates waver based on texture sampling.
  • Incorporates a conditional statement to modify the a variable based on time (iTime), adding complexity to the visual output.
  • Final Color Output:
  • The final pixel color (fragColor) is a complex calculation involving the modified variables d, b, a, color, wave, and waver.
  • Uses the fract function to create a fractal-like visual effect.

This shader is likely used for creating intricate and evolving visual patterns, suitable for applications like music visualizations, artistic displays, or advanced graphical interfaces. The combination of texture sampling, rotational transformations, and complex mathematical operations results in a visually engaging output.

Thread of Light GLSL Shader (2023)

This code is a fragment shader written in GLSL (OpenGL Shading Language), typically used for creating visual effects in computer graphics. It’s designed to generate a dynamic, visually engaging pattern based on mathematical functions and shader programming techniques. Here’s a description:

Description:
The shader, defined by the mainImage function, manipulates pixel colors on the screen based on various input parameters. It uses a combination of textures, time-based transformations, and trigonometric functions to create a complex and evolving visual effect.

Key Features and Formulas:

  • 2D Rotation Transformation:
  • The rotate2D function rotates a 2D point p by an angle tf. It uses sine and cosine functions for rotation matrix construction, providing a time-varying rotation effect due to the use of iTime.
  • Texture Sampling and Waveform Manipulation:
  • The shader samples from a texture channel (iChannel0) at specific coordinates to create frequency and waveform effects (fft and wave).
  • Color Generation:
  • Colors are dynamically generated using texture values. Different color vectors (rColor, gColor, bColor, yColor) are calculated using these values, creating a blend of colors that change over time.
  • Looped Calculations for Visual Complexity:
  • A loop iterates multiple times, altering variables a, b, c, d, e, f, g, h based on sine functions and distance calculations, adding complexity and depth to the visual output.
  • Final Color Composition:
  • The final pixel color (destColor) is a composite of the individual color vectors, modulated by the loop-calculated values. This results in a rich, multi-layered visual effect.

This shader is ideal for applications in real-time graphics rendering, such as visualizations, interactive art, or complex animation effects. The use of sinewave transformations, texture sampling, and looped color manipulations makes it a versatile tool for creating visually captivating graphic displays.

CodeREV Kids Timetracker (2023)

This spreadsheet was made for a company that had an outdated way of tracking time. This company did not provide its employees with a Payroll software, and only provided a Word document for employees to fill out, and track time. I saw the problem this may cause and developed a new time tracker for the company.

Here’s the before:

What I Developed:

The time tracker spreadsheet is designed to calculate hours worked and corresponding pay, making it an invaluable tool for both employees and freelancers. It likely includes features for recording daily work hours, calculating total hours for a given period, and multiplying these by a specified pay rate to determine earnings.

Features:

  • Time logging for each workday.
  • Calculation of total hours worked.
  • Adjustable pay rate for accurate income calculations.
  • Option to account for pay discrepancies.

Formulas used:

  • SUM: Totals hours worked.
  • Multiplication (Hours * Pay Rate): Calculates total pay.
  • IF Statements: Handles adjustments or conditional scenarios.
  • Date and Time Functions: Tracks work hours based on dates.
  • SUMPRODUCT: Used for more complex calculations, such as totaling hours worked across multiple criteria or rates.
  • COUNTIFS: Counts the number of entries meeting specific criteria, useful for tracking the number of workdays or specific types of shifts.


These formulas combined make the spreadsheet an effective tool for detailed time and income tracking, suitable for various work scenarios.

Weekly/Monthly Budget Spreadsheet v4 (2023)

This personal budgeting spreadsheet is an ideal tool for the average individual looking to manage their finances more effectively. It allows users to track expenses and income by date and categorize transactions, enhancing financial awareness and control. Key features include intuitive visualizations like pie charts and bar graphs, which simplify the analysis of spending patterns. The inclusion of visual elements like pie charts and bar graphs offers an intuitive understanding of spending patterns and income distribution. Essential formulas integrated into the spreadsheet…

  • SUM: Calculates the total of income and expenses.
  • AVERAGE: Determines the average amount spent or earned.
  • IF Statements: Used for categorizing transactions based on conditions.
  • VLOOKUP/HLOOKUP: For finding and referencing specific data.
  • WEEKDAY: This formula returns the day of the week corresponding to a date, useful for organizing and analyzing financial data by specific days.

These formulas collectively enhance the functionality of the budgeting spreadsheet, making it an efficient tool for detailed financial tracking and analysis.