Mathematical Expressions
Complete guide to the mathematical expression evaluator in zAPI. Learn how to use mathematical operations, functions, and expressions with placeholders in your configurations.
Table of Contents
Overview
Basic Usage
Direct Evaluation
In Configuration Files
Supported Operations
Basic Arithmetic
Operator
Description
Example
Result
Operator Precedence
Negative Numbers
Decimal Numbers
Functions
sqrt() - Square Root
round() - Round to Nearest Integer
roundDown() - Floor Function
Nested Functions
Using with Placeholders
Placeholder Replacement Order
In Item Configurations
In Display Conditions
In Slot Calculations
Integration with Items and Inventories
Automatic Processing in ItemBuilder
Automatic Processing in InventoryBuilder
Manual Evaluation
Advanced Examples
Example 1: Experience-Based Leveling
Example 2: Dynamic Pricing
Example 3: Grid Position Calculator
Example 4: Skill Point Requirements
Example 5: Compound Interest Calculator
Error Handling
Try-Catch Block
Common Errors
Division by Zero
Invalid Syntax
Invalid Function Names
Safe Evaluation
Result Formatting
Whole Numbers
Decimals
Performance Considerations
Best Practices
Troubleshooting
Expression Not Evaluating
Wrong Result
Placeholder Not Replaced
Decimal Precision Issues
See Also
Last updated
Was this helpful?
