How do I stop events with mouse click conditions

Just started using Construct 2? Post your questions here

Post » Fri Sep 25, 2015 8:10 pm

So I have an event with the following conditions:

Mouse click on Object
Variable A = 0

Among the actions it does is modifying the variable so that clicking on the object a second time no longer triggers the event.
However, that doesn't work and repeated clicks on the object keep triggering the event, which baffles me. For the sake of testing I've putting the variable's initial number at something other than 0 and the event doesn't trigger anymore, which makes it even weirder in a way. I'm frantically looking for a workaround, but even if I , this is really driving me crazy as the same structure seems to work perfectly fine for me in other situations.
B
4
Posts: 5
Reputation: 210

Post » Fri Sep 25, 2015 8:37 pm

We'd have to see the code to help properly.
ImageImageImage
B
71
S
21
G
221
Posts: 3,649
Reputation: 124,227

Post » Fri Sep 25, 2015 9:06 pm

The create object is there just for test purposes.

Edit: It seems i can't post a link, but it goes like this:

Conditions

Mouse - On left button clicked on Object A
Object B - Variable = 0
Object C - Variable = 0
Object D - Variable = 0
Object F - Variable = 0

Actions
Object B - Add 1 to Object B Variable
Create Object B
B
4
Posts: 5
Reputation: 210

Post » Fri Sep 25, 2015 9:20 pm

VitaumKeijo wrote:So I have an event with the following conditions:

Mouse click on Object
Variable A = 0

Among the actions it does is modifying the variable so that clicking on the object a second time no longer triggers the event.
However, that doesn't work and repeated clicks on the object keep triggering the event, which baffles me. For the sake of testing I've putting the variable's initial number at something other than 0 and the event doesn't trigger anymore, which makes it even weirder in a way. I'm frantically looking for a workaround, but even if I , this is really driving me crazy as the same structure seems to work perfectly fine for me in other situations.


do you have any wait events between them? where are the condition palced in your event sheet? try place it on a top ranked event ... near start of layout .. that wold do the trick.. since will not wait for others events to happen.


you have to keep in mind when you add wait actions between lines

it wont stop only that event but also everything that is under it for the exact amount of wait + the amount the time it takes to process all the events till reaches the required action, so for example

if u have the conditions u gave, and have a wait of 2 seconds and then change value of VariableA and in same time, after first click and while the 2 seconds didnt passed youl be able to trigger the same actions for N clicking speed u have in ur fingers. then the VariableA will change the value.

try change variableA as soon as the conditions are meet, which is first on top of actions triggered by those 2 conditions.

try posting urls without www. or http://www. that will allow u if u need live help u can reach to me via skype at gamecorp.tm or via mail at zgaagz [at] gmail.com
B
70
S
20
G
67
Posts: 1,316
Reputation: 42,305

Post » Fri Sep 25, 2015 9:31 pm

The event is at the top and there are no wait events happening while I'm testing this. The clicking triggers indefinitely. As in, if i keep clicking, it keeps happening, regardless of clicking speed.
B
4
Posts: 5
Reputation: 210

Post » Fri Sep 25, 2015 9:36 pm

does your event look similar to this?

http://scirra.ro/examples/eventstrigger1time.png


dont mind the image point position my brain farted there.


if it looks like above image should not allow u to trigger the actions after 1st press unless All conditions resets themselves at some point and the conditions are meet again when ur pressing. make sure ur events and event sheets that you may included in the event_sheet u have that specific action to trigger, are not interfering or resetting variableA value to the point where it meets the condition to match the matrices you created for the action to be triggered.

on short... make sure variableA stays different then 0 after u pressed the object. thats all u have to do. if u sure nothing resetting it back to 0 then u might found a bug. or some cache from firefox. try resetting the browser if that wold help or try testing it in NW.js if u have it installed.
B
70
S
20
G
67
Posts: 1,316
Reputation: 42,305

Post » Fri Sep 25, 2015 9:52 pm

I was being stupid. Sorry for pestering about that. The problem was probably that since i was creating new instances of the object and it started with reset variables, the conditions would stil be met. Apologies.
B
4
Posts: 5
Reputation: 210


Return to Beginner's Questions

Who is online

Users browsing this forum: timcs and 2 guests