Discuss Scratch

jamie1010
New to Scratch
16 posts

Any help please!

Hi guys,

I am halfway through a script (attached). Is my broadcast soundAlarm section set up correctly?

http://postimg.org/image/5kidhqwdh/

Now I have the following text, can anyone help please?

'When your completed program runs, it will use the in-built Scratch timer to time the duration of each interval. If the timer value exceeds 10 seconds, then the Stage color must be set to green (because more than 10 seconds have elapsed since the last movement).

Create a script to handle this aspect of the program. In response to a message ‘checkTimer’ it must repeatedly check the value of the timer and the color of the Stage. If the value of the timer is greater than 10 and the Stage is not already green then the Stage must be be set to green. This checking must carry on indefinitely, only stopping when the program is stopped.


I should be able to test this script by running it with different values for ‘timer’ (place a watcher for ‘timer’ on the stage) and with different Stage backgrounds. Use the blocks reset_timer and swtich_to_background to control the ‘timer’ value and the Stage background respectively.

I stress that this work is not being marked and is for my personal education, thank for you helping.
J
Gandalf1023
Scratcher
100+ posts

Any help please!

The link doesn't work…

http://postimg.org/image/5kidhqwdh/

Just seeing if that works…



Do you want to know a secret? I was the evil kumquat who ate all your signatures.
Gandalf1023
Scratcher
100+ posts

Any help please!

Gandalf1023 wrote:

The link doesn't work…

http://postimg.org/image/5kidhqwdh/

Just seeing if that works…

Yeah, that works, I'll check it out.



Do you want to know a secret? I was the evil kumquat who ate all your signatures.
jamie1010
New to Scratch
16 posts

Any help please!

Thanks Gandalf,

Can anyone please help with timer task outlined above?

Thanks
J
RPFluffy
Scratcher
1000+ posts

Any help please!

Add a wait 0 secs before the broadcast because your script is like many scripts that have broadcasts and ifs goes too fast.

Nothing Is EVER 100%, that is just an assumption.















Some important links: Here and here or need help click Here. Eats followers, Loves helping people.
My “..” and “…” are not spelling mistakes, it means that they are ways of telling someone that I can continue more about it and that the sentence isn't ended the best way. I like putting new indents and lines so I can split up what I am talking about.




































Some important links: Here and here or need help click Here. Eats followers, Loves helping people. Check this MMO out! Kiwi = Support WHAT THAT'S IMPOSSIBLE: Through the drop down ;)
if <> :: control cstart

else :: control
end
jamie1010
New to Scratch
16 posts

Any help please!

Thanks for your help.

Please can someone help me with this part as it is holding up my project:

'When your completed program runs, it will use the in-built Scratch timer to time the duration of each interval. If the timer value exceeds 10 seconds, then the Stage color must be set to green (because more than 10 seconds have elapsed since the last movement).

Create a script to handle this aspect of the program. In response to a message ‘checkTimer’ it must repeatedly check the value of the timer and the color of the Stage. If the value of the timer is greater than 10 and the Stage is not already green then the Stage must be be set to green. This checking must carry on indefinitely, only stopping when the program is stopped.



I should be able to test this script by running it with different values for ‘timer’ (place a watcher for ‘timer’ on the stage) and with different Stage backgrounds. Use the blocks reset_timer and swtich_to_background to control the ‘timer’ value and the Stage background respectively.


Thank you
J
Theprodigy
Scratcher
100+ posts

Any help please!

What do you need help with exactly. With regards to the timer and background color your code would look something like this:
if <<(timer) > (10)> and <not<(backdrop name) = [green backdrop]>>>then
switch backdrop to [green backdrop v]
end
jamie1010
New to Scratch
16 posts

Any help please!

Theprodigy wrote:

What do you need help with exactly. With regards to the timer and background color your code would look something like this:
if <<(timer) > (10)> and <not<(backdrop name) = [green backdrop]>>>then
switch backdrop to [green backdrop v]
end

Hi,

This is to follow on from my above script (attached by Gandalf above). For your information, this is the project in its entirety:

Many foreign hikers in Nepal start their trip at a small village in the Himalaya. Despite its popularity, the village is only accessible on a single road which is the only way of transporting people, food and fuel. For part of the route, the road runs below a glacier flowing down from the High Himalaya. In summer, the melting glacier regularly sheds thousands of tonnes of ice and rock on to the road. These icefalls can block the road and have, in the past, caused serious injuries and deaths.

Geologists have noticed that icefalls are preceded by small, abrupt movements in the glacier as the ice begins to crack and crumble. The frequency of movements increases shortly before an icefall and could act as a warning. The geologists’ measurements have produced some broad guidelines of how safe it is to travel below the glacier.

If more than 10 seconds elapse between movements, the glacier is safe and there is a low risk of an icefall on to the road.
If the time between movements is between 5 seconds and 10 seconds (inclusive) then there is a moderate risk of an icefall. Only essential traffic should continue along the road. If the time between movements is less than 5 seconds then the risk of an icefall is high and no one should attempt to make the journey below the glacier. Ubiquitous technologies could help improve the safety of the road. Networked motion sensors inside the glacier could report movements to a computer inside an electronic warning sign placed alongside the road, just before the glacier. The sign will show one of three colours:

green if there is a low risk of an icefall
orange if there is a moderate risk of an icefall
red if there is a high risk of an icefall.
In addition, an audible alarm will be sounded whenever the interval between the most recent pair of movements is shorter than the interval between the preceding pair of movements, to alert travellers that the risk is increasing.

When the program is run the user will simulate each ice movement by pressing the SenseBoard button. The program will time the intervals between successive button presses and set the Stage background according to the risk guidelines above. In addition, an audible alert will be sounded whenever an interval is immediately followed by a shorter interval.

In each of Parts 1-4 you will create a single script. The script in Part 4 will control the execution of each of the preceding scripts, by sending appropriate broadcast messages. You do not need to consider how the scripts will interact until you come to Part 4.


I have completed Part 1 & 2. Part 3 is this:

'When your completed program runs, it will use the in-built Scratch timer to time the duration of each interval. If the timer value exceeds 10 seconds, then the Stage color must be set to green (because more than 10 seconds have elapsed since the last movement).

Create a script to handle this aspect of the program. In response to a message ‘checkTimer’ it must repeatedly check the value of the timer and the color of the Stage. If the value of the timer is greater than 10 and the Stage is not already green then the Stage must be be set to green. This checking must carry on indefinitely, only stopping when the program is stopped.

I should be able to test this script by running it with different values for ‘timer’ (place a watcher for ‘timer’ on the stage) and with different Stage backgrounds. Use the blocks reset_timer and swtich_to_background to control the ‘timer’ value and the Stage background respectively.
Theprodigy
Scratcher
100+ posts

Any help please!

What does your broadcast SoundAlarm do? It looks like you broadcast SoundAlarm and then sound the alarm in the code immediately following the broadcast.
Also, what do you need help with in Part 3 because your code, at a glance, looks fine?

Powered by DjangoBB