Multiple Keystroke Events

Just started using Construct 2? Post your questions here

Post » Sat Aug 09, 2014 1:39 pm

How am i able to set multiple different actions upon using one single keystroke?

Image

In this case above for example using "i", only the first event will work.
Using 2 events upon the same keystroke always interferes which each other.

Could someone please explain me what's wrong?
Is there any workaround for this?

I've also tried to call a function in stead, but i always came up with the same issues as long as i was using the same keystroke.


Thanks in advance,
Everade
B
39
S
8
G
3
Posts: 158
Reputation: 3,000

Post » Sat Aug 09, 2014 10:14 pm

put a wait 0
above the inventory toggle visiblities.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sat Aug 09, 2014 10:42 pm

You don't need "Trigger once" on events like "On key pressed" because they will only trigger only once by design.

I'm not sure what you want to do here. and what's the point of event nr 157?

Pressing I will always toggle visible boolean so this event 157 is not needed. If I understood correctly You want to only toggle visibility of inventory, right?
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,597
Reputation: 34,821

Post » Sat Aug 09, 2014 10:53 pm

oh yeah, what @shinkan said
(I was using set visible and set invisible to test, which only worked with the wait 0)

all you need is the one event: press i, toggle visible.
(is toggle visible beta version? or am I missing something?)
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sat Aug 09, 2014 10:56 pm

@spacedoubt

"visible" is just an Inventory object boolean variable.
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,597
Reputation: 34,821

Post » Sat Aug 09, 2014 10:59 pm

Thought that might be the case.. looking at his events a bit harder, I see how obvious that is now..
Thanks for pointing that out!
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sat Aug 09, 2014 11:06 pm

Sure thing. Eventually you will fall into the habit of seeing things you never seen before ;)
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,597
Reputation: 34,821

Post » Sun Aug 10, 2014 12:13 am

shinkan wrote:You don't need "Trigger once" on events like "On key pressed" because they will only trigger only once by design.

I'm not sure what you want to do here. and what's the point of event nr 157?

Pressing I will always toggle visible boolean so this event 157 is not needed. If I understood correctly You want to only toggle visibility of inventory, right?

Both events are required.
I'm well aware that i could "toggle" visible and invisible with just one event.

This is for my inventory, which uses Drag & Drop to equip and move your items within the inventory.
So i have to ensure that with "dragging = 0"
So it only closes if nothing is being moved, right?

However while the inventory is already invisible, items are also not being dragged!
So i have to create 2 events for this to make it possible.

I was thinking a long time for other solutions, but this is the only one that made real sense to me to get it done.

And yes you're right about the "trigger ones", i guess it's a left over from all my testings, because initialy i've not added those. I've removed it now thanks :)

spacedoubt wrote:put a wait 0
above the inventory toggle visiblities.

Omg you're awesome!
This actually worked!

But could you explain me why the hell a "wait 0 seconds" is required?!
It doesn't make any sense to me at all...
I just want to understand.
B
39
S
8
G
3
Posts: 158
Reputation: 3,000

Post » Sun Aug 10, 2014 12:27 am

quick question, if the inventory is closed, won't dragging also = 0?
so can't that just be in the same 1 event?

the wait 0 has something to do with commands just happening too fast or something...

@shinkan can probably explain it better than me.. I stole it from something he said on another post anyway, haha.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Sun Aug 10, 2014 12:37 am

spacedoubt wrote:quick question, if the inventory is closed, won't dragging also = 0?
so can't that just be in the same 1 event?

the wait 0 has something to do with commands just happening too fast or something...

@shinkan can probably explain it better than me.. I stole it from something he said on another post anyway, haha.


yes, that's correct.
and i've actually tested that multiple times, but for some reason the inventory won't even open up anymore when i've tried that within 1 event.

I don't know but... in a lot instances it feels like Construct 2 has a lot of bugs.
I don't really like to implement such "workarounds" just to make it work.

My game is becoming pretty big, and i'm worried about performance issues if i have to implement such messy events.
B
39
S
8
G
3
Posts: 158
Reputation: 3,000

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest