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

#1 2009-08-01 17:39:05

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Spaces in ask function

I recently uploaded my ScratchSearch project ( http://scratch.mit.edu/projects/The-Whiz/631627 ) and I realized that it does not work when spaces are used. Could someone either help me fix this or tell me a solution?

Offline

 

#2 2009-08-18 01:27:41

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Spaces in ask function

I always have trouble understanding other peoples projects that contain lists, but I think the problem is that spaces do not count as letters. You have this script:

repeat length of answer
change letter by 1
add letter letter of answer to letters

So the problem is that it is not reading the spaces. It didn't work offline for me either. You should get in contact with one  of the Scratch team, and ask them to fix that bug.

Last edited by WeirdF (2009-08-18 01:28:58)


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

#3 2009-08-18 11:47:09

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Spaces in ask function

No...I'm pretty sure it's not the spaces alone that are causing you trouble.  Take a look at this project (which works fine)

http://scratch.mit.edu/projects/Paddle2SeeFixIt/651310

Where you are running into trouble is when you have a search word that is longer than the word you are comparing it to...but matches at every position.  So if you are searching for "Scratch Team" and one of the words you are comparing it to is "Scratch", your loop is going to continue to try to compare letters from "Scratch Team" to letters that don't exist in "Scratch".  You might want to just immediately reject any words that are shorter than the one you are searching for.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2009-08-25 03:44:38

WeirdF
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: Spaces in ask function

Paddle2See wrote:

No...I'm pretty sure it's not the spaces alone that are causing you trouble.  Take a look at this project (which works fine)

http://scratch.mit.edu/projects/Paddle2SeeFixIt/651310

Where you are running into trouble is when you have a search word that is longer than the word you are comparing it to...but matches at every position.  So if you are searching for "Scratch Team" and one of the words you are comparing it to is "Scratch", your loop is going to continue to try to compare letters from "Scratch Team" to letters that don't exist in "Scratch".  You might want to just immediately reject any words that are shorter than the one you are searching for.

This proves that I'm always wrong when I try to help people. It keeps happening!


http://i.cr3ation.co.uk/dl/s1/gif/847032b8a331def77529b6a0384db1fe_handfingers.gif

Offline

 

#5 2009-08-25 07:21:40

The-Whiz
Scratcher
Registered: 2007-07-09
Posts: 1000+

Re: Spaces in ask function

WeirdF wrote:

Paddle2See wrote:

No...I'm pretty sure it's not the spaces alone that are causing you trouble.  Take a look at this project (which works fine)

http://scratch.mit.edu/projects/Paddle2SeeFixIt/651310

Where you are running into trouble is when you have a search word that is longer than the word you are comparing it to...but matches at every position.  So if you are searching for "Scratch Team" and one of the words you are comparing it to is "Scratch", your loop is going to continue to try to compare letters from "Scratch Team" to letters that don't exist in "Scratch".  You might want to just immediately reject any words that are shorter than the one you are searching for.

This proves that I'm always wrong when I try to help people. It keeps happening!

Don't feel bad... He's been on Scratch a lot longer than you.

Paddle2See wrote:

No...I'm pretty sure it's not the spaces alone that are causing you trouble.  Take a look at this project (which works fine)

http://scratch.mit.edu/projects/Paddle2SeeFixIt/651310

Where you are running into trouble is when you have a search word that is longer than the word you are comparing it to...but matches at every position.  So if you are searching for "Scratch Team" and one of the words you are comparing it to is "Scratch", your loop is going to continue to try to compare letters from "Scratch Team" to letters that don't exist in "Scratch".  You might want to just immediately reject any words that are shorter than the one you are searching for.

Thanks for helping!

Last edited by The-Whiz (2009-08-25 07:22:12)

Offline

 

Board footer