Discuss Scratch

scratchnewbie16
New to Scratch
4 posts

URGENT HELP NEEDED PLEASE calculate max interval project

hi I am in desperate need of some advice!
please read below…

First create a script for the Stage to handle displaying a sign on the Stage. The script must respond when a message display is broadcast, so start by creating a hat block when_I_receive for this script.

This script will use a variable maxInterval which you need to create. Assume that when your script is run as part of the overall program, the value of maxInterval will already have been set to the maximum time interval. This time interval will be a positive decimal number.

In response to the message display, your script must display a sign which is a circle on the Stage that flashes three times, coloured according to the value of maxInterval as follows.
•A value for maxInterval greater than 4 indicates a possible significant health problem and, in this case, the flashing circle needs to be red.
•A value for maxInterval greater than 2 but not greater than 4 indicates a possible moderate health problem and, in this case, the flashing circle needs to be amber.
•A value for maxInterval no greater than 2 indicates no health problem and, in this case, the flashing circle needs to be green.

any screenshots and examples of how the blocks should be set up would be amazing!

thanks in advance
deck26
Scratcher
1000+ posts

URGENT HELP NEEDED PLEASE calculate max interval project

Sounds like this is all to be done with backdrops so you need a plain backdrop, one with a red circle, one with amber and one with green.

Then the broadcast receiver just switches backdrop according to the value of the variable.

when I receive [ v]  // insert the name for the broadcast
if <(maxInterval) > [4]> then
set [flash-costume v] to [2] // costume number for the red circle
else
if <(maxInterval) > [2]> then
you need to work out what to put here
else
you need to work out what to put here
end
repeat [3]
switch backdrop to (flash-costume)
wait [0.5] secs
switch backdrop to [1] // assuming first backdrop is one without sign
wait [0.5] secs
end
I've left you a minimal amout of work but if this is an assignment it is important that you understand how the code works and someone else just doing the work for you is not sensible.
scratchnewbie16
New to Scratch
4 posts

URGENT HELP NEEDED PLEASE calculate max interval project

Hi thank you for your reply! looking at the screenshot of the blocks you sent I realised I had posted the wrong part of the question! I have already done this part and the 3rd part. it was part 2 i was stuck on! please help if you can! thank you I will paste the question below

create a script for the Stage to handle recording the current time (in hours, minutes and seconds) and the maximum time interval in the text file EMAfile.txt. The script must respond when a message recordData is broadcast so start with a suitable hat block. It must respond by writing the current time and the value of maxInterval to the text file, as a single line, as in the example below.

12:43:27 maximum time interval is 0.955

Use the variable maxInterval and assume that when your new script is run as part of the overall program maxInterval will be already have been set to the maximum time interval.



deck26 wrote:

Sounds like this is all to be done with backdrops so you need a plain backdrop, one with a red circle, one with amber and one with green.

Then the broadcast receiver just switches backdrop according to the value of the variable.

when I receive [ v]  // insert the name for the broadcast
if <(maxInterval) > [4]> then
set [flash-costume v] to [2] // costume number for the red circle
else
if <(maxInterval) > [2]> then
you need to work out what to put here
else
you need to work out what to put here
end
repeat [3]
switch backdrop to (flash-costume)
wait [0.5] secs
switch backdrop to [1] // assuming first backdrop is one without sign
wait [0.5] secs
end
I've left you a minimal amout of work but if this is an assignment it is important that you understand how the code works and someone else just doing the work for you is not sensible.
deck26
Scratcher
1000+ posts

URGENT HELP NEEDED PLEASE calculate max interval project

Scratch doesn't write to text files so as per the similar topic by another user we cannot advise on that.

I do feel you really need to make some sort of attempt at this and ask for help with the bit(s) you can't do. If it's an assignment you are presumably expected to have the necessary knowledge and if you feel you don't there is presumably someone who you can speak to about that.
imrgoman
Scratcher
10 posts

URGENT HELP NEEDED PLEASE calculate max interval project

Powered by DjangoBB