In extension, how to ask for number input in events?

Somebody should really make a better guide on making extensions. It’s easier than a game, because you know what can be and is commonly done, and you realize that most of that you don’t even need events for. However, the guide doesn’t tell you how to do some basic things. For instance, how to ask the user for number input to adjust a number parameter. I want to create an event where my number variable parameter “defense” can be adjusted either to a fixed amount, or to a variable, like in a lot of other actions that already exist. Can anybody tell me how this is done?

Hi thom

Good question. I open up existing extensions to try to understand them. Here is my explanation, give it a go and someone else might comment if my way is not optimal.

In the behavior, make an Action function for the defense adjustment. Make a new parameter in the function called DefenseChanged or something like that.

Then in the function configuration, make an event that changes the property value of your original Defense parameter. Set it to change to your new DefenseChanged parameter using GetArgumentAsNumber(“DefenseChanged”).

I don’t know why the GetArgumentAsNumber thing isn’t some automatic embedded part of the extension experience. I must have seen it in someone else’s extension to know about it.

Whether suboptimal or not, your way works. Which is awesome. Therefore, thank you very much.

Are you making a function a behavior? You can use parameters and properties within the extension without the get arguments expression just choose them from the drop down autocomplete list. Similar to variables.

If you want to change a parameter with functions then it will create the actions and expressions for you. You can then modify them if needed.

Go to the property screen and click the 3 dots by the parameter.

I’m not sure if you read this.

If you’re not making a behavior then you can create an expression, give it a number parameter and then return the value with one of the actions in the [other] actions functions.

If that’s not your intention. Me might need more info.

1 Like

Thanks for that info. Very helpful. Back when I was battling away trying to figure out what to do, the help wiki on extensions was minimal. Now that I’m writing another extension it’s good to know there’s a substantial reference to learn from.

1 Like

You’re welcome. The Wiki is lacking. The wiki search is also weak and it doesn’t always give results when it should.

I also learned a lot by looking at existing extensions and behaviors. I wish functions were a little more user friendly.

1 Like

It mentions in the wiki that the method I used has been replaced by newer methods although it wasn’t clear to me what they actually were. Hence, the usefulness of Keith_1357’s post.


In previous versions of GDevelop, the expressions GetArgumentAsNumber or GetArgumentAsString were used to access parameter values. Some old extensions may still use them even though they are no longer necessary.

It’s a boxed Note, Functions - create your own actions, conditions or expressions - GDevelop documentation