The Daily Click ::. Forums ::. Klik Coding Help ::. Why wont these simple events work on multiple objects?
 

Post Reply  Post Oekaki 
 

Posted By Message

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
12th May, 2012 at 12/05/2012 13:16:53 -

X Position of "detector" = X Position "active"
+Y Position of "detector" = Y Position "active" --> Set "counter" to 1.


X Position of "detector" 'is different to' X Position "active"
+Y Position of "detector" 'is different to' Y Position "active" --> Set "counter" to 0.


Object "active" can be created on a grid by the click of a mouse, however the "detector" can only detect the most recent "active" placed and will not change the counter when it is in the same position of the previously placed actives.

whhhhyyyyy?


 

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
12th May, 2012 at 12/05/2012 13:39:39 -

It sounds like you only have one "detector" and many "actives", in which case you can just reverse the order of all those conditions.

X Position of "Detector" = X("Active")

X Position of "Active" = X("Detector")


Also, you're currently setting the counter to 1 if both X and Y are the same, or 0 if neither X nor Y are the same - so what if either X or Y are the same, but not both?

I think you want to say:

+ Always
-> Counter: Set value to 0

+ Active: X position = X("Detector")
+ Active: Y position = Y("Detector")
-> Counter: Set value to 1


Edited by Sketchy

 
n/a

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
12th May, 2012 at 12/05/2012 15:21:19 -

Thanks for replying, Sketchy.

I want "counter" to be 1 when the "detector" is in the same X & Y position as the "active". Yes, that is correct, I have many "actives" and only one "detector".

The original events I had were actually

1. X Position of "detector" = X Position "active"
+Y Position of "detector" = Y Position "active" --> Set "counter" to 1.

2. X Position of "detector" 'is different to' X Position "active" --> Set "counter" to 0.

3. Y Position of "detector" 'is different to' Y Position "active" --> Set "counter" to 0.


When I reversed the order of the conditions the counter would set to 1 when the detector was in the same position of the first "active" that was created, but if I created any more "active's" the counter wouldn't change from 0 when the detector was over any of them.

When I tried:

+ Always
-> Counter: Set value to 0

+ Active: X position = X("Detector")
+ Active: Y position = Y("Detector")
-> Counter: Set value to 1


The counter would never change from 0, and I also tried that method with the conditions reversed and achieved the same results.

 

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
12th May, 2012 at 12/05/2012 17:07:19 -

It works perfectly for me: http://skydrive.live.com/redir.aspx?cid=b1e7ee094271bbda&resid=B1E7EE094271BBDA!519&parid=B1E7EE094271BBDA!131
Make sure the always event comes before the conditional one, and that you're not using "compare two general values".
And obviously this is only going to check if the hotspots of the two objects are in exactly the same position (not whether they overlap), and it's not going to work if you added the objects as backdrops or whatever.

Edited by Sketchy

 
n/a

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
13th May, 2012 at 13/05/2012 07:44:23 -

Thanks Sketchy!

That was really unusual, because I tried these same events last night with no luck, but when I tried them today it worked.



 
   

Post Reply



 



Advertisement

Worth A Click