I am working on learning squeak and want to know how to create a scripting tile for use in Etoys.
Thanks, Stephen
On Monday 14 Feb 2011 2:07:53 am Steve Thomas wrote:
I am working on learning squeak and want to know how to create a scripting tile for use in Etoys.
Bring up Etoys (scripting tool) for a morph by clicking on the 'eye' halo icon. You will get a flap containing property and command tiles for that morph. You can drag the "empty script" tile into the world to get an empty scriptor. Or drag any desired property/command tile from this flap and drop it into the world and a scriptor will automatically be created around this tile. You may drop further tiles from Etoys flap into this script to build a sequence of tiles.
While scripting, you may find it useful to keep "All Scripts" (controls running of scripts) and "Players" morph (list of morphs with scripts) around.
Also see http://www.squeakland.org/tutorials/
Subbu
Subbu,
Thanks perhaps I should have been clearer in my question, I want to know how to create my own "property/command tile". For example I want to create a new morph to create a number line object. I would like to add a new "category" (ie: like collections for a playfield) for my number line and add property tiles that can be dragged from the viewer into the script.
Stephen
On Sun, Feb 13, 2011 at 8:39 PM, K. K. Subramaniam kksubbu.ml@gmail.comwrote:
On Monday 14 Feb 2011 2:07:53 am Steve Thomas wrote:
I am working on learning squeak and want to know how to create a
scripting
tile for use in Etoys.
Bring up Etoys (scripting tool) for a morph by clicking on the 'eye' halo icon. You will get a flap containing property and command tiles for that morph. You can drag the "empty script" tile into the world to get an empty scriptor. Or drag any desired property/command tile from this flap and drop it into the world and a scriptor will automatically be created around this tile. You may drop further tiles from Etoys flap into this script to build a sequence of tiles.
While scripting, you may find it useful to keep "All Scripts" (controls running of scripts) and "Players" morph (list of morphs with scripts) around.
Also see http://www.squeakland.org/tutorials/
Subbu
Okay I partially figured this out and was able to add a scripting tile to my own category.
In the class additionsToViewerCategoryFraction I added a "slot" using:
(slot st1 'The quantity of Steve parts' Number readWrite Player getMajorTicks Player setMajorTicks:)
The part I was missing was I had to to Etoys-Scripting Player the getMajorTicks and setMajorTicks Methods.
I also found I can use command instead of slot.
Thanks, Stephen
On Mon, Feb 14, 2011 at 12:04 AM, Steve Thomas sthomas1@gosargon.comwrote:
Subbu,
Thanks perhaps I should have been clearer in my question, I want to know how to create my own "property/command tile". For example I want to create a new morph to create a number line object. I would like to add a new "category" (ie: like collections for a playfield) for my number line and add property tiles that can be dragged from the viewer into the script.
Stephen
On Sun, Feb 13, 2011 at 8:39 PM, K. K. Subramaniam kksubbu.ml@gmail.comwrote:
On Monday 14 Feb 2011 2:07:53 am Steve Thomas wrote:
I am working on learning squeak and want to know how to create a
scripting
tile for use in Etoys.
Bring up Etoys (scripting tool) for a morph by clicking on the 'eye' halo icon. You will get a flap containing property and command tiles for that morph. You can drag the "empty script" tile into the world to get an empty scriptor. Or drag any desired property/command tile from this flap and drop it into the world and a scriptor will automatically be created around this tile. You may drop further tiles from Etoys flap into this script to build a sequence of tiles.
While scripting, you may find it useful to keep "All Scripts" (controls running of scripts) and "Players" morph (list of morphs with scripts) around.
Also see http://www.squeakland.org/tutorials/
Subbu
On Monday 14 Feb 2011 4:49:33 pm Steve Thomas wrote:
In the class additionsToViewerCategoryFraction I added a "slot" using:
(slot st1 'The quantity of Steve parts' Number readWrite Player getMajorTicks Player setMajorTicks:)
The part I was missing was I had to to Etoys-Scripting Player the getMajorTicks and setMajorTicks Methods.
I also found I can use command instead of slot.
slot refers to property values and you need getter methods (for ReadOnly) and getter/setter for ReadWrite property. command refers to actions. In your methods, you can access the morph involved in the player using: self costume renderedMorph
The tricky part is that you have to choose unique names for slots, commands, getters and setters. This is because Player uses a flat name space for all slot/command names and methods. This may look simple, but you could have packages loaded from outside that could introduce name clashes.
BTW, I mistook you for another Steve in my earlier reply. Sorry.
Subbu
On Mon, Feb 14, 2011 at 10:41 PM, K. K. Subramaniam kksubbu.ml@gmail.comwrote:
On Monday 14 Feb 2011 4:49:33 pm Steve Thomas wrote:
In the class additionsToViewerCategoryFraction I added a "slot" using:
(slot st1 'The quantity of Steve parts' Number readWrite Player getMajorTicks Player setMajorTicks:)
The part I was missing was I had to to Etoys-Scripting Player the getMajorTicks and setMajorTicks Methods.
I also found I can use command instead of slot.
slot refers to property values and you need getter methods (for ReadOnly) and getter/setter for ReadWrite property. command refers to actions. In your methods, you can access the morph involved in the player using: self costume renderedMorph
The tricky part is that you have to choose unique names for slots, commands, getters and setters. This is because Player uses a flat name space for all slot/command names and methods. This may look simple, but you could have packages loaded from outside that could introduce name clashes.
So do all names have to be unique or the category/name combination?
BTW, I mistook you for another Steve in my earlier reply. Sorry.
There's another?!? ;)
Subbu
Thanks!!!
beginners@lists.squeakfoundation.org