Button script
Posted: Mon Nov 11, 2013 1:00 pm
I have 3 buttons, they appear on every card as a group. The script applied to each of the buttons is as follows( the go to card" parts are different on each button but this is the general structure):

Each dot represents a card. The current card is shown by a yellow dot, however when I go back to card 1 the visited dots remain yellow, rather than changing back to black.
Also the following alert is coming up when i click the button:
Code: Select all
on mouseUp
put the number of this card into thisCardNumber
put the number of the previous card into lastCardNumber
if thisCardNumber is 1 then go to card "card2"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 2 then go to card "card5"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 3 then go to card "card1" --gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 4 then go to card "card7"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 5 then go to card "card8"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 6 then go to card "card10"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 7 then go to card "card11"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 8 then go to card "card12"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 9 then go to card "card6"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 10 then go to card "card13"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 11 then go to card "card14"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 12 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 13 then go to card "card16"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 14 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 15 then go to card "card17"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 16 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 17 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 18 then go to card "card19"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 19 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 20 then go to card "card21"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 21 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 22 then go to card "card23"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 23 then go to card "card25"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 24 then go to card "card18"
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 25 then go to card "card1"--gameover
set the backgroundColor of "dot & lastCardNumber" to black
if thisCardNumber is 26 then go to card "card1"--complete
set the backgroundColor of "dot & lastCardNumber" to black
end mouseUp

Each dot represents a card. The current card is shown by a yellow dot, however when I go back to card 1 the visited dots remain yellow, rather than changing back to black.
Also the following alert is coming up when i click the button:
Type Chunk: error in object expression
Object 1
Line set the backgroundColor of "dot & lastCardNumber" to black
Hint dot & lastCardNumber