Can't decide how to pass an handler

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
AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Can't decide how to pass an handler

Post by AstghikM » Sat Nov 15, 2014 10:24 am

Hi evrybody :) i have one problem...

Code: Select all

global player1,player2,whoIs,check

on openCard
     repeat with i=1 to 5
        repeat with j=1 to 5
              put  the text of field("p"&i&j) into check[i][j]
        end repeat
     end repeat
          checkIfwin
        --send openCard to me in 1 secs
end openCard

command checkIfwin
   
   put 1 into verticalK
       repeat with i=1 to 5
           repeat with j=1 to 5
              if j<5 then
                 if check[i][j]=check[i][j+1] then
                    put verticalK+1 into verticalK
                    if verticalK is 5 then
                     
                       answer verticalK
                       pass checkIfwin
                       end if
                 end if
              else
                  if verticalK is 5 then
                   
                     answer verticalK
                      pass checkIfwin
                     else
                 put 1 into verticalK
                 end if
              end if
           end repeat
        end repeat
  
end checkIfwin

 
here is two handlers one is OpenCard and the other one is command checkIfwin :) so i'm sending OpenCard to me every 1 seconds, but when verticalK is 5 (let's say you win) i want to pass checkIfwin handler, but after all that in openCard handler i get an error: no such handler(it is about checkIfwin). how to pass OpenCard too when verticalK is 5? :D i hope i could explain my problem :D

AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Re: Can't decide how to pass an handler

Post by AstghikM » Sat Nov 15, 2014 11:11 am

i will wait for your answer, i have been try many ways but no result :oops:

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

Re: Can't decide how to pass an handler

Post by Klaus » Sat Nov 15, 2014 12:30 pm

Hi AstghikM,

not sure, but maybe you mean EXIT?
That will leave the current handler:

Code: Select all

...
if verticalK = 5 then
   answer verticalK
   EXIT checkIfwin
end if
...
Best

Klaus

AstghikM
Posts: 45
Joined: Mon Sep 08, 2014 8:35 pm

Re: Can't decide how to pass an handler

Post by AstghikM » Mon Nov 17, 2014 8:09 am

Klaus wrote:Hi AstghikM,

not sure, but maybe you mean EXIT?
That will leave the current handler:

Code: Select all

...
if verticalK = 5 then
   answer verticalK
   EXIT checkIfwin
end if
...
Best

Klaus
Thank you :) it works for me :) i didn't know that i can just exit handler :D

Post Reply