Re: two cards that open randomly
Posted: Tue Apr 24, 2012 6:25 am
I wonder if it went into the virtual store folder. Apps aren't supposed to write to the program folder any more.
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
I'll be happy to try to help, but as I'll explain below I can only go so far at this point.So my problem at the moment is to get the program to progress past the start button, have attached what I have done, if you wouldn’t mind having a little look
Your right, I had noticed that I was sometimes unable to open script and had shut down and reopened LiveCode but I hadn’t realised it was also stopping the stack working. Have now closed and reopened it and now pressing the start button accesses the cardsI'll be happy to try to help, but as I'll explain below I can only go so far at this point.
I was puzzled that the Start button was not working, since it worked fine on a copy of your stack where I made the original modifications that I suggested to you. In looking at the code for the button, everything looked OK. (By the way, you can delete all the commented-out code at the bottom now.) But then the stack began to exhibit some strange behavior, specifically I no longer had the ability to open scripts. When I opened the Application Browser I discovered that I had somehow managed to open two stacks with the same name. (I suspect this happened when I had closed the stack earlier and had gotten the message about this being the last stack of that name open, and did I want to remove all the stacks of this file from memory? I always answer yes to that question, but I think I must have been distracted and clicked the no button, leaving the stack in memory. Then when I opened the stack later I ended up with two copies of the stack open.) After I closed both stacks (and then LiveCode as well -- to be sure), and then reopened your stack, the Start button was working fine. Try opening your stack again after having closed LiveCode, and see if the Start button works OK again.
Have adjusted the pic as I had the arrows going back to far. Have also added more notes to hopefully clear the questions up. I thought it was easier to understand if I put them there. I also need to explain what a concurrent schedule is, bear with me.I would like to help you further with the rest of your code, but until I can understand exactly what the logic behind the stack is, it is hard to advise you. Here are a few things I don't understand right now:
1. On the very nicely done diagram you sent, you show only one outcome from clicking a number on card FR1 (or FR20). But there are two buttons for the user to choose from. Does the user go to one of the color cards regardless of whether or not they answered correctly? If not, what is supposed to happen if the wrong button is clicked?
2. Once the user gets to one of the color cards, does he or she stay there for only 1 choice before going back to the start button? If not, how many choices are to be made? And again, does it matter to the program whether the right or wrong choice is made (other than keeping score)?
With the red or yellow choice if they choose the red they get a 5p reward if they choose yellow they get nothing. is it posible to have a picture of a 5p appear?3. I am also confused, as I mentioned in an earlier post, as to how the user is to decide which side (color) of the card to answer. It is powerfully confusing to me to be shown two buttons (and be told to click both of them), when only one can be clicked on.
Now, as I also said earlier, I don't need to understand these things -- if you can massage your stack to do what you want then all is well, but if you would like/need assistance, I need to understand your goals with the stack (and I can be pretty dense -- sorry.)
I think this is a very good idea and I will try and stick to the putting the t’s and the g’s inFinally, some postscripts:
P.S. With regard to the naming of variables. Prefixing them with a g or t is completely optional. I like to do it, because every time I type in a variable, I like to remind myself whether it works globally or locally, because, as you know, one has to make sure that the information stored in the variable is available when it's needed. So, for me, I like to "force" myself to think about the variable every time I type the name. If you choose not to, no problem. (There are some other benefits to following this convention as well. There's a brief explanation of them on page 165 of the LC User Guide and a fuller explanation in the article at this site: http://www.fourthworld.com/embassy/arti ... tml#Naming )
Yep I am aware that there is a ‘maths’ way of doing this but if I wanted, at a later date, to modify the program to match letters or words I could just change the custom property rather than the structure of the program.P.P.S. Congratulations on using a custom property on your color backround scripts to store the possible pairing and retrive them for use. I'm sure you worked long and hard at that, and as long as it's working right (and I have no reason to think it's not), then there is no reason to change it. (I know you were guided in that direction in an earlier forum discussion.) However, if you ever want/need to redo it, please be aware that there are much simpler ways of doing this, which I will be happy to share if you ask. But there's no need to fix something that's working well.
I must admit I don’t really understand what is happening here?P.P.P.S. (My last, I promise -- for this post at least.) In looking at the code for generating those pairs, it looks as though you read the 90 possible pairs into memory every time the user clicks the button, and then use only one of the pairs. The reading of the pairs into memory is something that cries out to be moved to, say, the openStack script and then referenced from there whenever you need to. However, LiveCode is so fast, that in this situation it probably doesn't really matter. In general though, when writing a program, be alert to ways of avoiding making LiveCode repeat the same steps over and over.