Please see inline: On December 9, 2004 04:05 pm, Arvind S. Grover wrote:
I have tried posting these in the forum, but it seems that no one is really looking there, so I am going to post them here:
- i am trying to embed a text box into a painted object so that it
looks and acts like one object. basically i want to be able to pick up and move the item as one, but still be able to script the textbox's behavior. i am have tried the embed action, but it only says i can embed into "world." any ideas?
I assume your painted object has just lines or lots of "empty" areas - the problem is that you have to position your text box "just right" over some painted area of the painted object for the "embed into PaintedObject" to appear in the text box's menu. I had the same problem but it can be done with a bit of trying...
- What is the best way to "listen" for keystrokes? Example: the user
hits the left arrow key and the object moves to the left.
I don;t think there is a "default" eToy way to ask a Morph to respond to keystrokes - someone on this list (I forgot who it was, appologize for it) sent me the attached. If you install it, you will see in the "viewer" under "tests" "MyObjects 's key hit a". You can put it in a scropt, but you have to textually edit it to allow control by keys. Som,ething like:
turnWithArrows (self wasCharacterHit: Character arrowUp) ifTrue: [self setHeading: 0.0]. (self wasCharacterHit: Character arrowRight) ifTrue: [self setHeading: 90.0]. (self wasCharacterHit: Character arrowDown) ifTrue: [self setHeading: 180.0]. (self wasCharacterHit: Character arrowLeft) ifTrue: [self setHeading: 270.0].
Hope this is what you were asking for - let me know if you need help with this,
Milan
Squeakland mailing list Squeakland@squeakland.org http://squeakland.org/mailman/listinfo/squeakland
On Saturday 11 December 2004 5:45 pm, Milan Zimmermann wrote:
I don;t think there is a "default" eToy way to ask a Morph to respond to keystrokes - someone on this list (I forgot who it was, appologize for it) sent me the attached. If you install it, you will see in the "viewer" under "tests" "MyObjects 's key hit a". You can put it in a scropt, but you have to textually edit it to allow control by keys. Som,ething like:
turnWithArrows (self wasCharacterHit: Character arrowUp) ifTrue: [self setHeading: 0.0]. (self wasCharacterHit: Character arrowRight) ifTrue: [self setHeading: 90.0]. (self wasCharacterHit: Character arrowDown) ifTrue: [self setHeading: 180.0]. (self wasCharacterHit: Character arrowLeft) ifTrue: [self setHeading: 270.0].
Hope this is what you were asking for - let me know if you need help with this,
My Etoy keystroke support has been added to the 3.8 update stream (from my Squeakland work).
However, it's broken right now. I just posted a separate [FIX] for the keyStroke event in the World (which is missing right now); you'll need it as well.
There are two parts to this support:
* The World has a String-valued property called 'lastKeystroke'. This is a string that holds the keystroke, in a form that can be used in string comparisons, like:
'a' '<left>' '<Ctrl-left>'
This works OK now; you can have a ticking script (for instance) testing the lastKeystroke property. But you may very well miss one, unless you use the other part:
* You can trigger a script that is owned by the World on a 'keyStroke' event. You do this by clicking on the 'when this script should run' button, and choosing 'more' and then 'keyStroke'. This is the part that is currently broken.
Anyway, with these two features you can do something like the script pictured in the attached image, which moves a Rectangle around by keyboard command.
Ned,
That is cool, BTW did you write the cs I attached to my last message (and that has been eaten by the list I just found, so re-attaching it). Someone on the list sent it to me, I forgot who, and was lazy to search. Yours is probably more integrated in the viewer (I mean the <down> etc), in the attached that I use I do not know how to do script non-textual. Thanks Milan
On December 14, 2004 04:37 pm, Ned Konz wrote:
On Saturday 11 December 2004 5:45 pm, Milan Zimmermann wrote:
I don;t think there is a "default" eToy way to ask a Morph to respond to keystrokes - someone on this list (I forgot who it was, appologize for it) sent me the attached. If you install it, you will see in the "viewer" under "tests" "MyObjects 's key hit a". You can put it in a scropt, but you have to textually edit it to allow control by keys. Som,ething like:
turnWithArrows (self wasCharacterHit: Character arrowUp) ifTrue: [self setHeading: 0.0]. (self wasCharacterHit: Character arrowRight) ifTrue: [self setHeading: 90.0]. (self wasCharacterHit: Character arrowDown) ifTrue: [self setHeading: 180.0]. (self wasCharacterHit: Character arrowLeft) ifTrue: [self setHeading: 270.0].
Hope this is what you were asking for - let me know if you need help with this,
My Etoy keystroke support has been added to the 3.8 update stream (from my Squeakland work).
However, it's broken right now. I just posted a separate [FIX] for the keyStroke event in the World (which is missing right now); you'll need it as well.
There are two parts to this support:
- The World has a String-valued property called 'lastKeystroke'. This is a
string that holds the keystroke, in a form that can be used in string comparisons, like:
'a' '<left>' '<Ctrl-left>'
This works OK now; you can have a ticking script (for instance) testing the lastKeystroke property. But you may very well miss one, unless you use the other part:
- You can trigger a script that is owned by the World on a 'keyStroke'
event. You do this by clicking on the 'when this script should run' button, and choosing 'more' and then 'keyStroke'. This is the part that is currently broken.
Anyway, with these two features you can do something like the script pictured in the attached image, which moves a Rectangle around by keyboard command.
On Tuesday 14 December 2004 6:55 pm, Milan Zimmermann wrote:
That is cool, BTW did you write the cs I attached to my last message (and that has been eaten by the list I just found, so re-attaching it). Someone on the list sent it to me, I forgot who, and was lazy to search.
That was written by Scott Wallace.
Yours is probably more integrated in the viewer (I mean the <down> etc), in the attached that I use I do not know how to do script non-textual.
I had to add the representation for the control keys, etc. since that's what a lot of people will want to use.
And making it a String-valued property gives us the tests.
A prior version of mine had used numbers instead, but it was harder to use.
Ned, Thanks for the description. I will try the changeset in our game over the next few weeks, Milan
On December 15, 2004 04:08 pm, Ned Konz wrote:
On Tuesday 14 December 2004 6:55 pm, Milan Zimmermann wrote:
That is cool, BTW did you write the cs I attached to my last message (and that has been eaten by the list I just found, so re-attaching it). Someone on the list sent it to me, I forgot who, and was lazy to search.
That was written by Scott Wallace.
Yours is probably more integrated in the viewer (I mean the <down> etc), in the attached that I use I do not know how to do script non-textual.
I had to add the representation for the control keys, etc. since that's what a lot of people will want to use.
And making it a String-valued property gives us the tests.
A prior version of mine had used numbers instead, but it was harder to use.
squeak-dev@lists.squeakfoundation.org