Alice Community  

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

Reply
 
Thread Tools Display Modes
Arrays and lists
Old
REDOS
Guest
 
Status:
Posts: n/a
Default Arrays and lists - 02-25-2010, 10:08 AM

Hey, do u know if u can move a whole list to one place? ive tried but when i want to make it, i just can move first item, or X item, or final item, not all of them, so i remove the first item i moved with a loop, and repeat the same, but at the end of the day the result is that ive removed all the objetcs i had on the list, and i dont want to make that. thnx

If there is a way to say move item1 &item2&item 3 would be nice
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 02-25-2010, 10:54 AM

Do you mean clear the list? That's an option if you drag the list onto the scripting area, I believe.

Yep, it's second to last. "Remove all items from <list's name>"


(')>
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 02-25-2010, 12:20 PM

Moving one list to another just requires a single method (as alice can't return a list through a function).

The code would look something like this (this is my own sort of pseudo-code that will make it understandable in Alice):

Code:
list1 = [1,2,3]
list2 = []
loop index = 0 up to but not including the size of list1 do
    insert item index from list1 to the end of list2
end
remove all items from list1 //remove if you want list1 to keep values
The output if you look at list1 and list2 will be:

list1 = []
list2 = [1,2,3]
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 578
Join Date: Nov 2008
Location: In the interwebs
Default 02-26-2010, 08:35 PM

Actually, the "For all in order" function is what you want! It does something to every object in the list! I'll upload a program with it to show you.
Attached Files
File Type: a2w append.a2w (166.2 KB, 16 views)


'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

Tags
array, arrays, list, lists

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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.