Page 1 of 1

Go To or Open Card Not Working

Posted: Thu Dec 12, 2013 8:09 pm
by townsend
I'm having a problem getting my app to open with the last used card.
I've been saving the last card ID with "the short ID of this card" fine.
I can retrieve the saved value fine. But I'm having trouble opening that card.

Here's the code. With the Wait statement, the correct card is opened. But not before the first card in the stack is momentarily flashed. As soon as I remove the Wait statement, the Go To Card statement no longer works. I've tried Open Card but that doesn't make a difference.

Code: Select all

on openstack
     wait 0.5 second
     go to card number 6255
end openstack

Re: Go To or Open Card Not Working

Posted: Thu Dec 12, 2013 8:27 pm
by FourthWorld
The "number" of a card refers to its order position within the stack, where the first card is 1, the second is 2, etc. So to reach "card number 6255" you'd have to have 6,255 cards in your stack - which I hope you don't. :)

To address a card by ID, let LC know your intentions by using the "id" keyword: "go card id 6255"

Re: Go To or Open Card Not Working

Posted: Thu Dec 12, 2013 8:42 pm
by townsend
Thanks for the quick reply Richard!

I changed the reference to "number" to "id".
It still didn't work. Then I changed the "Go To" to "Open"
And now it works fine. So I guess you shouldn't use "Go To" unless the card is already open.
What about using Open, even if the Card is open. I do that all the time.
Should I be checking to see if the card is open before using using the Open statement?

Re: Go To or Open Card Not Working

Posted: Thu Dec 12, 2013 8:51 pm
by FourthWorld
I know from experience that "go cd id <number>" will work - provided it is indeed the ID number of a card that exists in the current stack. You may want to check that ID number.

Or better yet, if you name your cards you can simply use "go cd <cardName>", and then you'll have references that are easy to remember when coding.

Re: Go To or Open Card Not Working

Posted: Thu Dec 12, 2013 8:58 pm
by townsend
Thanks for your help Richard-- a little mix up there.
It's working fine now.