Thank you, Bert and Subbu.
However, I still think this simple naming rule is not so bad.
I applied this naming rule. And I also added code to enable allowEtoyUserCustomEvents automatically.
http://www.squeaksource.com/ScratchConnect.html
-- Koji
Koji Yokokawa wrote 11/05/25 12:13:
Thank you, Stephen.
I reconsider the naming rule of broadcast events. "broadcast:"+messageName is misleading. I'll remove the "broadcast:". So that the name of custom event name in Etoys is same as the broadcast name in Scratch.
Dispatching event for each change of variable may be overload for values changing continuously. I think that is better to broadcast "variableName" in Scratch as trigger to update the value in Etoys. It's natural for MVC model in Smalltalk too ;)
-- Koji
Steve Thomas wrote 11/05/25 0:57:
Totally cool. By setting that preference, the broadcast:* events are auto-magically populated in the "more ..." section of "when scripts should run" (although you need to broadcast at least once to see the event in the list)
Also another nice touch is that you also have the Scratch variable names as events, so you can trigger a script on change in "score" or any variable.
One possible confusion is that variable "custom events" are not pre-pended with anything, so if you create a variable in Scratch named "normal", you have a custom event called "normal" which could cause confusion.
Stephen
On Tue, May 24, 2011 at 11:36 AM, Bert Freudenberg <bert@freudenbergs.de mailto:bert@freudenbergs.de> wrote:
Ah, that preference is more specific. Even better :)
- Bert -
On 24.05.2011, at 17:22, Koji Yokokawa wrote:
Yes, a broadcast from Scratch will be converted to a custom event in
Etoys.
I forgot that the custom event is not available in default. Open
preferences from menu-halo of the world and search "etoy" to get "allowEtoyUserCustomEvents" in Etoys.
Koji
Bert Freudenberg wrote 11/05/24 21:10:
On 24.05.2011, at 13:57, Steve Thomas wrote:
On Sun, May 22, 2011 at 6:35 AM, Koji Yokokawa<ky@yengawa.com
mailto:ky@yengawa.com> wrote:
Try to receive messages from Scratch.
Couldn't figure out broadcasting from Scratch to Etoys. In
Scratch I broadcast "go". In Etoys I tried a script named "go" and one named "broadcastgo" but nothing happened in Etoys. One of your short simple videos would help ;)
I guess Koji-san meant to use a custom event to trigger the
script on the ScratchClient. The script name is irrelevant. If you disable "etoys friendly" you find "define a new custom event" in the "more..." submenu for the script trigger. That lets you define other triggers than "mouseDown", "mouseUp" etc. IIUC you need to name it "broadcast:go".
- Bert -
-- Koji Yokokawa <ky@yengawa.com mailto:ky@yengawa.com> http://www.yengawa.com/
etoys-dev mailing list etoys-dev@squeakland.org mailto:etoys-dev@squeakland.org http://lists.squeakland.org/mailman/listinfo/etoys-dev