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

#1 2013-01-12 01:43:35

Vortex_
Scratcher
Registered: 2012-08-07
Posts: 13

Word Scrambler Help

OK, so I need to have a script which scrambles words without any double letters. The word has to be inputted by the user. This is what I have so far:

when gf clicked
delete [all v] of [Current Name v]
delete [all v] of [New Name v]
switch to costume [Ask v]
go to x: (0) y: (-158)
clear
ask () and wait
set [WordDecompile v] to (0)
repeat (length of (answer))
change [WordDecompile v] by (1)
add (letter (WordDecompile) of (answer)) to [Current Name v]
end
switch to costume []
go to x: (100) y: (0)
repeat (length of (Current Name)) 
end
repeat (length of [New Name v])
switch to costume (item [1 v] of [New Name v])
stamp
move (20) steps
delete [1 v] of [New Name v]
Please help where the repeat with nothing in it is, PLEASE!

Last edited by Vortex_ (2013-01-12 01:55:50)

Offline

 

#2 2013-01-12 05:13:51

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Word Scrambler Help

Sorry, I can't help you there, but here's a script that will scramble words as you want (it might inadvertently solve your problem):

when gf clicked
set [count v] to [1]
set [Scrambled Word v] to []
delete (all v) of [Word v]
delete (all v) of [Numbers v]
ask [Word to Scramble] and wait
repeat (length of (answer))
add (letter (Count) of (answer)) to [Word v]
add (Count) to [Numbers v]
change [Count v] by (1)
end
repeat (length of [Numbers v])
set [Random v] to (pick random (1) to (length of [Numbers v]))
set [Scrambled Word v] to (join (Scrambled Word)(item(item(Random) of [Numbers v]) of [Word v]))
delete (Random) of [Numbers v]
end
say (Scrambled Word)
I've tested this and it works, unless I misunderstood your problem. Hope this helps  smile

Last edited by PhirripSyrrip (2013-01-12 05:15:58)


http://i46.tinypic.com/ao03lk.png

Offline

 

#3 2013-01-12 05:34:42

chimoo5
New Scratcher
Registered: 2013-01-08
Posts: 18

Re: Word Scrambler Help

I just made a project to help you check out the script. It scrambles any word. I would normally scratch block with your variables but it is late and I think you can figure it out. If not let me know I would be glad to help.

http://scratch.mit.edu/projects/chimoo5/3033336

Offline

 

#4 2013-01-12 10:16:21

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Word Scrambler Help

chimoo5 wrote:

I just made a project to help you check out the script. It scrambles any word. I would normally scratch block with your variables but it is late and I think you can figure it out. If not let me know I would be glad to help.

http://scratch.mit.edu/projects/chimoo5/3033336

Sorry, but that doesn't work. Among other words, I tried "Cheesegrater" and after ten minutes on turbo mode, I've got nothing. Trust me, my script above works.


http://i46.tinypic.com/ao03lk.png

Offline

 

#5 2013-01-12 12:16:52

Vortex_
Scratcher
Registered: 2012-08-07
Posts: 13

Re: Word Scrambler Help

PhirripSyrrip wrote:

Sorry, I can't help you there, but here's a script that will scramble words as you want (it might inadvertently solve your problem):

when gf clicked
set [count v] to [1]
set [Scrambled Word v] to []
delete (all v) of [Word v]
delete (all v) of [Numbers v]
ask [Word to Scramble] and wait
repeat (length of (answer))
add (letter (Count) of (answer)) to [Word v]
add (Count) to [Numbers v]
change [Count v] by (1)
end
repeat (length of [Numbers v])
set [Random v] to (pick random (1) to (length of [Numbers v]))
set [Scrambled Word v] to (join (Scrambled Word)(item(item(Random) of [Numbers v]) of [Word v]))
delete (Random) of [Numbers v]
end
say (Scrambled Word)
I've tested this and it works, unless I misunderstood your problem. Hope this helps  smile

I can probably put my old scripts into this... Thanks!  smile

Offline

 

#6 2013-01-12 15:42:41

chimoo5
New Scratcher
Registered: 2013-01-08
Posts: 18

Re: Word Scrambler Help

PhirripSyrrip yeah your right it isn't doing it I was just trying it out. Thanks for catching it.

Offline

 

#7 2013-01-12 17:15:11

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: Word Scrambler Help

No problem  cool


http://i46.tinypic.com/ao03lk.png

Offline

 

Board footer