I an making a binary-octal-decimal converter and the broadcast doesn't work. This is how I have my script:
Part 1: The "Generate" button:[blocks]
<when green flag clicked>
<forever>
<wait until><< <mouse down?> <and> <touching[ mouse-pointer ] >>
<broadcast[ generate ]>
<wait until><< <not> <mouse down?> >>
<end>[/blocks]
Part 2: The Generator:[blocks]
<when I receive[ generate ]>
<repeat( 3 )>
<if><( <{ }> <<> 3 )>
<repeat( 3 )>
add <pick random( 0 )to( 1 )) to binary (when blocks made, nonexistent)
<end>
<change{ }by( 1 ) ))
<end>
<end>[/blocks]
Help wanted!
Last edited by scratchisthebest (2009-06-07 12:04:10)
Offline
I Suggest You Blow Up The Computer.
Offline
Kiladako-T19 wrote:
I Suggest You Blow Up The Computer.
I don't think that would give positive results...
Offline
use when <when[ spritename ]clicked> instead to deteck the click. probably the loop take all the cpu time and doesnt let the generator to run...
Offline
Good idea... but I can click after I press the stop button. So I abandoned it. But good idea there!
The loop and the generator run in separate threads, but since there is only one CPU-just one can execute at a time.
I put it in the code box because it's techy.
Last edited by scratchisthebest (2009-06-07 11:57:27)
Offline
scratchisthebest wrote:
Good idea... but I can click after I press the stop button. So I abandoned it. But good idea there!
Code:
The loop and the generator run in separate threads, but since there is only one CPU-just one can execute at a time.I put it in the code box because it's techy.
Are you talking about when using scratch 1.4 or 1.3.1?
Offline
Nevermind. The problem is I forgot these blocks:
[blocks]<set{ }to( 0 ))[/blocks]
and
clear [ all ] of [ binary ]
. Close please!
Offline