Page 1 of 1

Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Wed Dec 21, 2011 11:46 pm
by risu23GA5f74
I have downloaded and installed LiveCode 5.0.2 on Windows 7 (64-bit).
I am following the first lesson from the Game Academy.
I create a new card, and add a rectangle. I open the Script Editor and enter the following:

on arrowKey pKey

I press the Enter key. I then see this:

card id 1002: compilation error at line 2 (Handler: bad command), char 1

"arrowKey" is never colored as it is in the Game Academy video, though "on" is bold indicating the IDE is reacting to what I have typed.

Help! What am I doing wrong? :-(

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Thu Dec 22, 2011 12:03 am
by jmburnod
Hi,

You must add "end arrokey" like that

Code: Select all

on arrowKey pKey
   put pKey -- show the dir of the arrowkey pressed into the messagebox
end arrowKey
Best regards

Jean-Marc

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Thu Dec 22, 2011 12:09 am
by risu23GA5f74
When I hit Enter to go to the next line, I get the compilation error and can't type anything in any longer.

Is there some way that one should move from one line to the next without pressing Enter? I tried Shift-Enter and that moved me to the next line, but the code I typed wasn't indented or syntax colored or anything.

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Thu Dec 22, 2011 12:17 am
by mwieder
Does your keyboard have a Return key as well as an Enter key?

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Thu Dec 22, 2011 12:24 am
by risu23GA5f74
No, but I purchased the PC when I lived in Canada so it's in both English and French (I have a key for the Euro symbol, for instance). I will see if I can get a pure US keyboard config going....thanks for the clue!

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Thu Dec 22, 2011 12:29 am
by mwieder
I believe on Windows the Enter key on the numeric keypad compiles your script while the Enter key in the alpha part of the keyboard just enters a newline. I'm at a linux laptop at the moment so I can't vouch for that statement for sure.

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Thu Dec 22, 2011 12:45 am
by risu23GA5f74
I've tried both and they have the same effect - compile. There appears to be no single key on my keyboard that simply enters a newline.

Thanks for your feedback - at least I know that what I'm seeing is NOT expected behavior. I'll try to scrounge up a new machine and see if I can get it working.

Re: Script Editor & arrowKey handler issue - LiveCode 5.0.2

Posted: Fri Dec 23, 2011 4:23 am
by sturgis
For now try either shift-enter or alt-enter. Either should work.