[Newbies] RE: KeyPress On World of Squeak Wonderland (was: Disappointed)

Jeff hombreviii at myway.com
Wed Nov 8 18:43:58 UTC 2006


 
Thanks Ron,There's some good info. in there. Unfortunately, scene doesn't have respondWith: to: method, but I might be able to find a workaround. One method I was trying to use in the past was to create a script from tiles, and have that script always ticking and just send the helicopter the command to move in response to the world's last keystroke. I couldn't get the script to find the helicopter at all, and have been having trouble with going from one workspace to another attempting to refer to the same thing, and also with the differences between tile scripts and workspace scripts, for some reason they don't act the same and I'm not sure why. Even when I tried creating a class MyWonderland with instance variables | wonder copter |, I couldn't figure out how to get a method to understand what 'copter' was and pass messages to it other than the one that created it. Also related, when I define jump as jumpup := wonder helicopter move:#up.I still don't know exactly how to make 
this method do this again. I've tried World jumpup. jumpup. wonder helicopter jumpup. but only jumpup loop. seems to work, and again only from the particular workspace I defined it in. I know all of this is related somehow. Anyone got a hint? --- On Wed 11/08, Ron Teitelbaum < Ron at USMedRec.com > wrote:From: Ron Teitelbaum [mailto: Ron at USMedRec.com]To: hombreviii at myway.com, beginners at lists.squeakfoundation.orgDate: Wed, 8 Nov 2006 11:07:48 -0500Subject: KeyPress On World of Squeak Wonderland (was: Disappointed)Hi Jeff, Welcome to the beginners list! I appreciate the fact that you aresticking with the problem.  That in my opinion is the best way to learn.  Ididn’t answer your question because I do not feel that I am an expert inWonderland.  If the question was something like how can I map a key to sosome action that is pretty easy, IF that action is an isolated easily calledmethod.  Something like: Utilities garbageCollectAndReport.  This isa class method and there is no 
instance that needs to be sent to.   If a key stroke needs to be captured and affecta running instance it is a bit more difficult to do but still very possible.  Theissue here is that there is a complicated event loop that needs to be tappedinto but this would be very difficult to explain to someone with limited experience. The fact that you are using wonderland means that there is probably already ahook to do what you want so a complicated explanation of what I know willprobably only confuse the matter and make things more difficult for you.   There are people on this list that havemuch more experience with Wonderland, but nobody that will answer your questionwithin hours. I would love to have Squeak be much more apleasant experience for you.  My suggestion is that you start slower andwork on understanding basic concepts of Squeak.  Do more tutorials; lookinto how some things work before trying to extend them.  Also a comment, starting with theassumption that people are not 
going to help you is discouraging to people whomight.  People are more likely to help people that work hard themselvesand will benefit from the help and will appreciate that help.  I think youhave the work hard part down.  You need to be a bit more appreciative ofthe effort and time that goes into helping you. Now to your question: Matthias was rightand he sent you to exactly the place you needed to go.   I justloaded a 3.8 image and did the helicopter tutorial.  I have to say it wasgreat fun!  Wonderland is a very nice piece of code and I can see that itwould be fun to play with.  The tutorial is fun but the concepts are noteasy and how the authors did what they did is very clever but also difficult especiallywhen you venture off the beaten path.  You picked a hard place tostart!  That by itself can be very frustrating.    Here is your answer but the answer is notperfect.  What I noticed is that the keys only have focus when the actoris under the mouse.  There may be a way 
to make this work in the contextof a world but I couldn’t get it to work that way.  The world doesnot appear to have a reactions collection, but there does seem to be a little hookin Scene that might have been intended to work that way.  Again this is anadvanced concept.  I also tried adding a reaction to the ground to make iteasier for this to work.  The ground accepted the reaction but did not acton it.  I added a reaction of [:event | self halt] but that did nothing somaybe background items like ground and sky don’t quite work or don’trespond to certain reactions the way other actors do.  It makes sense thatWonderland might be written this way.  If you added a right key press tomultiple objects how is it supposed to know which item the key press shouldcontrol.  There could be a number of ways to fix this like adding an actorthat is a control stick or something, then placing the mouse over the controlstick would work the helicopter.  (just a suggestion of where you might 
gofrom here) Ok so here is the code:  helicopter addResponse: [:event |             eventgetMorphicEvent keyString = ''                         ifTrue:[helicopter move: #left].            eventgetMorphicEvent keyString = ''                        ifTrue:[helicopter move: #right].] to: #keyPress I hope that helps, welcome to the list and Happy coding, Ron TeitelbaumPresident / Principal Software EngineerUS Medical Record SpecialistsRon at USMedRec.com face="Times New Roman">From:face=Tahoma>beginners-bounces at lists.squeakfoundation.org[mailto:beginners-bounces at lists.squeakfoundation.org] style='font-weight:bold'>On Behalf Of JeffSent: Wednesday, November 08, 200612:28 AMTo:beginners at lists.squeakfoundation.orgSubject: [Newbies] Disappointed I'm pretty disappointed with this list at the moment. My last post,"beginners questions" talked about how beginners often don't gettheir questions answered and pointed out that often when the experts see thatan 
answer, ANY answer, was given they then assume the question was answered, sothey don't offer anything more. Now I do appreciate Matthias's honest attemptto answer the question, so I don't want this to be misconstrued as an attack onhim. But he obviously misread it. And, well, once people saw that the questionof how to make a wonderland actor move in response to mouse clicks had beenanswered, I didn't get any more help. The question I asked was how to move awonderland actor with the arrow keys, and I need to do that without the actorhaving the focus. Unfortunately, since it's been taking so many hours for themessages I've tried to send to get posted on here, (I think I had screwed upjoining the list somehow, and redid it so hopefully that problem is solved), ittook me a full day to get my question asked and now another full day to explainthat the answer I got was to a different question. By the by, I've beenspending about 10 hours a day for 5 days now trying to solve this 
problem. It'sgetting quite frustrating for me and making me want to give up on squeak. border=0 width=23 height=23 id="_x0000_i1025"src="http://imgfarm.com/images/webmail/rt/img/img1017a1.gif"> 

_______________________________________________
No banners. No pop-ups. No kidding.
Make My Way  your home on the Web - http://www.myway.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20061108/9f081b37/attachment-0001.htm


More information about the Beginners mailing list