I am making this game where to set a fire, you need logs in your inventory, and some flint. You lose the logs once you build the fire. What I want to say is:
If inventory contains logs and flint and key f pressed:
broadcast Fire
delete item "Logs" of inventory
I can't get it to delete anything but all, or top, or item #_. What if logs are item 2 or item 673? How do you get Scratch to delete Logs, no matter where it is on the list?
Offline
You will need to do it a long way around, make a variable called log# then do this script
[When f key pressed]
[If <List contains logs> and <List contains flint>]
[] [Set [Log#] to 0]
[] [Repeat until <[Logs] = (item(log#) of list)>
[] [] [Change [log#] by 1]
[] [The repeat block stops here]
[] [Delete (log#) of [list]]
[] [Broadcast [fire]]
[The repeat block ends here]
Offline
You can click in the little white text box thingy, and type your number in there - it's much simpler than using variables (if items' positions in the list are fixed)
Offline
This is hard to explain, but here goes:
You have 2 variables
Temp.1
Temp.2
you do a code like this:
set Temp.1 to 0
set Temp.2 to 0
repeat (length of (ITEMS LIST))
| change Temp.1 by 1
| if <(Item (Temp.1) of (ITEMS LIST)) = logs>
| | set Temp.2 to (Temp.1)
|__________________________________________
___________________________________________
At the end of this Temp.2 will hold the positon of logs in the list, so then use
(delete item (Temp.2) of (ITEMS LIST))
and if Temp.2 = 0 then you have none in the list!
Offline
Ahem.
[delete item (2) from list [inventory]]
Offline
But what if logs are in a diffrent place.
Offline