why the second card of the same code does not work?

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
jen80
Posts: 3
Joined: Mon Aug 22, 2011 7:19 pm

why the second card of the same code does not work?

Post by jen80 » Tue Aug 23, 2011 3:07 pm

Hi,

I am very new to livecode. I wrote a simple program. The problem I met is here:

I have two cards that have exactly the same code (i.e., play audioclip, move buttons from one place to another, and send "go to next card" in 20 seconds). The first card worked well, but the second card could not. It went to the next card before the audioclip was finished, definitely less than 20 seconds. The error said "card id 1070: execution error at line 17 (Chunk: no such object) near "cat", char 4". "cat" is a button I named.

can anyone please tell me how I can fix the problem?

great thanks!

Jen

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

Re: why the second card of the same code does not work?

Post by Klaus » Tue Aug 23, 2011 3:15 pm

Hi Jen,

at first welcome to the forum! :D

I'm afraid we need to look at your script, the error is not very informative without knowing the rest! 8)
Could you please post your script(s)?


Best

Klaus

jen80
Posts: 3
Joined: Mon Aug 22, 2011 7:19 pm

Re: why the second card of the same code does not work?

Post by jen80 » Tue Aug 23, 2011 3:40 pm

Thanks!
below is the code. I made it for young children to learn letter sounds.

basically, on the first card, the direction is given, and the child can click the button to choose. if he does not choose the correct answer, he will be given a second chance to try, so the direction will be given again. These code worked well when it is on the first card that gives direction, but when it is copied on the second card that gives the direction, it stopped at line "show btn"cat"".

Code: Select all

on opencard
  wait 1 second
   play audioclip"direction.aiff"
   show btn"car"
   move btn"car" from 700,100 to 400,150 in 60 ticks
   wait 1 second
   show btn"bus"
   move btn"bus" from 700,100 to 150,400 in 60 ticks
   wait 1 second
   show btn"goat"
   move btn"goat" from 700,100 to 400,400 in 60 ticks
   wait 1 second
   show btn"cat"
   move btn"cat" from 700,100 to 659,400 in 60 ticks
   send "go to next card" to this card in 20 seconds
end opencard
thanks!

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: why the second card of the same code does not work?

Post by bangkok » Tue Aug 23, 2011 6:08 pm

On the first card, have you

-grouped your buttons
-and then set the group as "behave like a background" (properties) ?

If not... then the only solution is to duplicate all your objects onto card 2.

Post Reply