Page 1 of 1
Allow more functions to be used in blueprint parameterization
Posted: Sat Nov 30, 2024 4:23 pm
by Iterniam
From what I could find, we can currently use the following functions in the formulas/math expressions field of a value parameter:
- a * b
- a / b
- a + b
- a - b
- a ^ b
- min(a, b)
- max(a, b)
- abs(a)
I would like to compute the automated insertion limit as a parameter, the formula for which can be found here
viewtopic.php?p=309796#p309796
This requires* ceil() as part of the calculation.
More generally, it would also be nice to have the following formulas available:
- ceil(a, b)
- floor(a, b)
- clamp(a, b, c)
- mod(a, b) or a % b
- div(a, b) or a // b (integer division, python style - is the counterpart to mod)
- and(a, b)
- or(a, b)
- xor(a, b)
- a << b
- a >> b
- a == b (these comparisons return 1 or 0)
- a != b
- a < b
- a <= b
- a > b
- a >= b
I don't expect all of these to be implemented, but parity with arithmetic combinators would make a lot of sense. Ceil/Floor would also make great additions.
*ceil can be implemented in terms of modulo, so parity with arithmetic combinators would suffice, although it's not elegant
Re: Allow more functions to be used in blueprint parameterization
Posted: Mon Apr 14, 2025 5:13 pm
by wspikes
Adding to this request in hopes of getting "clamp" available. If I recall correctly, "clamp" is already implemented in the scope of a noise expression, but it's not in the base
MathExpression.
I was experimenting with a parameterized BP for a bot-based mall assembler, and I hoped to do something like:
Code: Select all
inner_bit => some formula using e.g. p0_i1 and p0_t, for example
clamp(inner_bit, 1, 25)
Note: I split it into two lines and omitted the math for readability purposes. In the actual parameter, they'd be one line.
The goals are that I never want a request=0 bug, and I never want to request more than a hard-coded upper bound at a time (even if that slows it down).
I can and did solve that using min+max, but it's not nearly as clear, especially when inner_bit is expanded:
Re: Allow more functions to be used in blueprint parameterization
Posted: Fri Jun 06, 2025 11:18 pm
by Pluranium_Alloy
+1
Floor/Ceil or even just Mod are severely needed in MathExpression for complicated blueprint parameterisation.
Re: Allow more functions to be used in blueprint parameterization
Posted: Sat Jun 07, 2025 11:37 pm
by danbopes
I'd also love the ability to get the stack size of an item that's used as an ingredient. Currently we can get the "count" of ingredient 1, but no way to get the stack size of that item.
Re: Allow more functions to be used in blueprint parameterization
Posted: Mon Jun 16, 2025 6:47 pm
by Pluranium_Alloy
danbopes wrote: Sat Jun 07, 2025 11:37 pm
I'd also love the ability to get the stack size of an item that's used as an ingredient. Currently we can get the "count" of ingredient 1, but no way to get the stack size of that item.
If parameter 1 is set to ingredient 1, then p1_s would give you it's stack size.
Re: Allow more functions to be used in blueprint parameterization
Posted: Tue Jun 17, 2025 6:45 pm
by danbopes
Pluranium_Alloy wrote: Mon Jun 16, 2025 6:47 pm
danbopes wrote: Sat Jun 07, 2025 11:37 pm
I'd also love the ability to get the stack size of an item that's used as an ingredient. Currently we can get the "count" of ingredient 1, but no way to get the stack size of that item.
If parameter 1 is set to ingredient 1, then p1_s would give you it's stack size.

- 06-17-2025, 14-44-57.png (186.14 KiB) Viewed 523 times
So apparently this works, although the UI is broken.
Re: Allow more functions to be used in blueprint parameterization
Posted: Wed Jun 18, 2025 3:38 pm
by sparr
How about allowing any lua expression that uses any pure (no side effects) function from the existing library?
Re: Allow more functions to be used in blueprint parameterization
Posted: Mon Jul 07, 2025 2:31 am
by Managor
danbopes wrote: Tue Jun 17, 2025 6:45 pm
Pluranium_Alloy wrote: Mon Jun 16, 2025 6:47 pm
danbopes wrote: Sat Jun 07, 2025 11:37 pm
I'd also love the ability to get the stack size of an item that's used as an ingredient. Currently we can get the "count" of ingredient 1, but no way to get the stack size of that item.
If parameter 1 is set to ingredient 1, then p1_s would give you it's stack size.
06-17-2025, 14-44-57.png
So apparently this works, although the UI is broken.
Thanks. I was hitting my head against the wall why the game was telling me that I made a mistake in the syntax.