This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-08 19:16:05

JMTB123
Scratcher
Registered: 2011-09-14
Posts: 69

List trouble :P

Wow , I thought I would never need helop but I do  big_smile . I have asked a few teachers at my school and my frineds but we can't figure it out i wont reveal what gam i am making but I can say it can't be uploaded here until they increse the server side uploading limit

but here is the problem: I have 2 lists

LIST: 1
1
2
3
4
5
6

LIST: 2
1
2
3
4
5
6

I want the script to deleat what ever is in list 2 from list one  hmm  I knwo it might not make sense but please help  big_smile  big_smile  I will let you have sneak peaks

Offline

 

#2 2012-03-08 22:24:01

ProgramCAT
Scratcher
Registered: 2011-12-13
Posts: 500+

Re: List trouble :P

Could you specify with more detail what your problem is?


Programming is an art...
Goodbye, Scratch. I am leaving because of the exams coming up at our school, though I'll check the forums once or twice a week.

Offline

 

#3 2012-03-08 22:35:29

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: List trouble :P

list 2's items in list 1 will delete the items in list 1:

when I receive [list-stuff]
set [i] to (0)
repeat(length of [list1 v])
change [i] by (1)
set [j] to (0)
repeat(length of [list2 v])
change [j] by (1)
if<(item (j) of [list2]) = (item (i) of [list1])>
delete (i) of [list1]
end
end
end
That should do it.  Tell me if it doesn't work.

Last edited by MoreGamesNow (2012-03-08 22:35:40)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-03-09 00:28:40

JMTB123
Scratcher
Registered: 2011-09-14
Posts: 69

Re: List trouble :P

^Thanks but that would require WAY too many varible.. My proble is like a deck of cards
I want it once you have drawn the cards from the deck i want them to be dealted from the deck

The 2 lists are DECK and HAND Thanks I cant explain any more than that if still i will upload the script in its own game

Offline

 

#5 2012-03-09 09:35:59

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: List trouble :P

Just replaced "list1" with "DECk" and "list2" with HAND".  I don't understand how 2 variables is too much.

Why don't you delete cards from the deck as they are dealt?

When I Receive [Deal]
repeat (size_of_hand)
set [i] to (pick random (1) to (length of [DECK v]))
add (item (i) of [DECK v]) to [HAND v]
delete (i) of [DECK v]
end

Last edited by MoreGamesNow (2012-03-09 09:37:00)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#6 2012-03-09 23:10:55

JMTB123
Scratcher
Registered: 2011-09-14
Posts: 69

Re: List trouble :P

Thanks every1 but I found a way that works better  hmm  after staying up most of the night but still thakns for the help i will comment on one of your projects each when i release it  smile

Offline

 

Board footer