Alice Community  

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

Reply
 
Thread Tools Display Modes
Giving a list in paramaters
Old
sam.no21
Guest
 
Status:
Posts: n/a
Default Giving a list in paramaters - 06-14-2010, 05:17 AM

Is there any way to give a list in the parameters of a method and then use it in a for all statement? (Alice 2.2)
Anyone with jython knowledge have an idea?

Thanks
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 06-14-2010, 06:52 PM

Yeah, but it requires no Jython knowledge whatsoever.
  1. Make your new method.
  2. Make a new parameter.
  3. Set the name, variable type, and select 'Make a list' in the bottom right corner of the window.
  4. Drag a for all box (Whichever one you want) into the method, and select your parameter list as the list in question.
  5. Make your for all stuffs, and run the world!
Here's some images to go with some of the steps:
Step 2:

Step 3:

Step 4:


Hope this helps!


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Old
sam.no21
Guest
 
Status:
Posts: n/a
Default 06-14-2010, 08:56 PM

Oh wow. Thanks for that, I can't believe that it is that simple. I tried for ages to drag and drop the list in to the for all statement and never tried to select it from the drop down list.
   
Reply With Quote
Old
sam.no21
Guest
 
Status:
Posts: n/a
Default 06-14-2010, 09:21 PM

Now I have another problem

I am calling a method from another method (both world methods).
The method I am calling has the list in its parameters, but I can not give a list which belongs to an object, only world lists. Any ideas?
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 06-15-2010, 02:39 PM

I don't have that problem. Hmm. Whan you drag the method into somewhere, you should be able to select it. It will have the object.varname as the option. Here's an image of what it could look like:


Hope this helps!


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Reply


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.