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

#1 2012-01-10 20:24:29

imsosuperswell1
Scratcher
Registered: 2010-12-04
Posts: 1000+

Password Script

In Scratch Project, I notice some people have a project and when you win you get a password. Then you go to the next part and type in the password to keep playing. What kind of script is that?


http://i43.tinypic.com/34y3brb.png

Offline

 

#2 2012-01-10 20:47:39

PythonDreamer
New Scratcher
Registered: 2012-01-08
Posts: 64

Re: Password Script

First you would have the sprite broadcast something and then you'd use this: <when I receive[   <say[  ]for(  )secs> and type in the password and the amount of secs the sprite says the password for. Then you'd do this: <when I receive[ then add the "ask _________" block found in Sensing, type in the question (ex. What's the Password?) then do: <when green flag clicked> <forever> <if> <else> <end> now get the answer block which is shaped like a slightly squashed hexagon (found in Sensing) and drag it into <(  <=>  )> then type in the correct password in the circle to the right of the block, now add it to the squashed hexagon in the <if><else><end> block and add <broadcast[  to the <if> part. Now put <say[  ]for(  )secs>  in the <else><end> part and your done! Just make the game continue when the game receives the last broadcast. Also fill in the blank parts for the actual programming blocks.

I'm sorry if this wasn't helpful.

Offline

 

#3 2012-01-10 20:52:43

PythonDreamer
New Scratcher
Registered: 2012-01-08
Posts: 64

Re: Password Script

PythonDreamer wrote:

First you would have the sprite broadcast something and then you'd use this: <when I receive[   <say[  ]for(  )secs> and type in the password and the amount of secs the sprite says the password for. Then you'd do this: <when I receive[ then add the "ask _________" block found in Sensing, type in the question (ex. What's the Password?) then do: <when green flag clicked> <forever> <if> <else> <end> now get the answer block which is shaped like a slightly squashed hexagon (found in Sensing) and drag it into <(  <=>  )> then type in the correct password in the circle to the right of the block, now add it to the squashed hexagon in the <if><else><end> block and add <broadcast[  to the <if> part. Now put <say[  ]for(  )secs>  in the <else><end> part and your done! Just make the game continue when the game receives the last broadcast. Also fill in the blank parts for the actual programming blocks.

I'm sorry if this wasn't helpful.

Wait, I think I can add stuff inside the blocks. Can I? Also, maybe you're thinking of something else...

Offline

 

#4 2012-01-10 21:04:04

Bsteward
Scratcher
Registered: 2010-04-13
Posts: 100+

Re: Password Script

Have a list of all of the password to their corresponding level. To give the password when somebody has beat the level, recall the level's password from the list. When a password is entered look for it in the list and set the level to the location of the password in the list. You can look at the scripts in the game I made that uses this called Swirl World. I hope this helps.


Interested in the future of Scratch?http://ffs.us.to/1.png
http://i40.tinypic.com/2i9jejd.jpgIt has http://bit.ly/Ol3MfD views. Click to add one more!

Offline

 

#5 2012-01-10 23:10:27

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Password Script

or, nitezscratch is awesome like that and has a more creative way

it has it's stats set to a password. it's not very safe though, but it's fun.

Anyways, just make it so when the retrieve their password, you tell them a different one per level (the best ones are randomly generated with just one number in there or something) and then when the next game comes, you ask if they want to put in a password and if they put in the password for a certain level, you take them to the level.

Offline

 

#6 2012-01-11 04:05:12

Liru
Scratcher
Registered: 2012-01-11
Posts: 1000+

Re: Password Script

There's many ways to do this, you need to know before hand that you want it to save and load like this though.

You just need something along the lines of this:
[blocks]
<when green flag clicked><ask password?>(couldn't find the ask block)<set{ Attempt }to( answer )<if ( Attempt <=> Password )> (Do whatever here) <end>

[/blocks]

First time using blocks and there's no preview on the quick editor, and seeming I can't edit what I post if anything's wrong then it's going to stay that way.

Offline

 

#7 2012-01-12 14:00:19

muppetds
Scratcher
Registered: 2011-02-11
Posts: 1000+

Re: Password Script

It is a good idea to remove the pass before you share


SCRATCH'S PARTLY INSANE RESIDENT 
http://internetometer.com/imagesmall/31691.pnghttp://bluetetrarpg.x10.mx/usercard/?name=muppetds

Offline

 

#8 2012-01-12 22:08:37

kayybee
Scratcher
Registered: 2009-12-07
Posts: 1000+

Re: Password Script

muppetds wrote:

It is a good idea to remove the pass before you share

Uh... why?

the whole point is to use it in the project, not to get rid of it...

Offline

 

#9 2012-01-13 08:21:04

wmays
Scratcher
Registered: 2008-05-10
Posts: 500+

Re: Password Script

kayybee wrote:

muppetds wrote:

It is a good idea to remove the pass before you share

Uh... why?

the whole point is to use it in the project, not to get rid of it...

I think he meant a password that you have to have to VIEW the project.
@muppetds- We mean a password that is used inside the project so that people can't just pick any level.


http://i42.tinypic.com/2z5vcz9.gif
http://phpscripthost.comoj.com/imagescripts/ipimg.php

Offline

 

#10 2012-01-14 08:59:09

SJRCS_011
Scratcher
Registered: 2011-02-07
Posts: 1000+

Re: Password Script

Also, you may want to put the password script in a hidden sprite.


http://i.imgur.com/vQqtH.png
Learning to Program in a Nutshell:  "You're missing a closing parentheses" - LS97

Offline

 

Board footer