Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.
How do I…
Hi, hopefully this is a quick simple one. Thought I was getting used to variables, but I’m doing something wrong! I am wanting to create an action whereby a light’s range is based upon a global variable. ie.
Light range = Global variable x 10
I’m thinking the global variable might need to be multiplied as my global variable will only reach a maximum of 10. Ive tried to script, but keep getting the dreaded red text!
Expressions in GDevelop are case sensitive. Meaning for example, “Example(”“)” could work as an expression, but “example(”“)” wouldnt. The correct spelling of “Tostring” would be “ToString”. You must capitalize the S.
However, something else i notice is youre using the expression “GlobalVariable”. I don’t think this is required anymore in GDevelop, you can just type the variable name itself, GC.
Also why are you trying to multiply a string? Or even convert to a string? the radius is a number, not a string.
Thank you. That was stupidly simple! I added string because it kept saying it was expecting a string not a number although my variable is set as number. I think I was just confusing it! Thanks for your help.
In respect of strings, should I remove the text from the actions below as well?..
My reason for asking is that these actions currently works as they should!
nah thats good, color is a string that technically expects numbers.
Colors are formatted like this in gdevelop: “255;255;255”. Thats numbers, however, the semicolon makes it so it must be a string. You are doing the right thing converting it. Just not everything requires that