LaboratoryForPlayfulComputation / blockytalky

A toolkit for learning CS through networked physical computing
BSD 2-Clause "Simplified" License
28 stars 7 forks source link

Add an Every __ Seconds do block #44

Open bennytheshap opened 8 years ago

bennytheshap commented 8 years ago

In _ seconds do once, fires once. I'm imagining a block that repeatedly does something, but that only does it every so often

mpahrens commented 8 years ago

Implementing this is super simple. You would just implement it exactly the same as In _ seconds do, but my only questions would be: Is there a block to be able to stop this callback event? and if so, how do we distinguish between multiple ones. For example:

start do
every_seconds 5, do
say "hello"
end
every_seconds 9, do
say "goodbye"
end
end
receive_message "stop saying hello" do

how do we stop? but leave the other one alone. Or does that matter?

end

bennytheshap commented 8 years ago

every_seconds 5, do say “yo dawg” until is_tired(dog)

On Aug 31, 2015, at 10:54 PM, Matthew Ahrens notifications@github.com wrote:

Implementing this is super simple. You would just implement it exactly the same as In \ seconds do_, but my only questions would be: Is there a block to be able to stop this callback event? and if so, how do we distinguish between multiple ones. For example:

start do

every_seconds 5, do

say "hello"

end

every_seconds 9, do

say "goodbye"

end

end

receive_message "stop saying hello" do

how do we stop? but leave the other one alone. Or does that matter?

end

— Reply to this email directly or view it on GitHub https://github.com/tufts-LPC/blockytalky_elixir/issues/44#issuecomment-136586457.

bennytheshap commented 8 years ago

Or even...

let thingie = every_seconds 5, do
   say "yo dawg"
end

#some_other_place
stop_doing thingie