I was wondering if i could use lists to hold all skills in a game. I've been trying to say if any of the conditional variables in the list are true then do something. Eg. punch=z pressed?
But it doesnt add to the list.
Offline
Of course you can do that!
when gf clicked replace item (1 v) of [list v] with <key [z v] pressed?> ... if <(item (1 v) of [list v]) = [true]> say [z is pressed] end
Offline
[scratchblocks]
when gf clicked
delete (all) of skills
Offline
Woops, i lost internet right before my last post. I still havent been able to do what you showed hardmath. i dont recognize the ... block if that does anything.
My Code:
when gf clicked add [(key [z] pressed?)] to [skills] if (item (any) of [skills] = [true]) say [z is pressed]This is just a test to see if it will add key z pressed to skills, and it doesnt work. what i actually am aiming to do is if any skills are true then execute a series of if then statements for each skill. Im not sure whats wrong.
Offline
First of all, the [...] block does nothing, in fact it doesn't exist. I put it there to indicate "put some more blocks here, it doesn't matter what".
To preview your post, you need to click on the "Post Reply" link above the Quick Post box, to the right (right under the last post's report button). In the new editor, you will have a 'Preview' option.
Finally, your question. Here is what you need to do, I think:
when gf clicked replace item (1 v) of [skills v] with <key [z v] pressed?> replace item (2 v) of [skills v] with <key [x v] pressed?> if <(item (1 v) of [skills v]) = [true]> say [z was pressed] end if <(item (2 v) of [skills v]) = [true]> say [x was pressed] end
Offline
If you need any explanation on Lists, check out the Scratch Wiki @ http://wiki.scratch.mit.edu/wiki/List.
Offline
Hardmath123 wrote:
First of all, the [...] block does nothing, in fact it doesn't exist. I put it there to indicate "put some more blocks here, it doesn't matter what".
To preview your post, you need to click on the "Post Reply" link above the Quick Post box, to the right (right under the last post's report button). In the new editor, you will have a 'Preview' option.
Finally, your question. Here is what you need to do, I think:replace item (1 v) of skills with <key (z v) pressed?> if <(item [1 v] of [skills v]) = (1) > something end
not << (item (1 v) of skills) = [true] >>
Last edited by PencilFactory (2012-04-08 14:53:54)
Offline
PencilFactory wrote:
Hardmath123 wrote:
First of all, the [...] block does nothing, in fact it doesn't exist. I put it there to indicate "put some more blocks here, it doesn't matter what".
To preview your post, you need to click on the "Post Reply" link above the Quick Post box, to the right (right under the last post's report button). In the new editor, you will have a 'Preview' option.
Finally, your question. Here is what you need to do, I think:replace item (1 v) of [skills v] with <key [z v] pressed?> if <(item (1 v) of [skills v]) = [true] > something end<not < (item (1 v) of [skills v]) = [true] >>
Scripts fixed by: TorbyFork234
Offline