SEND sending me crazy

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
richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10134
Joined: Fri Feb 19, 2010 10:17 am

SEND sending me crazy

Post by richmond62 » 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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10134
Joined: Fri Feb 19, 2010 10:17 am

Re: SEND sending me crazy

Post by richmond62 » Fri Aug 29, 2025 11:14 am


Klaus
Posts: 14213
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: SEND sending me crazy

Post by Klaus » Fri Aug 29, 2025 11:22 am

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)

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

Re: SEND sending me crazy

Post by dunbarx » Fri Aug 29, 2025 1:54 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10134
Joined: Fri Feb 19, 2010 10:17 am

Re: SEND sending me crazy

Post by richmond62 » Fri Aug 29, 2025 3:54 pm

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.

Post Reply