"if keysdown() = 65362" site:http://forums.runrev.com/

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

"if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Wed Nov 20, 2013 11:18 pm

I often see this keysdown, I understand that it is used as opposed to arrowkey when you actually have another handler or more handlers running concurrently within an operation as a user presses the key pad somewhere. But what I can not discover is the meaning of the numbers? As you can see, nothing found on the forums.
chris

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by bn » Thu Nov 21, 2013 1:04 am

Hi Chris,

make a new stack. place 1 field on the one and only card of the new stack.
set the script of the card to

Code: Select all

on rawKeyDown pValue
   put pValue into field 1
   pass rawKeyDown
end rawKeyDown

on keyDown pValue
   put cr & pValue after field 1
end keyDown
now press keys, arrowKeys, scroll the mouseWheel etc.

note when line 2 of the field is empty
note in the rawKeyDown handler "pass rawKeyDown"

Kind regards
Bernd

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by dunbarx » Thu Nov 21, 2013 1:20 am

Bernd.

I think this is better for Chris, he can log the regular keys, and grimace at the odd ones:

Code: Select all

on rawKeyDown pValue
      put pValue after field 1
   if the length of pValue > 4 then put return after fld 1
      pass rawKeyDown
end rawKeyDown

on keyDown pValue
   put  pValue & return after field 1
end keyDown
Chris, do you see what Bernd was getting at? Can you write a script that creates a complete log of the standard keys, including the caps?

Craig

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Thu Nov 21, 2013 2:46 pm

Bernd and Craig, thankyou very much, this is so useful - I would never have found this and I was looking at everything, I knew that they were not 'bin' or 'ascii' numbers. No idea that keyboard keys had these references. Craig, until I tried to delete - funny, had to make a button to empty the field.

note in the rawKeyDown handler "pass rawKeyDown" yes I see what it does after I commented it then uncommented it, so this enables the key pressed to be passed through the message hierarchy? in other words without this then the key pressed would not actually be received by anything?

Craig, to answer your question No I can't off the top of my head, I will have to take some time to work out what to do. Really, I am only 4 weeks into this and still have to think so hard with the simplest of tasks, I have no programming background so I am still having to understand the programmers 'way' so to speak, the flow of thought patterns when one has an initial concept and to translate this into a diagrammatic layout before you even write a single line of code is still a struggle right now.

For example, I am dissecting code quite a lot recently and realizing how much of the code is made up language, sticking a variable into a variable then into another variable and this goes into another variable and then finally into a made up function where Finally you actually find a real world dictionary programming piece of terminology. I have one such code in front of me, it is horrendous. A bit like making up a whole set of words for some imaginary vegetables, throwing them into a saucepan and out comes the perfect meal! :D

Thankyou for your help Craig and Bernd.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by dunbarx » Thu Nov 21, 2013 3:00 pm

Chris.

You are doing great, and I see you are now a teacher. Did I mention a while ago that this was a substantial undertaking?

You have taken a route whereby you try to deconstruct existing scripts and stacks; you seem more comfortable with real examples. This is something I am not good at; I am more comfortable struggling on my own. I was fortunate to have started in all this when there was not much around to look at anyway. But by doing so, you will find both treasure and trash, if you can decipher what is going on. Not all code is elegant or well considered. But some is high art indeed.

Craig

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Thu Nov 21, 2013 3:58 pm

Yes Craig, I had to finally resort to the reverse engineering strategy because really the tutorials left me agonizing, I do prefer to watch and learn via video demos or with a teacher/course and gradually build up the knowledge, I am used to that way of doing things; but so much reading and trying to understand was infuriatingly infuriating, and so I thought that's it, look at code and then ask thousands of questions and type everything into google Rev, look for past conversations in the forums, find a tutorial, and when all that fails annoy the guys on the forum. I can soak up new knowledge and concepts at a fast rate, but only if it is delivered in logical progressions from the roots up. This has been my most painful experience with LC because for the first time ever I am finding that I have to learn how to build a house by studying the roof structure then a window, then a cross beam etc etc - so you have to keep track of each new piece of the new puzzle so that you can hopefully eventually make sense of the whole.

Hope you don't mind the twitter :)

Kind regards
chris

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by FourthWorld » Thu Nov 21, 2013 5:01 pm

Chris, have you programmed in other languages before? If so, which ones? Knowing that can help us tailor answers to better build upon what you know.

But for many of us, the "reverse engineering strategy" is simply how we learn.

Like the old Confucian proverb: "Tell me, and I will forget. Show me, and I may remember. Involve me, and I will understand."

We write code, it breaks, we learn how to get it to stop breaking, some other part of it breaks, we fix that, and eventually have a working system. But all along the way we're learning.

As an old friend once told me: "Success in life isn't not having any problems, it's moving on to more interesting problems."
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Thu Nov 21, 2013 5:26 pm

Hallo Richard, I like the proverbs. I have never had anything to do with programming. LiveCode really is the first time I ever typed something I never understood :lol: But I can sum up the last 5 weeks by saying that the more annoying it gets the more determined I am to break it, and the more I hate it the more enthusiastic I become :? I know you'll laugh but this is exactly what it does to me, anyway, it's creative and that is the one ingredient that never occurred to me in programming, and it happens to be the one thing that keeps me going - its potential.

Kind regards
chris

keram
Posts: 340
Joined: Fri Nov 08, 2013 4:22 am

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by keram » Thu Nov 21, 2013 5:46 pm

chris25 wrote:really the tutorials left me agonizing, I do prefer to watch and learn via video demos or with a teacher/course and gradually build up the knowledge, I am used to that way of doing things; but so much reading and trying to understand was infuriatingly infuriating, .... I can soak up new knowledge and concepts at a fast rate, but only if it is delivered in logical progressions from the roots up. This has been my most painful experience with LC because for the first time ever I am finding that I have to learn how to build a house by studying the roof structure then a window, then a cross beam etc etc - so you have to keep track of each new piece of the new puzzle so that you can hopefully eventually make sense of the whole.
That is exactly describing my feeling and situation as well!

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by FourthWorld » Thu Nov 21, 2013 5:47 pm

chris25 wrote:I can sum up the last 5 weeks by saying that the more annoying it gets the more determined I am to break it, and the more I hate it the more enthusiastic I become :?
Yep, that's pretty much how it went for me too. :)

Here's the pattern I've seen with many of the folks I've taught over the years:

Day one: "What the hell is going on? Why doesn't anything work like I expect? I hate this thing."

Two days: "Omigawd, the potential is incredible! If only I knew how to use it all..."

Two weeks: "After reading the language guide and trying some things out, I'm able to do some productive work."

One month: "Now I can do productive work efficiently."

Three months: "With the flexibility of the language and the handy tools in LiveCode, I'm seeing slightly greater productivity than in my formerly-favorite tool I'd used for years."

Six months: "I love this thing."

One year: "I love this thing like no other."
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Thu Nov 21, 2013 6:07 pm

keram wrote:
chris25 wrote:really the tutorials left me agonizing, I do prefer to watch and learn via video demos or with a teacher/course and gradually build up the knowledge, I am used to that way of doing things; but so much reading and trying to understand was infuriatingly infuriating, .... I can soak up new knowledge and concepts at a fast rate, but only if it is delivered in logical progressions from the roots up. This has been my most painful experience with LC because for the first time ever I am finding that I have to learn how to build a house by studying the roof structure then a window, then a cross beam etc etc - so you have to keep track of each new piece of the new puzzle so that you can hopefully eventually make sense of the whole.
That is exactly describing my feeling and situation as well!

keram
what a relief, have you any idea how it feels when you post and you think that you must be the odd one out?
Thanks for sharing. :)

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Thu Nov 21, 2013 6:10 pm

FourthWorld wrote:
chris25 wrote:I can sum up the last 5 weeks by saying that the more annoying it gets the more determined I am to break it, and the more I hate it the more enthusiastic I become :?
Yep, that's pretty much how it went for me too. :)

Here's the pattern I've seen with many of the folks I've taught over the years:

Day one: "What the hell is going on? Why doesn't anything work like I expect? I hate this thing."

Two days: "Omigawd, the potential is incredible! If only I knew how to use it all..."

Two weeks: "After reading the language guide and trying some things out, I'm able to do some productive work."

One month: "Now I can do productive work efficiently."

Three months: "With the flexibility of the language and the handy tools in LiveCode, I'm seeing slightly greater productivity than in my formerly-favorite tool I'd used for years."

Six months: "I love this thing."

One year: "I love this thing like no other."
Day one lasted about two weeks for me............

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by jacque » Thu Nov 21, 2013 9:35 pm

We've all been through Richard's learning curve, it's how it works. Chris, I think you're doing just great. And I completely agree that in spite of the frustration, LiveCode is incredibly addicting. I'm afraid you are becoming one of us now. :)

About the "made up words": any time you see a line of script that starts with "put" you know immediately that the data is going into a variable. And all variables are words the developer makes up. So, look for "put"s and you're golden:

Code: Select all

put min(myVar,0.1) into someMadeUpThing
put "This is a test" into myInventedVar
put (frustration*6) into determination
All other made-up words will likely be handler names. Those all occur at the top of a handler and finish after the word "end". So all you need to do is look in the dictionary for whatever is at the end of the "end" line. If it isn't in the dictionary, the author has created their own handler name and it's a made-up word.

Parameters passed to handlers are a form of variable, and they are also made-up. But that's for later.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

chris25
Posts: 354
Joined: Tue Oct 08, 2013 9:32 pm

Re: "if keysdown() = 65362" site:http://forums.runrev.com/

Post by chris25 » Thu Nov 21, 2013 10:04 pm

Thanks Jacque, I pretty much now have just begun to get it, and thankyou for the tip about the parameters.

Post Reply