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

#1 2011-01-23 18:20:01

spe1000
Scratcher
Registered: 2010-08-23
Posts: 3

Question and Answer

How do you delete a specific item without knowing what number it is in the list.

Offline

 

#2 2011-01-24 02:10:58

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Question and Answer

so like "delete item of list that = "rabbit"" ? There's no fast way using original Scratch, but you use a counting variable and a repeat script.

[set [var1] to (0)]
|repeat (length of [list]]
|[change [var1] by (1)]
||if <(item (var1) of [list]) = [rabbit]>
||[delete item (var1) of [list]
||[stop script]
||endIf
||endRepeat

Hope that's clear! If you wanted to achive this using the modification Panther then you could use the  (place of [ ] in [list]) block from the Block Library.


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

Board footer