Unknown operator error when creating mod with complex equation

Hi, I’m trying to create a mod that would complicates some of the in-game mechanisms. I used an equation that has two power operators ("^"), then I got an error that says “unknown operator in equation”.
unknownoperator

When I delete one of power operators, the error is gone. I would like to ask that, is there something wrong with my equation, or the game cannot process multiple power operators within one equation?

Thank you for helping.

1 Like

https://www.positech.co.uk/democracy4/modding.html

(…)
Looking at the policies file, you will see a whole bunch of columns in there that load in various bits of data, but towards the end of the list of columns you will see the ‘effects’ for that policy. For clarity, the effects are denoted as any column to the right of the ‘#effects’ column, and there can be as many there as you like. Some policies have a few effects, some have many, but each effect entry takes up one ‘cell’ and has the same format which is…

[target],[value1][operator1]([value2][operator2][values3])[operator3][value4],[inertia]

Now this may be confusing because [operator3][value4] is entirely OPTIONAL, and not often included.
(…)

This quoted part from the link will be helpful.

In short, an equation can have up to 4 values & 3 operators.

1 Like

Hi, thank you for your reply. However, I have another equation which uses 5 operators works just fine, so I think number of operators may not be the problem.

1 Like

Peculiar… Could you add that equation to this thread?

Also, you should be able to check the curve of it by right-clicking the corresponding effect, like the pic below.

image

1 Like

My apologizes, I double checked the equation I mentioned above and it actually has 4 operators. Yet still one more than the modding guide. the equation is 0.2-(0.7071*x-0.56568)^2, and game processes it correctly, please see the attached screenshot.
20211202183644

2 Likes

By the way, I may have just found another bug.
I added one more operator to the equation, turned the equation into 0.2-(0.7071*x-0.56568)^2+0.2, but seems like the game processed the last operator as minus instead of plus, because the curve displayed in the game moved down
20211202184412

1 Like

I think @cliffski should know better regarding this matter. He might have told modders not to use 4th operator to avoid occasional errors under specific conditions which are hard to explain.

It would be glad if he could give us more detailed info on this (and possibly other issues like this: Questions Regarding Overrides & Their Modding)

1 Like

This seems to be related with this: Latest developer video blog:44 Tougher Crime - #6 by Asla

tldr; operator3 comes before operator1 even if op1 is * or / and op3 is + or -.
[target],[value1][operator1]([value2][operator2][values3])[operator3][value4],[inertia]

2 Likes

and I just tried to change the last plus to minus (0.2-(0.7071*x-0.56568)^2-0.2), now the game processes -0.2 as +0.2, totally reversed…

1 Like