Alice Community  

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

Reply
 
Thread Tools Display Modes
How to make a Clicked Object = A variable
Old
ctpmn
Guest
 
Status:
Posts: n/a
Default How to make a Clicked Object = A variable - 09-22-2006, 02:14 PM

I would really like to be able to click on an object and store it as a variable then be able to click on another object and store that as a variable. Then be able to run my Method. I tried storing the object as a parameter, but i cannot get it to store 2 parameters before running the script. Please help, me and like 7 other people canot figure this out. Any help would be greatly appreciated.
   
Reply With Quote
Hmmmm...
Old
Mr Nemo
Guest
 
Status:
Posts: n/a
Default Hmmmm... - 09-22-2006, 08:36 PM

I think this is what you wanted...
Attached Files
File Type: zip It works!.zip (675.2 KB, 412 views)
   
Reply With Quote
Not really
Old
ctpmn
Guest
 
Status:
Posts: n/a
Default Not really - 09-22-2006, 10:13 PM

Thanks for the response, but what I need is to save the mouse click as a variable or parameter like you have, but then I need to be able to save another mouse click as another variable/parameter. I want to be able to click on one object then another and then i want the program to be able to use those variables to run a program. Specifically I want the taller of the 2 objects to turn 1 revolution. My Logic thus far was this. It doesn't work at all though. I belive it will once i can store a 2 clicked on object as a variables

If
"object1" is taller than "object2"
"object1" turn left 1 revoultion
Else
If
"object2" is taller than "object1"
"object2" turn left 1 revoultion
Else
Do Together
"object2" turn left 1 revolution
"object1" turn left 1 revolution
The Problem is setting the objects equal to the objects i choose
   
Reply With Quote
Old
Mr Nemo
Guest
 
Status:
Posts: n/a
Default 09-22-2006, 10:17 PM

You should try constructing a list or an array and adding the objects that the user clicks on to the list. Then when the user hits a key, Alice performs diagnostics on the list to determine which is taller. I'll do some code work, but I might not get it up 'til tomorrow afternoon.
   
Reply With Quote
Here you go!
Old
Mr Nemo
Guest
 
Status:
Posts: n/a
Default Here you go! - 09-23-2006, 04:00 PM

I got the basic code structure, worked out, cost me half an hour. Take a look at the code so you know what to do in the future.
p.s. I'd love to see what you're working on.
Attached Files
File Type: a2w It works!.a2w (719.5 KB, 388 views)
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 09-23-2006, 04:06 PM

When he offers, "...me and like 7 other people canot figure this out" dare I say it's somebodies HOMEWORK.
   
Reply With Quote
Old
Mr Nemo
Guest
 
Status:
Posts: n/a
Default 09-23-2006, 06:39 PM

Dare I say that that little factoid is completely irrelevant. You are looking from behind clouded glasses my friend, as you are a teacher yourself. I, on the other hand, am a student, and view this as nothing more than student helping student, which I dare say is not a crime even your book. I sure hope you allow study groups in your class.
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 09-23-2006, 07:38 PM

When I instruct my students NOT to use other's code, then it is wrong for you to show them the code to do it. How can they NOT use that code?

Someone posted code on here a few days ago and infatically stated "Do NOT copy this code !!!! " .................wanna take a bet on whether or not it was copied?

We can point students in the proper direction but I do not believe we need to do their assignments for them.

Good luck with your programming projects. You have shown that you have a good grasp of ALICE.

l
   
Reply With Quote
half hour ??
Old
ctpmn
Guest
 
Status:
Posts: n/a
Cool half hour ?? - 09-25-2006, 12:15 AM

Okay, so I really REALLY appreciate the help your trying to give, but I don't really see what you did. Firstly I wasn't aware you could put an array in Alice, secondly i cannot find any of your code that will do anything but print the object clicked on. Mabye I'm missing something but all I see in that code is the method to print which object you click on.
If there is something that I'm not seeing, which there must be, considering you spent a half hour on this. Not meaning to be all noobish, but I cant see where the rest of your time went.
And for the record it IS homework, and the teacher just gave up on it and said that we should make yes or no boxes for each possible scenario, but thats just rediculous. So, mabye it's impossible with Alice. Personally I'd just like to be able to assign a variable to an object clicked on then do another, you think it'd be easy.
   
Reply With Quote
Another CLOSER look
Old
ctpmn
Guest
 
Status:
Posts: n/a
Default Another CLOSER look - 09-25-2006, 12:19 AM

It seems to be the same as the first file, mabye you uploaded the wrong one?? HERES HOPING!!!!! lol. Thanks for all the work you put into helping a "Junior Member" like me.
   
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 ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.