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

#1 2012-09-26 17:59:11

Bricklink101
Scratcher
Registered: 2011-10-23
Posts: 34

Need Help!!! Toggle Switch Wont Ever Work

UGH! Im trying to make a stupid toggle switch but it NEVER WORKS. It sets it to false when the flag is clicked, and it sets it to true when you click it perfectly fine. But then when you try to switch it back to false it switches right back! IVE BEEN TRYING TO GET IT TO WORK FOR HOURS!

Heres the script:

when GridToggle clicked
if <(grid) = [True]>
 set (grid) to false
end
wait 0.5 secs
if <(grid) = [False]>
 set (grid) to true
end
wait 0.5 sec


I cant think of anything to put here...  hmm

Offline

 

#2 2012-09-26 18:03:22

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Need Help!!! Toggle Switch Wont Ever Work

Upload please


Why

Offline

 

#3 2012-09-26 18:16:49

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Need Help!!! Toggle Switch Wont Ever Work

Bricklink101 wrote:

UGH! Im trying to make a stupid toggle switch but it NEVER WORKS. It sets it to false when the flag is clicked, and it sets it to true when you click it perfectly fine. But then when you try to switch it back to false it switches right back! IVE BEEN TRYING TO GET IT TO WORK FOR HOURS!

Heres the script:

when [GridToggle v] clicked
if <(grid) = [True]>
 set (grid) to [false]
end
wait (0.5) secs
if <(grid) = [False]>
 set (grid) to [true]
end
wait (0.5) secs

Fixed.


http://i46.tinypic.com/35ismmc.png

Offline

 

#4 2012-09-26 18:44:05

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: Need Help!!! Toggle Switch Wont Ever Work

it doesnt work because if the grid is true, it is then set to false; because it is false it is then set back to true by the second part of the script. you need this

when [GridToggle v] clicked
if <(grid) = [true]>
set [grid v] to [false]
else
set [grid v] to [true]
end


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

Board footer