Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Clicking on something from a list
Old
cheater
Guest
 
Status:
Posts: n/a
Default Clicking on something from a list - 04-04-2011, 11:56 AM

I want to use the "when mouse is clicked on something" event to click on any item from a list. how would i go about using a list for this event?

i don't want
-first item from list
-last item from list
-random item from list
-ith item from list

i want
-any item from list
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-04-2011, 12:32 PM

Here is an example where clicking on the object moves the object up only if they are in the animals array. A lot of the functions can be found by simply going to "expressions" in the drop down menu's. I tried using the ifContains function for the array but that didn't work. Maybe there was a problem with class hierarchies. Let me know if you need help finding any of the functions or anything.


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
cheater
Guest
 
Status:
Posts: n/a
Default 04-04-2011, 01:24 PM

thanks... that would have been helpful if you actually gave a link for the example, and i have no clue what half the things you said were
   
Reply With Quote
Old
David B
Senior Member
 
David B's Avatar
 
Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
Default 04-04-2011, 03:01 PM

I didn't quite get what you were saying, but you did say that you want "any item from list" which is not an option. I am not quite sure what you meant by any item from list, and I am not sure if you want the item to be different each time, but if you do want the item do be differemt each time, use "random item from list".

Hope this helps!
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-04-2011, 05:26 PM

Oops, I forgot to add the picture. My bad.
Attached Images
File Type: jpg aliceClickExample.jpg (100.0 KB, 45 views)


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
cheater
Guest
 
Status:
Posts: n/a
Default 04-04-2011, 06:20 PM

thanks Reuben2011, this looks like it is what i am looking for, but how did you get the line that says

"clickedObject" == item "index" from "world.animals"

when i try to drag "clickedObject into an a==b statement, it only gives me the choices of
-clickedObject.opacity and
-clickedObject.specularHighlightExponent

and when i try to drag in the list i get
-size of list
-first index of
-last index of

i am using alice 2.0 btw
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 04-05-2011, 12:04 PM

Ok, first get rid of the "a==b" statement. Leave the it statement blank right now. Use true or false as a dummy value. Drag the clickedObject parameter into the condition portion of the it statement. Hover over "clickedObject==". Then select whatever value like ground as a placeholder. Drag the list where the object placeholder is. Hover over "ith item from list", then hover over "expressions" and select "index". If you can't find the index expression, put something there as a placeholder and drag the index expression from the complicated version of the loop into place. Hope this helps!


Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.