This may have already been suggested...
I think it would be nice if, instead of being able to only delete and replace items at a certain position in a list, people could type a specific item and have that specific item deleted or replaced from the list. At the moment, it is only possible to delete and/or replace items at certain positions in a list. We could also have blocks that would detect if a certain item was in a list.
We could have blocks that would look like this:
if <item [ball] is in list [inventory v]> delete item [ball] of list [inventory v] end if <item [ball] is in list [inventory v]> replace item [ball] of list [inventory v] with item [car] end
Offline
that would be useful but the scratch team rarely adds features with workarounds.
set [c v] to (1) repeat until <(c) > (length of [inventory v])> if <(item (c) of [inventory v]) = [ball]> delete item (c) of [inventory v] else change [c v] by (1) end end
Last edited by Wes64 (2012-08-31 19:13:37)
Offline
That would be cool, but what would happen if there were duplicates of an item? Would it delete the first, both, or what? :S
Offline
Jonathanpb wrote:
That would be cool, but what would happen if there were duplicates of an item? Would it delete the first, both, or what? :S
The blocks would delete both or the blocks could look like this:
if <item [ball] is in list [inventory v]> delete instance [1 v] of item [ball] of list [inventory v] end if <item [ball] is in list [inventory v]> replace instance [1 v] of item [ball] of list [inventory v] with item [car] end
Offline
This would be nice, though, as Wes said, there is a somewhat cumbersome workaround.
Offline
<[list v] contains [thing]>is the
<item [] is in list [list v]>you have put in the topic post.
Offline