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

#1 2007-05-31 17:34:36

UncleBits
Scratcher
Registered: 2007-05-31
Posts: 2

inconsistent Math block performance?

Hello folks,
  I'm writing a simple math tutorial for a nephew.  In summary, it generates two random variables and three possible answers, of which only one is correct.  But for some reason when I use any of the math blocks, I get incorrect answers.  And to add salt to the wound, when I make a simple script with only two variables, the math blocks work correctly.
  So the tutorial script is consistently wrong and the quickie test script works.  I've tried stepping through single lines but it doesn't reveal any more than the appropriate math block is reached but the answer is incorrect.
  I've posted the script as 'Math Tutor' by UncleBits.  Any help would be greatly appreciated.

Thanks,
Uncle Bits

Offline

 

#2 2007-05-31 20:28:00

weissjd
Scratcher
Registered: 2007-05-16
Posts: 64

Re: inconsistent Math block performance?

Uncle Bits,

You're close, you just have a couple of issues. First, when you broadcast gianniNumber and horstNumber in your main script, change that to a broadcast and wait. That will ensure that the numbers are set before you try to calculate the answer.

There's one other issue I ran into after I made that change. When your answering sprites receive the answer broadcast the one that answers correctly needs to set myGuess=Answer so that the script will correctly inform the player when he chooses the right answer.

Good luck with it, it looks great.

Offline

 

Board footer