(Redirected from Item () of ())
|Item () of ()|
When a certain item in a list must be recalled, this block can be used.
Some common uses for the Item () of () block are:
- Reporting an object
ask [Which item would you like on our menu today?] and wait change [cost v] by (item (answer) of [food costs v]) say (join (join [We'll be making your ](item (answer) of [food names v]))[ in a minute.])
- Recalling part of a record
ask [What highscore would you like to know?] and wait say (join (join (join [Highscore ](answer))[ is: ])(item (answer) of [highscores v]))
- Comparing different items
if <(item (1 v) of [collection v]) = (item (1 v) of [pack v])> then say [I already have this item in my pack.] for (3) secs
- Main article: List of Block Workarounds
The text options of this block can be worked around by dropping Reporter blocks into the dropdown value menu.
(item (random v) of [list v])chooses a random item in the list. Thus, it can be replicated with the following code:
(item (pick random (1) to (length of [list v])) of [list v])
This also gives the ability to use lists as a workaround for the Pick Random () to () block.
"Last" gives the last item of the selected list.
(item (last v) of [list v]
Its replica is:
(item (length of [list v]) of [list v])//only if length of list > 0