The card script is in a different order...
...but the functionality of the stack still seems to be the same?

... sorry but am I missing something?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Code: Select all
on mouseUp
set the hilite of me to true
if the label of me = the label of button "testNumber" then
answer "You got it right!"
else
answer "Oops... wrong number"
end if
set the hilite of me to false
setTheTest
end mouseUp
Originally thought I would do it this way as it seemed to be easier? Think I will stick to this for now as once I have got it doing as I want I can just change the custom property and maybe have words to match etc. (can you put pictures into a custom property? One for the future)If you want to use a custom property, go ahead. In this case it is overkill, but there is nothing wrong with that.
WowYes, they are all variables, and are temporary to the running handler. You can name these anything you want that is not reserved by the language. And yes, the LiveCode style is to place a small "t" in front for readability among the cognoscenti. Do that, absolutely. I just threw them together while driving home from work.
doh! I knew it would be something simpleSince the variable runs from "0" to "9", if you want to lose, say, "4", you need to lose the fifth item in that list. It is the "0" that makes this necessary. No other schema will do.
Ok think I will just refer to the button name for now, will have a go at that at a later date.The "B" is just a letter so that I did not have to name either button with a number. NEVER do that. So since the buttons are named "B1" and "B2", I am able to address them with either the number "1" or "2" by creating the form "B" and concatenating either a "1" or "2". Button "B2" is addressed as "B" & "2". This is a powerful tool in the language, and you have to practice it.
There was empty mouseups on both ButtonL and ButtonR have now deleted both but it is still not working when I click either ButtonL or ButtonRAre you sure there is no handler at all in either button. Their scripts must not have even an empty "mouseUp" handler, in order for the message to be passed to the card.
Think I might make myself some flash cards of basic things I need to learn, might need some help in working out what I need to learn but I will post that with a seperate topicYou are trying to cram a great deal of learining into a short time frame, based on a single project. That is not a bad way to start. Have patience, though, this jumpStart method will have snags for you since you are jumping in at a level quite above the novice.
You were right, you were right, you were right! I just hadn't click the save button.Are you sure there is no handler at all in either button. Their scripts must not have even an empty "mouseUp" handler, in order for the message to be passed to the card.
There was empty mouseups on both ButtonL and ButtonR have now deleted both but it is still not working when I click either ButtonL or ButtonR
Code: Select all
on mouseup
Set itemDel to tab
put the cNumberPairs of this card into thePairs
sort lines of thePairs by random(the number of lines of thePairs)
Set the label of button "ButtonL" to item 1 of line 1 of thePairs
Set the label of button "ButtonR" to item 2 of line 1 of thePairs
put item 1 of line 1 of thePairs into thePairsL
put item 2 of line 1 of thePairs into thePairsR
put any item of "1,2" into thePairsLorR
if thePairsLorR = 1 then set the label of button "testNumber" to thePairsL
if thePairsLorR = 2 then set the label of button "testNumber" to thePairsR
end mouseup
Exactly. Again, you had ten items and my scheme used a simple, single digit method of identifying any one of them. It is just a way to do it, there are a million others. Note that if you had more than ten items, a single digit would no longer have been enough. Right? We would need a different scheme.So it is the 0 that causes all the problems if I had wanted to use "1,2,3,4,5,6,7,8,9" with no zero then the "+1" would not have been needed, I think?
The idea of "B" & 1 simply allows you to access one or the other of two buttons, named "B1" and "B2 with a number. It is nothing more than that, a scheme. You have to be famiiar with LC's ability to concatenate strings, and how this ability can be used to tremendous advantage. This will lead you to the concept of "chunking" developed way back when with Hypercard, and is the most fun and powerful text processing toolset you could ask for.I also understtand the "B" "1" and "2" a bit more now as well now I have spent some more time in the variable watcher
Code: Select all
on openCard
lock screen
setTheTest
end openCard
Code: Select all
on closeCard
repeat with count = 1 to 3
set the label of button count to space
end repeat
end closeCard
Code: Select all
on setTheTest
lock screen
set the label of button "buttonL" to space
set the label of button "buttonR" to space
Code: Select all
set itemDel to tab
put the cNumberPairs of this card into thePairs
sort lines of thePairs by random(the number of lines of thePairs)
Code: Select all
put random(2) into whichNumber
set the label of button "testNumber" to item whichNumber of line 1 of thePairs
Code: Select all
if whichNumber = 1 then
set the label of button "ButtonR" to item 1 of line 1 of thePairs
set the label of button "ButtonL" to item 2 of line 1 of thePairs
else
set the label of button "ButtonL" to item 2 of line 1 of thePairs
set the label of button "ButtonR" to item 1 of line 1 of thePairs
end if