How do I know if my code is working properly?

Get help using Construct 2

Post » Thu Apr 23, 2015 5:38 pm

Hi everyone. I just wrote a simple line of code, something like:

If you click on the button "Buy" and the object selected ID is 128 then upgrade the object.

For some reason, even with all conditions matched the code doesn't work.

Image

The problem is with the Selection variable, because if I remove it the code works, but I need this variable to work in order to know which upgrade the player wants to buy.

Now, I'm a doing something wrong? is Construct2 Bugging? Any ideas??
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Thu Apr 23, 2015 5:56 pm

Yeah should work... does int(selection) = 128 or round(selection) = 128 work?
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Thu Apr 23, 2015 6:24 pm

No it doesn't. I tried this already D:
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Thu Apr 23, 2015 6:28 pm

Ok I solved it.

It happens that I'm really really stupid. The selection variable was set to "text" instead of "Number" so it should be compared with another god damn text instead of a number.

I set the var type to number and now, of course, it works perfectly.

I'm really sorry to waste your time like that. Sorry

Sorry
B
17
S
7
Posts: 280
Reputation: 2,522


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 53 guests