How do expressions work? ( Easy explonation )

Get help using Construct 2

Post » Wed Oct 07, 2015 6:39 am

I know that it exist manual entries about expressions but i haven't been able to understand them well enough to get the hang of expressions. I have made successfull expressions but some doesn't work. I made one today that doesn't work. Expressions seem to always need " " in them. Is that rigth? Do they need ( ) too? How do you write a expressions in easy to understand words. Do you write it "( Sprite )" or "Sprite"()? I may go deeper into what my expression that doesn't work is but i just explain that if i need to.
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Wed Oct 07, 2015 7:17 am

https://www.scirra.com/manual/78/expressions

They basically express certain things in a quantitative form.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Wed Oct 07, 2015 7:22 am

It depends on what you want to do.
Anything inside " " is just text.
Ex: "Sprite"
That is is just an expression for text with a value of Sprite.

Parenthesis () have two purposes. The first is just like in math to control what operations are done first.
Ex: 1+2*3 = 7
Ex: (1+2)*3 = 9

The second purpose is for expressions that take parameters.
Ex: sin(45)
Ex: min(1, 3, 2)

Beyond that it should be pretty simple. But feel free to post the equation you made that doesn't work and describe what you want it to do.
B
94
S
33
G
114
Posts: 5,357
Reputation: 73,775


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests