Simulate key press?

Discussion and feedback on Construct 2

Post » Mon Dec 12, 2011 8:17 pm

Hello everybody! I have a problem the fact that the C2 not conditional "or". That is, I have a global code that checks whether the user pressed ESC and go back to the previous layout. But I need to insert a button that does this for the iPad type devices. If I had as a condicional "or" was simple but as there has ... I was wondering when you touch the button it simulate pressing the ESC and everything resolved, but the C2 has neither the OR nor an object with keyboard actions .... I do not want to repeat all the conditions. How to solve this?
I hope you understood my question
Thanks!
Be nice with others and with yourself!
My musics: https://soundcloud.com/vinians
My C2 Forum:
http://nmbr.forumeiros.com/
My Site:
http://www.dicasebytes.com.br
B
21
S
5
G
6
Posts: 166
Reputation: 4,885

Post » Mon Dec 12, 2011 10:13 pm

Vinians,

For what it's worth, I just posted a conditional OR plugin here: OR Plugin

There is also an example geared towards your issue, although it uses a mouse click instead of the touch mechanism.

I hope this helps.Wastrel2011-12-12 22:13:59
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Mon Dec 12, 2011 10:35 pm

Nice nice! Its a cool plugin but can you make one with more or's ? Or one that we can combine and create more or's expressions. Thanks for reply!
Be nice with others and with yourself!
My musics: https://soundcloud.com/vinians
My C2 Forum:
http://nmbr.forumeiros.com/
My Site:
http://www.dicasebytes.com.br
B
21
S
5
G
6
Posts: 166
Reputation: 4,885

Post » Tue Dec 13, 2011 5:02 am

Also you can have something like

[code]Global Variable goPrev = 0
KeyBoard: On ESC pressed
    -> System: set goPrev to 1
Touch: On Sprite touched
    -> System: set goPrev to 1
System: goPrev equal 1
    -> System: go to previous layout
    -> System: set goPrev to 0[/code]

goPrev would work as the "simulation" trigger you were mentionning
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Tue Dec 13, 2011 2:15 pm

[QUOTE=Vinians] Nice nice! Its a cool plugin but can you make one with more or's ? Or one that we can combine and create more or's expressions. Thanks for reply![/QUOTE]

How many ORs would you need in one condition? There's no good way in the editor to add a random number of statements. I could expand the number of OR expressions to whatever you might need.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608

Post » Tue Dec 13, 2011 4:52 pm

[QUOTE=Wastrel]
How many ORs would you need in one condition? There's no good way in the editor to add a random number of statements. I could expand the number of OR expressions to whatever you might need.[/QUOTE]
Thanks dude! I solved the problem with use of Groups. Thanks a lot.
Obs. Some ppls talk about Triggers, they are talking about Groups? Im using groups a lot to create someting like a function.
Be nice with others and with yourself!
My musics: https://soundcloud.com/vinians
My C2 Forum:
http://nmbr.forumeiros.com/
My Site:
http://www.dicasebytes.com.br
B
21
S
5
G
6
Posts: 166
Reputation: 4,885

Post » Tue Dec 13, 2011 6:35 pm

No problem. I'm not sure how useful this plug-in is anyway. It's kind of difficult to make it more dynamic.

Regarding triggers versus groups, I always thought triggers were events that get triggered by some user action, i.e. a mouse click.

A lot can be done with groups, but if it's functions you're after, have you taken a look at @rexrainbow's function plug-in? It's pretty cool.
Don't see the fnords and they won't eat you!
B
75
S
16
G
12
Posts: 322
Reputation: 11,608


Return to Construct 2 General

Who is online

Users browsing this forum: KaMiZoTo and 9 guests