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

#1 2012-01-27 19:23:34

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

no Fail

when clicked
forever
wait until
key
n
pressed?
if
nofail
=
on
set
nofail
to
off
if
nofail
=
off
set
nofail
to
on


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#2 2012-01-27 19:25:22

G0D_M0D3
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: no Fail

What would this do?


I made a MC texture pack! Get it at planetminecraft!
http://i.imgur.com/0EG0u.png

Offline

 

#3 2012-01-27 19:26:51

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: no Fail

im trying to have it so pressing n will toggle "NoFail mode"


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#4 2012-01-27 19:32:02

G0D_M0D3
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: no Fail

slayerrobe7 wrote:

im trying to have it so pressing n will toggle "NoFail mode"

And what would noFail mode do?


I made a MC texture pack! Get it at planetminecraft!
http://i.imgur.com/0EG0u.png

Offline

 

#5 2012-01-27 19:35:10

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: no Fail

G0D_M0D3 wrote:

slayerrobe7 wrote:

im trying to have it so pressing n will toggle "NoFail mode"

And what would noFail mode do?

Probably give you infinite health or something


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#6 2012-01-27 19:56:02

Magnie
Scratcher
Registered: 2007-12-12
Posts: 1000+

Re: no Fail

when clicked
set
switch
to
0
forever
wait until
key
n
pressed?
if
switch
=
1
set
switch
to
0
else
set
switch
to
1

Does that help?

Also, you need to put 'end' after each 'if' statement, like:

Code:

[scratchblocks]
when gf clicked
set [switch] to (0)
forever
    wait until <key [n v] pressed?>
    if <(switch)= (1)>
        set [switch] to (0)
    else 
        set [switch] to (1)
    end
end
[/scratchblocks]

Last edited by Magnie (2012-01-27 19:57:09)

Offline

 

#7 2012-01-27 20:11:01

slayerrobe7
Scratcher
Registered: 2011-06-24
Posts: 500+

Re: no Fail

awesome magnie thank you


!!!When it comes to Scratch2.0 I am totally like freaking out!!!

Offline

 

#8 2012-01-28 05:46:08

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: no Fail

There's an easier way to toggle a variable between 0 and 1, like so:  smile

when clicked
set
switch
to
0
forever
wait until
key
n
pressed?
set
switch
to
1
-
switch


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#9 2012-01-28 10:08:56

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: no Fail

JSO wrote:

There's an easier way to toggle a variable between 0 and 1, like so:  smile

when clicked
set
switch
to
0
forever
wait until
key
n
pressed?
set
switch
to
1
-
switch

That's pretty clever.  I probably would have wasted my time with modulus xD


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#10 2012-01-28 11:27:27

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: no Fail

To prevent it from switching back immediately, you may want to include

wait until
not
n
key pressed?

At the bottom of the forever loop.

Last edited by Kileymeister (2012-01-28 11:29:08)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#11 2012-01-28 12:17:14

hello12345678910
Scratcher
Registered: 2009-07-11
Posts: 100+

Re: no Fail

when clicked
set
switch
to
0
forever
wait until
key
n
pressed?
set
switch
to
1
-
switch
wait until
not
n
key pressed?


http://tinyurl.com/8yt32o9 http://tinyurl.com/6tgwp5r || Fish = F+I+S+H = 6+9+19+8 = 42<<The answer to Life, the Universe and Everything

Offline

 

#12 2012-01-28 12:27:39

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: no Fail

I know the problem.

Pretend it's on.
I turn it off.
It checks if it's off after it's off. Then it turns on.

when clicked
forever
wait until
key
n
pressed
if
nofail
=
off
set
nofail
to
on
else
set
nofail
to
off

Encountered two bugs while rendering the blocks.

Last edited by rdococ (2012-01-28 12:29:20)

Offline

 

#13 2012-01-28 13:50:34

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: no Fail

MoreGamesNow wrote:

JSO wrote:

There's an easier way to toggle a variable between 0 and 1, like so:  smile

when clicked
set
switch
to
0
forever
wait until
key
n
pressed?
set
switch
to
1
-
switch

That's pretty clever.  I probably would have wasted my time with modulus xD

I figured that out too. xP
It can actually be used to toggle between any value and 0. I used this for Snake Eyes:

set volume to
100
-
volume
%
for the sound button

Last edited by scimonster (2012-01-28 13:51:55)

Offline

 

#14 2012-01-28 14:03:12

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: no Fail

scimonster wrote:

MoreGamesNow wrote:

JSO wrote:

There's an easier way to toggle a variable between 0 and 1, like so:  smile

when clicked
set
switch
to
0
forever
wait until
key
n
pressed?
set
switch
to
1
-
switch

That's pretty clever.  I probably would have wasted my time with modulus xD

I figured that out too. xP
It can actually be used to toggle between any value and 0. I used this for Snake Eyes:

set volume to
100
-
volume
%
for the sound button

It can actually be used to toggle between any two values, provided that you start on one of them and you have the correct values implemented.

I.E., between 1 and 2, start it on one of those values and do (3-value).

Last edited by Kileymeister (2012-01-28 14:03:57)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#15 2012-01-29 13:04:00

KrIsMa
Scratcher
Registered: 2011-09-20
Posts: 500+

Re: no Fail

Remember to make it wait...

whenclicked
Forever
Wait until
key
n
pressed?
If
switch
=
0
Set
switch
to
1
Wait
0.5
secs
Else
Set
switch
to
0
Wait
0.5
secs

Last edited by KrIsMa (2012-01-29 13:15:10)


http://blocks.scratchr.org/API.php?user=KrIsMa&amp;action=onlineStatus&amp;online=http://i49.tinypic.com/2pzic0m.png&amp;offline=http://i49.tinypic.com/r7p10n.png
The Scratch Team (and fellow scratchers!) is/are so nice!!!

Offline

 

#16 2012-01-29 13:12:51

rdococ
Scratcher
Registered: 2009-10-11
Posts: 1000+

Re: no Fail

when clicked
forever
wait until
key
n
pressed?
wait until
not
key
n
pressed?
if
nofail
=
off
set
nofail
to
on
else
set
nofail
to
off

Just wanted to update my script.

Offline

 

#17 2012-01-29 13:16:24

KrIsMa
Scratcher
Registered: 2011-09-20
Posts: 500+

Re: no Fail

rdococ wrote:

when clicked
forever
wait until
key
n
pressed?
wait until
not
key
n
pressed?
if
nofail
=
off
set
nofail
to
on
else
set
nofail
to
off

Just wanted to update my script.

Or you can use my script. But this is better XD


http://blocks.scratchr.org/API.php?user=KrIsMa&amp;action=onlineStatus&amp;online=http://i49.tinypic.com/2pzic0m.png&amp;offline=http://i49.tinypic.com/r7p10n.png
The Scratch Team (and fellow scratchers!) is/are so nice!!!

Offline

 

#18 2012-08-21 16:28:19

HabaDB
Scratcher
Registered: 2012-08-17
Posts: 14

Re: no Fail

sound toggle how-to?

Offline

 

#19 2012-08-21 19:07:55

bob6
Scratcher
Registered: 2010-07-01
Posts: 100+

Re: no Fail

HabaDB wrote:

sound toggle how-to?

*sigh* they just posted it on the above posts. Read before you post!

I'll just post it again here:

scimonster wrote:

It can actually be used to toggle between any value and 0. I used this for Snake Eyes:

set volume to
100
-
volume
%
for the sound button


http://i46.tinypic.com/3148ksz.gif

Offline

 

#20 2012-08-22 00:11:47

KrIsMa
Scratcher
Registered: 2011-09-20
Posts: 500+

Re: no Fail

bob6 wrote:

HabaDB wrote:

sound toggle how-to?

*sigh* they just posted it on the above posts. Read before you post!

I'll just post it again here:

scimonster wrote:

It can actually be used to toggle between any value and 0. I used this for Snake Eyes:

set volume to
100
-
volume
%
for the sound button

And the second to last please do not necropost that would be appreciated.

And this is the wrong thread to post the question under.

Last edited by KrIsMa (2012-08-22 00:12:44)


http://blocks.scratchr.org/API.php?user=KrIsMa&amp;action=onlineStatus&amp;online=http://i49.tinypic.com/2pzic0m.png&amp;offline=http://i49.tinypic.com/r7p10n.png
The Scratch Team (and fellow scratchers!) is/are so nice!!!

Offline

 

Board footer