Page 1 of 1

Pasteurized Arrowkeys

Posted: Mon Jun 10, 2019 8:51 am
by richmond62
I don't really want end-users from getting one response when they press on a key (i.e. no automatic repeats).

So, was a bit surprised why this:

Code: Select all

on arrowKey AK
   put item 1 of the loc of grc "rp" into LR
   put item 2 of the loc of grc "rp" into UD
   switch AK
      case "left"
         subtract 10 from LR
         move grc "rp" to LR,UD
         pass arrowKey
         break
      case "up"
         subtract 10 from UD
         move grc "rp" to LR,UD
         pass arrowKey
         break
      case "right"
         add 10 to LR
         move grc "rp" to LR,UD
         pass arrowKey
         break
      case "down"
         add 10 to UD
         move grc "rp" to LR,UD
         pass arrowKey
         break
   end switch
end arrowKey
Didn't stop that.

Possibly I have misunderstood the role of 'pass'.

Re: Pasteurized Arrowkeys

Posted: Mon Jun 10, 2019 9:01 am
by richmond62
And replacing 'pass arrowKey' with:

Code: Select all

flushEvents("all")
throws a 'bluey'.

Code: Select all

exit to top
is similarly useless.

Re: Pasteurized Arrowkeys

Posted: Mon Jun 10, 2019 9:09 am
by richmond62
What I am looking for would be a bit like this (pseudoCode):

if arrowKeyStillDown then
end arrowKey
end if

Re: Pasteurized Arrowkeys

Posted: Mon Jun 10, 2019 10:21 am
by jmburnod
Hi Richmond,
What about this cd script ?

Code: Select all

local sStartTime
on opencard
   initStartime
end opencard

on initStartime
   put the milliseconds into sStartTime
end initStartime

on arrowkey pDir
   if the milliseconds < (sStartTime + 500) then
      beep
      exit arrowkey
   else
      put pDir & sStartTime into fld "fSpy"-- you have to create one fld "fSpy"
      put the milliseconds into sStartTime
   end if
end arrowkey
Best
Jean-Marc

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 10:06 am
by richmond62
This didn't stop key repeats:

Code: Select all

on arrowKey AK
   put item 1 of the loc of img "bull" into LR
   put item 2 of the loc of img "bull" into UD
   if AK = "up" then
      subtract 8 from UD
      move img "bull" to LR, UD
      if intersect(img"bull",img"maze",5) then
          move img "bull" to 162,676
         end if
      exit to top
   end if
end arrowKey
This is slightly pathetic for the very, very simple
reason that I can do this on my BBC Model B from 1981:
-
Screen shot 2019-06-14 at 12.05.44 PM.png
Screen shot 2019-06-14 at 12.05.44 PM.png (7.63 KiB) Viewed 648 times
Some wag made a rude remark about GOTO and GOSUB when they were introduced in BASIC
(much the same way as "clever" programmers are rude about LiveCode nowadays) . . .

Now, as LiveCode DOES have line numbers (go and look!), why is there no GOTO equivalent to
escape from a script?

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 10:15 am
by Klaus
richmond62 wrote:
Fri Jun 14, 2019 10:06 am
Now, as LiveCode DOES have line numbers (go and look!), why is there no GOTO equivalent to escape from a script?
This in just a feature of the Script Editor for our convenience.
The scripts do not have line numbers, at least the engine does not count them or support this.

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 10:43 am
by richmond62
The scripts do not have line numbers, at least the engine does not count them or support this.
In some ways that's a pity. :(

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 12:30 pm
by sphere
Oh man, i can remember the days (& nights) when i had my first MSX, typing over those listings in MSX-magazines, learning myself to type. MicroSoft Basic...and then euh where is the R, and euh where is the U and then after 2 minutes ah i found the N. Just great!

Then i had the great idea to steer my 4 color plotter with my joystick (which still worked after many hours Hyper Sports and such) andwith Fire i could change the color. It was useless further but it worked.

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 12:56 pm
by richmond62
Oh man, i can remember the days
Come Monday morning, and a good half dozen 10 year olds will be sitting down in front of my
BBC Micro computers for the simple reason that foetuses when they incubate in their mother's
wombs RECAPITULATE . . . 8)
-
beebem.png
beebem.png (23.72 KiB) Viewed 610 times
-
Err . . . the theory of foetal recapitulation has been debunked . . . :evil:

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 2:30 pm
by Mikey
richmond62 wrote:
Fri Jun 14, 2019 10:43 am
The scripts do not have line numbers, at least the engine does not count them or support this.
In some ways that's a pity. :(
Structured languages that lack GOTO definitely make some things harder, but line numbers are not a good thing. Line labels seem to be a reasonable tool (even if they can make code harder to read in some cases).

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 2:33 pm
by richmond62
Line labels
And how can one (can one?) implement those in LiveCode?

AND, HOW, more to the point . . .

. . . can one 'escape' a script?

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 2:37 pm
by Mikey
Why ctrl-alt-delete, of course

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 4:12 pm
by richmond62
ctrl-alt-delete
is it possible to implement that programmatically?

Re: Pasteurized Arrowkeys

Posted: Fri Jun 14, 2019 4:42 pm
by jacque
Dar posted a workable solution to the mailing list. Generally if you need to exit a script, changing the structure will allow it.

If you really want to do it in a "goto" way, you can experiment with "exit to top" or "return".