(Solved) How to create a form function?

how can i create a form function like this:
A
Creating 2 text input fields for user:

  1. Allowed value = number between 25-200
  2. Allowed value = number between 100-200
    B
    calculation by the program:
    A1 ÷ (A2÷100 * A2÷100)
    C
    Result B displayed in a textfield called “result”

How to?
please advise (step by step would be great!).

Yes, GDevelop can do all that.

funny answer. :joy:
HOW to, dear Gruk…

B and C are very straightforward. If you don’t know how to do these, you need to follow some base tutorials about GDevelop.
Regarding A, it depends on how the program should behave exactly. What should happen if the player enters an invalid value such as 2000, 0 or “Hello”.

Either way, give it a good try and come back here with a specific issue when you get stuck.

sorry, this does not help.
i even dont know where/how to start.
so how to set this “…very straightforward…”? (one`s opinion who knows how it works ;-))
and what tutorials?
invalid value: should display “please choose X-Y as value”

and still hoping for essential help…

.

Where to start?
If you like text, start with our wiki, linked at the top of this page.
Getting Started and the Basic Game Making Concepts: GDevelop 5 [GDevelop wiki]
Geometry Monster Tutorial : Geometry Monster [GDevelop wiki]
All others tutorials: GDevelop 5 tutorials [GDevelop wiki]

If you prefer videos, there are plenty of tutorials on Youtube.
Any basic tutorial should teach you C, and any full-game tutorial should teach you B, and probably A as well.

Maybe the reply was not what you expected but Gruk is definitely right to encourage and enable you to find solutions for your problems on your own. As your initial post shows you have identified all the components that you need and now it would be on you to search for the solution for each part.

Anyway, which part is problematic? Do you have the two input fields in your scene already and do you store their input in two variables?

1 Like

thanks drona for your offer to help!
first of all: sorry for the delay (wasnt at home).
to answer your question: i have this

  1. the global variable “size”, set as number, 0
  2. the global variable “weight”, set as number, 0
  3. the textobject “result”, empty
  4. the textinput field “usersize”, number
  5. the textinput field “userweight”, number
  6. event condition “spacebar is pressed”

example:
user will type in 4) usersize = 170
user will type in 5) userweight = 80
after these two inputs user has to press the spacebar.

after the event “spacebar is pressed”, in the resultfield(3) should appear a number, calculated as :
userweight : (usersize/100 x usersize/100)
in this example the calculation should be:
80 : (170/100 x 170/100) = 27,7 (the result)

maybe simple (for cracks), but i am totally lost ;-(
thanks in advance for advice!

Okay, first of all you need to store the values of your input fields in your variables. Here is an example how to do that for the usersize:

You need to do the same for the userweight.

Then you can check if both variables have values that fall in the range that you mentioned in your initial post, for example:

In the action column for these conditions you can assign your variable ‘result’ to your formula in which you can also include the two variables that you got before.

1 Like

drona!
thanks to your help - i have the formula!!!

ToString(GlobalVariable(weight)/((GlobalVariable(size)/100*GlobalVariable(size)/100)))

soooo proud ;-))
cant believe it .

BUT, of course, now i have another problem:
the result in my example ist displayed as
27,681660899653977

how to set this to 27,7 ??

1 Like

found the solution!!!
ToString(round(GlobalVariable(weight)/((GlobalVariable(size)/100*GlobalVariable(size)/100))*10)/10)

wow to myself :joy:

2 Likes