More than one event to one action

Get help using Construct 2

Post » Fri Mar 30, 2012 4:05 pm

I know this has to be possible, but I've been looking for it but obviously my search parameters are not the correct one.

I'm debugging my thing, and I'm trying to use a text list or a button style menu.

But in order to test them nicely, I have to remake events, so is it possible to add two events that do the same actions?

[On Touched] [Text]           -Actions
(or) [On Touched] [ButtonX]

I can do this, duplicating the same actions for separate events, but I'd keep my code tidy if I could merge events like that.
B
25
S
8
G
7
Posts: 184
Reputation: 6,040

Post » Fri Mar 30, 2012 5:16 pm

It's possible with a group. You can create a disabled group "myGroup" and put the actions there + as last action: disable group "myGroup" - all actions in a blank event in the group.
At both touch events create the action set group "myGroup" enabled
The groups actions are system actions.. ;)Joe72012-03-30 17:30:54
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Fri Mar 30, 2012 6:24 pm

"or" is on Scirra's todo list.
For now, I don't see anything wrong with copying and pasting events.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Mar 30, 2012 7:01 pm

just use a function

if event1: call function 1:

if event 2:   call function 1:

function 1: do thing   ( needs function plugin)
B
9
S
4
G
3
Posts: 223
Reputation: 3,433

Post » Fri Mar 30, 2012 7:09 pm

if you have tones of action that are triggered by different events you can also use a local variable to fake a "or"

[code]+[empty]
local nubmer or = 0
+ConditionA
    -> System: set or to 1
+ConditionB
    -> System: set or to 1
+Systeme: or = 1
    -> Execute
    -> My
    -> Tones
    -> Of
    -> Action[/code]Against a simple OR use it's just one more action per condition
[code]+ConditionA
+OR
+ConditionB
-> Execute
-> My
-> Tones
-> Of
-> Action[/code]So it's not so bad

Of course if it's just one or two action it might be an overkill solutionYann2012-03-30 19:11:42
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Fri Mar 30, 2012 11:38 pm

Thanks, guys. I'll test all these shortly. ;)
B
25
S
8
G
7
Posts: 184
Reputation: 6,040


Return to How do I....?

Who is online

Users browsing this forum: Ahr Ech, Baidu [Spider], benajad, Braus, R0J0hound, shinkan and 19 guests