Can I add number compare conditions to extensions?

Hi,

when I’m editing a custom behavior, I would like to be able to add conditions like:

if property > Number

Where you have a drop down menu of the different compare symbols (> < = …).

I did not find that option when creating a condition inside the editor.
When I choose the parameter “Number”, it only checks if the number is the entered number.
But you cannot choose comparison operators.

Is there no way to do this?

You cannot have an operator in extension conditions (at least currently). You can wrap the value of property in an expression and let the user compare it using the Compare two numbers condition.

1 Like

That makes sense, thank you for the tip!

If you use a parameter of “string from a list of options” you can include the symbols or a description as options. You can have one parameter for the number and another for the type of comparison.
11111

1 Like

Yes, thank you , I tried that, but it’s really clumsy.
The field is really huge and it does not look good.
I don’t remember if there was another reason but I decided not to do it.

But thanks for the input!

1 Like

I’m used to VB.net where you’d have string functions like mid, left and instr. I don’t know enough about JavaScript to create a comparable text manipulation.

1 Like

I believe it’s more than just writing it in JavaScript.

You’d have to pay attention to the pixi.js structure, how gdevelop treats it, and then how the electron editor environment interacts with it.

So I think it could be tricky even if you know JavaScript.

1 Like