This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-05-28 14:16:08

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

List Question

I'm making this project where if there's a certain word in your answer to a question in one of those sensing

 ask [] 
ask blocks, then it's added to a list. I'm trying lots of things, but it won't work! Help will be greatly appreciated!  big_smile


http://i48.tinypic.com/2072ctw.gif

Offline

 

#2 2012-05-28 14:22:37

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: List Question

I'm not entirely sure what you mean, but I think what you need is a script that adds your answer to a list only if it is a certain answer. Is this right?


Why are the secret organizations getting all the attention?  mad

Offline

 

#3 2012-05-28 14:29:51

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: List Question

That's the idea. The only thing is what I'm thinking is if there's certain words within your answer, than it adds it to a list, for example:

When gf Clicked
Forever
If (Answer) contains "run" // but your answer could be something like "JimBob likes to run." 
Add [run] to [thing v] 
end
Thanks!


http://i48.tinypic.com/2072ctw.gif

Offline

 

#4 2012-05-28 14:30:44

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: List Question

Well, try this:

set [adder v] to [] //Blank.
set [loopcounter v] to [1]
ask [YourQuestion] and wait
repeat (length of (answer))
 if <(letter (loopcounter) of (answer)) = [ ]> //A space.
  add (adder) to [words v]
  set [adder v] to [] //Blank.
 else
  set [adder v] to (join (adder) (letter (loopcounter) of (answer)))
 end
 change [loopcounter v] by (1)
end
if <[words v] contains [YourWord]>
 add (answer) to [YourList v]
end

Last edited by SciTecCf (2012-05-28 14:36:16)


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#5 2012-05-28 14:45:30

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: List Question

SciTecCf wrote:

Well, try this:

set [adder v] to [] //Blank.
set [loopcounter v] to [1]
ask [YourQuestion] and wait
repeat (length of (answer))
 if <(letter (loopcounter) of (answer)) = [ ]> //A space.
  add (adder) to [words v]
  set [adder v] to [] //Blank.
 else
  set [adder v] to (join (adder) (letter (loopcounter) of (answer)))
 end
 change [loopcounter v] by (1)
end
if <[words v] contains [YourWord]>
 add (answer) to [YourList v]
end

sad  I tried that - it didn't work. I surrounded it with a forever block and then inside of it a "if" block, and finally inside those scripts. The if I put was accurate - did I do something wrong? Thanks!

Last edited by powerpoint56 (2012-05-28 14:45:51)


http://i48.tinypic.com/2072ctw.gif

Offline

 

#6 2012-05-28 14:58:03

SciTecCf
Scratcher
Registered: 2011-11-23
Posts: 1000+

Re: List Question

powerpoint56 wrote:

SciTecCf wrote:

Well, try this:

set [adder v] to [] //Blank.
set [loopcounter v] to [1]
ask [YourQuestion] and wait
repeat (length of (answer))
 if <(letter (loopcounter) of (answer)) = [ ]> //A space.
  add (adder) to [words v]
  set [adder v] to [] //Blank.
 else
  set [adder v] to (join (adder) (letter (loopcounter) of (answer)))
 end
 change [loopcounter v] by (1)
end
if <[words v] contains [YourWord]>
 add (answer) to [YourList v]
end

sad  I tried that - it didn't work. I surrounded it with a forever block and then inside of it a "if" block, and finally inside those scripts. The if I put was accurate - did I do something wrong? Thanks!

Ah, yes. It doesn't work.

Here is a version of it that does:

delete (all v) of [words]
set [adder v] to [] //Blank.
set [loopcounter v] to [1]
ask [YourQuestion] and wait
repeat (length of (answer))
 if <(letter (loopcounter) of (answer)) = [ ]> //A space.
  add (adder) to [words v]
  set [adder v] to [] //Blank.
 else
  set [adder v] to (join (adder) (letter (loopcounter) of (answer)))
 end
 change [loopcounter v] by (1)
end
add (adder) to [words v]
set [adder v] to [] //Blank.
if <[words v] contains [YourWord]>
 add (answer) to [YourList v]
end


http://bit.ly/LCZEJRhttp://bit.ly/LSONcOhttp://bit.ly/LF3vIc
http://trinary.site40.net/images/scratchrank.php?username=SciTecCf&amp;display=small

Offline

 

#7 2012-05-28 15:05:11

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: List Question

SciTecCf wrote:

powerpoint56 wrote:

SciTecCf wrote:

Well, try this:

set [adder v] to [] //Blank.
set [loopcounter v] to [1]
ask [YourQuestion] and wait
repeat (length of (answer))
 if <(letter (loopcounter) of (answer)) = [ ]> //A space.
  add (adder) to [words v]
  set [adder v] to [] //Blank.
 else
  set [adder v] to (join (adder) (letter (loopcounter) of (answer)))
 end
 change [loopcounter v] by (1)
end
if <[words v] contains [YourWord]>
 add (answer) to [YourList v]
end

sad  I tried that - it didn't work. I surrounded it with a forever block and then inside of it a "if" block, and finally inside those scripts. The if I put was accurate - did I do something
wrong? Thanks!

Thanks! I'm about to try it out!  smile  that turned out funny!
Ah, yes. It doesn't work.

Here is a version of it that does:

delete (all v) of [words]
set [adder v] to [] //Blank.
set [loopcounter v] to [1]
ask [YourQuestion] and wait
repeat (length of (answer))
 if <(letter (loopcounter) of (answer)) = [ ]> //A space.
  add (adder) to [words v]
  set [adder v] to [] //Blank.
 else
  set [adder v] to (join (adder) (letter (loopcounter) of (answer)))
 end
 change [loopcounter v] by (1)
end
add (adder) to [words v]
set [adder v] to [] //Blank.
if <[words v] contains [YourWord]>
 add (answer) to [YourList v]
end

Last edited by powerpoint56 (2012-05-28 15:06:06)


http://i48.tinypic.com/2072ctw.gif

Offline

 

#8 2012-05-28 15:22:32

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: List Question

THANK YOU SO MUCH!!!! I spent so long trying, and finally the idea came to me, how 'bout I just post I need help?  tongue
THANK YOU AGAIN!


http://i48.tinypic.com/2072ctw.gif

Offline

 

#9 2012-05-28 17:41:03

sonicfan12p
Scratcher
Registered: 2011-11-16
Posts: 1000+

Re: List Question

Did it work?


Why are the secret organizations getting all the attention?  mad

Offline

 

#10 2012-05-28 18:41:55

powerpoint56
Scratcher
Registered: 2012-04-19
Posts: 500+

Re: List Question

sonicfan12p wrote:

Did it work?

Read my note just below yours.  big_smile


http://i48.tinypic.com/2072ctw.gif

Offline

 

Board footer