Page 1 of 1

SEND sending me crazy

Posted: Fri Aug 29, 2025 11:06 am
by richmond62
I have a young friend/victim who has got himself in trouble with this:

Code: Select all

command moveEnemy
   if field "f1" is empty then
      move image "Knight 2" to random(800), random(600) in 2 seconds
   end if
   if field "f1" is empty then
      move image "Knight 45" to random(800), random(600) in 2 seconds
   end if
   send "moveEnemy" to me in 2 secs
end moveEnemy
On attempting to quite the LC IDE the 'thing' gets caught at move image "Knight 45" to random(800), random(600) in 2 seconds and will NOT quit.

Re: SEND sending me crazy

Posted: Fri Aug 29, 2025 11:14 am
by richmond62
Here's the stack:

Not any more: see posting further down.
-
Hey-Ho.jpg

Re: SEND sending me crazy

Posted: Fri Aug 29, 2025 11:22 am
by Klaus
Try with two different commands:

Code: Select all

command moveEnemy1
   if field "f1" = empty then
      move image "Knight 2" to random(800), random(600) in 2 seconds
   end if
   send "moveEnemy2" to me in 2 secs
end moveEnemy1

command moveEnemy2
   if field "f1" = empty then
      move image "Knight 45" to random(800), random(600) in 2 seconds
   end if
   send "moveEnemy1" to me in 2 secs
end moveEnemy2
Maybe test with "... move... without waiting"
AND add a way to CANCEL the MOVEs when neccessary! 8)

Re: SEND sending me crazy

Posted: Fri Aug 29, 2025 1:54 pm
by dunbarx
Richmond.

Have not tested, but a quick glance tells me this is a loop without end. Handler 1 calls handler 2, and then guess what handler 2 does.

Craig

Re: SEND sending me crazy

Posted: Fri Aug 29, 2025 3:54 pm
by richmond62
I have suggested to Alexander (the pupil in question) that he registers for this list . . . a clever laddie, that.

Alexander's "problem" is concerned with keeping his baddies moving around while the end-user manipulates the goody with key commands.

Re: SEND sending me crazy

Posted: Sat Aug 30, 2025 2:58 pm
by stam
richmond62 wrote:
Fri Aug 29, 2025 11:06 am
I have a young friend/victim who has got himself in trouble with this:

Code: Select all

command moveEnemy
   if field "f1" is empty then
      move image "Knight 2" to random(800), random(600) in 2 seconds
   end if
   if field "f1" is empty then
      move image "Knight 45" to random(800), random(600) in 2 seconds
   end if
   send "moveEnemy" to me in 2 secs
end moveEnemy
On attempting to quite the LC IDE the 'thing' gets caught at move image "Knight 45" to random(800), random(600) in 2 seconds and will NOT quit.
1. Why the two “if” statements? The condition is the same, why not have them as a single conditional?
2. The only way to terminate this handler is to put something into field “f1” - why not do that when trying to quit? Or clear the pending messages…

Re: SEND sending me crazy

Posted: Sat Aug 30, 2025 3:29 pm
by richmond62
I did wonder about ' flushEvents'.

Re: SEND sending me crazy

Posted: Sat Aug 30, 2025 3:47 pm
by richmond62
OOF:

My pupil states that he has registered here but it is 'inactive' . . .

Re: SEND sending me crazy

Posted: Sat Aug 30, 2025 4:16 pm
by richmond62
Well, while yon sleepy bairn gets himsel sairted oot, I have deleted his "chunky monkey" and uploaded a 'pruned' stack with a some cardScript mods (all clearly marked).

https://www.dropbox.com/scl/fi/u6nufmuq ... 2c9ek&dl=0