Well, The title kind of says the story, but I was trying to make somthing where a list could have an infinite ammount of items and I didn't want to spend all of the time modifying my script to make it work with more and more items in the list, so I though any would've done it, but it only picks a random one out - What I was doing was this:
if <(item (any v) of [list v]) = (answer)> Obsolete, because i want to hide the rest of my code. end
Last edited by DigiTechs (2012-03-15 17:43:31)
Offline
If you want to check all items of the list, use a loop:
set [counter v] to [1]
repeat (length of [list v])
if <(item (counter) of [list v]) = (answer)>
// do something
end
change [counter v] by [1]
end
Last edited by nXIII (2012-03-15 18:46:07)
Offline
Any refers to 'any of them' which is random, and as nXII says there is a way to check any of the items.
Offline
wouldn't the boolean block
<[ x v] contains (answer)>be more useful, in this case?
Last edited by LS97 (2012-03-16 12:33:38)
Offline
DigiTechs wrote:
LS97 wrote:
wouldn't the boolean block
<[ x v] contains (answer)>be more useful, in this case?Doh. Why is my brain not working?
Don't worry, many people forget that block exists.
Offline
Although, I did find that costume names can be used as a list with a number return. Instead of "number of item [text] in [list]" you can do "switch to costume [text]" and then "costume #" will report the position.
Offline
Well what I was doing was making an authentication system for somthing I was making, in BYOB, so i'll script most of what I was doing: (has been modified to what it is now)
if <( sentence - list (Userpasswords v sensor value) ) contains (answer)> etc.. end
Last edited by DigiTechs (2012-03-23 11:50:04)
Offline
DigiTechs wrote:
Well what I was doing was making an authentication system for somthing I was making, in BYOB, so i'll script most of what I was doing: (has been modified to what it is now)
if <( sentence - list ([Userpasswords v]sensor value) ) contains (answer)> etc.. end
Due to technical limitations, the sensorvalue block has failed to show.. unless (editing now, if you read the quotations, you're reading after i modified)
Offline