My Prompt Calculator

by nm9311

Keep your factory ratios perfect without leaving the game. Open your console, type any formula—from basic percentages to complex math functions—and get instant results under your chat.

Content
11 days ago
2.1
16
Owner:
nm9311
Source:
N/A
Homepage:
https://mods.factorio.com/mod/mypromp...
License:
MIT
Created:
14 days ago
Latest Version:
1.0.3 (11 days ago)
Factorio version:
2.1
Downloaded by:
16 users

This mod turns your in-game chat console into a powerful, instant scientific calculator. Simply press ` (tilde) or Enter to open the chat console, type your mathematical expression, and press Enter to see the result.


🔄 NEW: Space Age Quality & Recycling Loop Analytics

Stop guessing your raw material requirements when hunting for Legendary tier items! The calculator now fully evaluates closed-circuit recycling loops.

When a factory setup recycles crafting failures, the recovered materials feedback chain scales geometrically based on your assembling machine's productivity. Your calculator solves this instantly using a native geometric series model.

  • How to use: Simply type loop(your_productivity_modifier) directly into game chat or write /calc loop(your_productivity_modifier).

  • Inputs supported: Both whole percentages or raw fractions are recognized. For example, loop(40) and loop(0.40) yield the exact same accurate output.

  • Diagnostic Output Display:

Recycling Loop Analytics [Productivity: +40%]:
* Yield Multiplier: 1.538x total crafts per initial raw batch.
* Resource Cost Reduction: Total raw item costs reduced by 35.0%.

1. Basic Operators & Syntax

These standard arithmetic operators follow standard algebraic order of operations (PEMDAS / BODMAS).

  • Addition (+)
  • Example: 15 + 5
  • Output: 15 + 5 = 20
  • Subtraction / Negation (-)
  • Example: 20 - 5 or -5
  • Output: 20 - 5 = 15
  • Multiplication (*)
  • Example: 4 * 5
  • Output: 4 * 5 = 20
  • Division (/)
  • Example: 20 / 4
  • Output: 20 / 4 = 5
  • Modulo / Remainder (%)
  • Example: 10 % 3
  • Output: 10 % 3 = 1
  • Exponentiation / Power (^)
  • Example: 2 ^ 3
  • Output: 2 ^ 3 = 8
  • Parentheses / Grouping (())
  • Example: (2 + 3) * 4
  • Output: (2 + 3) * 4 = 20

2. Smart Percentage Logic

The mod mimics a standard pocket calculator when evaluating percentages, dynamically adapting based on the preceding operator.

  • Contextual Add / Subtract: Automatically applies the percentage to the base number.
  • Input: 100 - 10% ⇒ Evaluates as: 100 - (100 * 0.10)Result: 90
  • Input: 50 + 20% ⇒ Evaluates as: 50 + (50 * 0.20)Result: 60
  • Standalone / Multiplier: Automatically converts the percentage into a raw fraction.
  • Input: 200 * 10% ⇒ Evaluates as: 200 * 0.10Result: 20

3. Supported Mathematical Functions

You can invoke any native Lua mathematical function directly by formatting it as function_name(expression). They can be freely combined with normal operators.

Core Arithmetic & Advanced Properties

  • abs(x) — Absolute value (converts negatives to positives). Example: abs(-25) = 25
  • sqrt(x) — Square root. Example: sqrt(144) = 12
  • floor(x) — Rounds down to the nearest whole integer. Example: floor(5.99) = 5
  • ceil(x) — Rounds up to the nearest whole integer. Example: ceil(5.01) = 6
  • modf(x) — Breaks a number into its integer and fractional components. Example: `modf(7.25) = 7 and 0.25

Exponential & Logarithmic

  • log(x) — Calculates the natural logarithm (base e).
  • log10(x) — Calculates the base-10 logarithm.
  • exp(x) — Calculates $e^x$ (exponential function).

Trigonometry (Angles utilize Radians)

  • sin(x) — Sine of an angle.
  • cos(x) — Cosine of an angle.
  • tan(x) — Tangent of an angle.
  • asin(x) — Arcsine (inverse sine), returns radians.
  • acos(x) — Arccosine (inverse cosine), returns radians.
  • atan(x) — Arctangent (inverse tangent), returns radians.
  • rad(x) — Utility to convert degrees into radians. Example: sin(rad(90)) = 1
  • deg(x) — Utility to convert radians into degrees.

4. Base Conversions

Quickly convert integers between binary, hexadecimal, and decimal formats using explicit wrapping functions:

  • bin(x) — Converts an input number to its binary (0b...) string format.
  • Example: bin(10)Result: 0b1010
  • hex(x) — Converts an input number to its hexadecimal (0x...) format.
  • Example: hex(255)Result: 0xff
  • dec(x) — Parses a binary or hex prefix string back into a base-10 layout.
  • Example: dec(0xff)Result: 255

 

❤️ If My Prompt Calculator helps with your calculations and you want to support my work, consider buying me a coffee!