"If" doubt

Get help using Construct 2

Post » Fri Jun 28, 2013 5:43 pm

Hello, i just read a tutorial that made me have a doubt in C2 about "if" basic functions with events and subevents.

So, all the conditions are triggered by "unseen" if's like this:

------------------------
Condition Var1 = 1
              actions [Var1 = 0]
------------------------

This can be interpretated with if's. Like this (NOTE inside () are the unseen if's to interpretate this better)

-----------------------
(if)
Condition Var1 = 1
(then)
              actions [Var1 = 0]
------------------------

But what about sub-events? It happens like some kind of second "then" right? Below the example of what i mean.


-----------------------
(if)
Condition Var1 = 1
(then)
              actions [Var1 = 0]
(then) *SUB-EVENT STARTT*
(if)
Var1 = 0
(then)
              actions [Var1 = 1]
------------------------


Am i correct or not? Thanks
B
7
S
1
Posts: 21
Reputation: 647

Post » Fri Jun 28, 2013 6:02 pm

Yes, your understanding is correct.
ImageImageImage
B
71
S
21
G
204
Posts: 3,586
Reputation: 115,576

Post » Fri Jun 28, 2013 7:21 pm

There is no such thing as a secondary 'then'. An event is an 'if' statement. So a sub-event is an 'if' statement within an 'if' statement. Like this:
[code]
if (Condition1)
{
// actions
Action1();
Action2();

// sub-events
if (Condition2)
{
    Action3();
    Action4();
}
if (Condition3)
{
    Action5();
}

}
[/code]
Condition 2 and 3 represent sub-events of the event defined by Condition 1. They occur inside the scope of Condition 1 so they have access to everything defined within Condition 1.Dalal2013-06-28 19:25:15
Image
B
10
S
3
G
2
Posts: 196
Reputation: 2,053

Post » Fri Jun 28, 2013 8:09 pm

Thank you very much.
B
7
S
1
Posts: 21
Reputation: 647


Return to How do I....?

Who is online

Users browsing this forum: CJacobsSA, R0J0hound and 6 guests