Sub Event Issue [FIXED]

Just started using Construct 2? Post your questions here

Post » Thu Jun 11, 2015 12:42 am

Image

Is there any particular reason that the sub events are not firing here?

I've ensured that the variables are tested and are fine but the sub events will just not fire.
Last edited by Kettlewell on Thu Jun 11, 2015 10:50 am, edited 1 time in total.
B
4
Posts: 19
Reputation: 240

Post » Thu Jun 11, 2015 12:53 am

At a guess, LastData is a string, so convert it to an int.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Thu Jun 11, 2015 12:58 am

Get rid of the else's.
They don't really serve a purpose here anyway.
Else means if none of the other conditions are correct, and probably won't work properly using multiples of it.
Image ImageImage
B
169
S
50
G
174
Posts: 8,325
Reputation: 110,794

Post » Thu Jun 11, 2015 1:07 am

I was using else statements so that other parts of the code didn't run. If it works like a typical if statement I didn't want it to keep comparing the variables but I removed them anyway.

I converted the value to an int but unfortunately it still won't run. IsMember returns 1 on a successful login and the debug shows it logs in but the sub events just do not seem to want to fire.
B
4
Posts: 19
Reputation: 240

Post » Thu Jun 11, 2015 5:14 am

These elseif's are useless, but not a problem. They are only usefull if same values compared in more than one if or with a complete else on end.
If lastData is correct, there must be something wrong with int - string use, is the global int and you int(AJAX.LastData) or int(isMember) on compare?
You also can change the second compare value to string...
Sorry for my bad english, but I really do my best! And use and check with Google Translator.
B
10
S
4
G
1
Posts: 158
Reputation: 1,303

Post » Thu Jun 11, 2015 8:08 am

Set up a debug text object, put the value of isMember in when it fires and see what is actually coming over.

Could it be something else ? TextStrings don't appear if they don't fit in their bounding box, so it may actually be firing even if it looks as if its not firing.

Incidentally, can you do console.log in C2 ?
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Thu Jun 11, 2015 10:49 am

I took away the change to an int and replaced the condition checks with strings and it now operates.

Thank you for the help.
B
4
Posts: 19
Reputation: 240


Return to Beginner's Questions

Who is online

Users browsing this forum: brunopalermo, Obi554 and 2 guests