It's a little hard to word this in a sentence, but I have a script with a set of numbers in it, that looks sorta like..
1. 2
2. 4
3. 5
etc.
Let's say that I have a script which needs that number containing the 2. For example, if Sprite X has Costume Number 5, I want to get 3 out of that. And if it uses costume number 3, that's not on the list, so it'll report something else entirely. I can't even begin to think about how I'll do that, so I've just been making another list that looks like
1. 0
2. 1002
3. 0
4. 1105
To report true or false for those values. However, that's very clunky, since I've got 150 values in that list, and they need to be in order - so when I accidentally delete one, I've got to start over. I'm starting with something like this...
when gf clicked if <(list of values) contains (costume # of sprite X)>But I can't figure out where to go from there to get the list number from that. Sorry if this is vague, any help?
Offline
set [counter v] to [0] repeat (length of [list v]) change [counter v] by (1) if <(item (counter) of [list v]) = [value you are looking for]> set [index you need v] to (counter) end end...and the variable "index you need" will have the list number you need
Last edited by jvvg (2012-11-16 10:58:27)
Offline
jvvg wrote:
set [counter v] to [0] repeat (length of [list v]) change [counter v] by (1) if <(item (counter) of [list v]) = [value you are looking for]> set [index you need v] to (counter) end end...and the variable "index you need" will have the list number you need
Thanks! That's just what I was looking for.
Offline