Get Card Name

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
Bantymom
Posts: 73
Joined: Fri Aug 27, 2010 4:32 am

Get Card Name

Post by Bantymom » Fri Sep 03, 2010 9:24 pm

Can I get the name of the card that I'm on? or say, the name of the next card? and then put that name in a field?

I can get the name of a button or field or some other object, but not the name of a card?

I looked up card in the dictionary and found that I could use "cardname" to get the names of all the cards in the stack, but not the name of just one card.
on opencard
get the cardnames of stack "WordGameTester"
put it into field "cardname"
end opencard
Despite drawing out my plan, I forget what I have named things, and so it would be very helpful to have the names of the cards to show up while I am working on this.

Thank you,
Banty
2nd-grade Teacher, Poultry Fancier, Scottish Country Dancer
and Perpetual Beginner

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Get Card Name

Post by FourthWorld » Fri Sep 03, 2010 10:15 pm

You can use:

get the name of this card
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Get Card Name

Post by mwieder » Sat Sep 04, 2010 1:26 am

You can also say in a button script

Code: Select all

put the long name of me
and the card name will be in there as well.

And if you're just looking to do this while you're developing you can look in the Application Browser.

Bantymom
Posts: 73
Joined: Fri Aug 27, 2010 4:32 am

Re: Get Card Name

Post by Bantymom » Sat Sep 04, 2010 3:27 am

@ FourthWorld,

I feel very silly now, but I very much appreciate the answer! It seems so obvious. How did I miss that? I looked for "name," "card," and "get" in the dictionary (and in the user's guide, and in the Command portion of the Reference Center). There it said that the syntax was "get expression," and I thought that "expression" meant something mathematical, not a simple sentence. I am so glad you guys are so patient. I really have been trying to find things myself, but it's clear I'm not very good at that.

Something came up in the Reference Center though that I now have a question about. On page 5 of the Command PDF it says "You can get a list of common commands you might want to use and their usage in the Reference Documentation. Common commands include beep, cut, copy, paste, save, print, put and quit. We’ll use all of these in other tutorials" with an image of something I haven't seen yet. Where can I find the thing they are referring to? I seems I need all the reference materials I can get my hands on.

@ mwieder,
The application Browser is a new thing for me. My old version of HyperCard didn't have it. I looked at it as soon as saw this, and I can see a list of the cards in the stack, but I'm not sure how to see where it tells me which card I am on at the moment, but I am sure that is just because I am not familiar with it yet. Clearly, I need to get more familiar with it. Thank you. :)

So, now I have also just learned to make a group! I have a group on each card that gives me the name of the card I am on and the name of the card that comes next, with other fields that just say "This Card" and "Next Card." It works, and in it's very inelegant way, give me the information I want. (Edit: And am stumbling through learning to edit the group, lol.)

I know this is a very clumsy way of doing this, but right now, I have to get this done. I continue to search the User's Guide, the Reference, and the Dictionary, but looking at all the tutorials and lessons and archived web things will have to wait and elegance will have to come later. Because this is so much more powerful, it just isn't as easy to learn as was HyperCard, and that was a long time ago. I am just going to have to get through this with brute force the first time and hope you will all continue to have patience with me when I get frustrated.

Cheers,
BantyMom
Last edited by Bantymom on Sat Sep 04, 2010 4:34 am, edited 1 time in total.
2nd-grade Teacher, Poultry Fancier, Scottish Country Dancer
and Perpetual Beginner

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Get Card Name

Post by mwieder » Sat Sep 04, 2010 4:24 am

Has anyone pointed you to the scripting conference archives yet? They're a great place to start (and here I'm using "start" in the sense of unlearning some HC habits and starting on a new road)

http://www.runrev.com/developers/lesson ... nferences/

...and the Application Browser doesn't necessarily show you what card you're currently on unless you've highlighted it yourself. But if you look at the title bar of the stack you're working on you should see a number in parentheses. That's the number of the card you're working with, and the Application Browser does have card numbers listed there. You can double click on any card name to bring that one to the front and work with it. Kind of brute force navigation, but it works in a pinch.

Bantymom
Posts: 73
Joined: Fri Aug 27, 2010 4:32 am

Re: Get Card Name

Post by Bantymom » Sat Sep 04, 2010 4:43 am

Actually, no one had pointed it out to me specifically, but I have been searching through this forum as well to try to get answers before posting questions, and I saw that you had put up that link somewhere else. I did go there and was very happy to find it, but it is taking awhile to get through all of them. I am working on it though.

After your hint about the number in parenthesis, I quickly went to check it out ("How could I have missed that?!), but, alas, I am not seeing a number in parenthesis. My testing stack is attached, as well as a screen shot of what the title bar looks like to me just in case it looks correct to you.

Thanks!

(lol, I just saw that the name of the card is showing with quotation marks on one side only. I don't know why, but right now I don't really care, it's just interesting.)
Attachments
Screen shot.tiff
Screen shot.tiff (93.39 KiB) Viewed 10256 times
WordGameTester.rev.zip
(48.59 KiB) Downloaded 320 times
2nd-grade Teacher, Poultry Fancier, Scottish Country Dancer
and Perpetual Beginner

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Get Card Name

Post by mwieder » Sat Sep 04, 2010 4:59 am

OK - I went back and checked. I think the number in parentheses is only there if you haven't given the card a name yet (i.e., it's just identified by its ID). But the stack is taking shape, the group looks good, looks like you're on your way.

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

Re: Get Card Name

Post by Klaus » Sat Sep 04, 2010 11:10 am

Hi Bantymom,

a tiny hint which might save you about 30-40% (or maybe even more) of typing.
You don't need to GET things first, you can use them immediately!

Instead of

Code: Select all

...
get the cardnames of stack "WordGameTester"
put it into field "cardname"
...
Just

Code: Select all

...
put the cardnames of stack "WordGameTester" into field "cardname"
...
:D

Best from germany

Klaus

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Get Card Name

Post by mwieder » Sat Sep 04, 2010 4:21 pm

Klaus- I never realized you were as lazy as I am! <g>

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

Re: Get Card Name

Post by Klaus » Sat Sep 04, 2010 4:30 pm

Hi Mark,

I am the world champion in being lazy and surely could teach you some tricks, dude...

C'mon, that's how bass players work, keep the groove and keep it cool but don't exaggerate :D


Best

Klaus

P.S.
New Songs and also videos (sic!) on our homepage!
http://www.andernfalls.de/sounds.html

Song: Die Zeit (The time)
Click the little pics for the videos.

And hey, I made it even iPhone/iPad compatible :-)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Get Card Name

Post by FourthWorld » Sat Sep 04, 2010 4:56 pm

Bantymom wrote:I feel very silly now, but I very much appreciate the answer! It seems so obvious. How did I miss that?
One of the biggest problems I've encountered in my years of teaching Rev is how often things are almost unbelievably easy. We're so used to programming being mind-bendingly hard.

I still have this problem myself. For example, I learned only in the last year of the "is a color" function, which has made some of my code MUCH simpler.

Even with things I deliver, when we ship to institutions the calls we get from IT staff are often based around an anticipation that installation will be a complex affair with any number of DLLs strewn all over the system. When I tell them that everything the app needs is self-contained in the app's folder and sharing it simply means putting it on a shared volume, I usually have to repeat that a few times before they fully understand that it's really that simple. :)
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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

Re: Get Card Name

Post by Klaus » Sat Sep 04, 2010 5:26 pm

This is so true, Richard! :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10045
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Get Card Name

Post by FourthWorld » Sat Sep 04, 2010 5:29 pm

Klaus wrote:New Songs and also videos (sic!) on our homepage!
http://www.andernfalls.de/sounds.html
Truly great stuff there, Klaus. I don't play much myself (used to play drums and keyboard - not at the same time <g> - in a band back in college, and that was a LONG time ago), but a good many of my friends are musicians and through them I've come to appreciate what it takes to make a band sound as good as yours. Really, really nice work, Klaus. The feel is excellent, but the details no less remarkable, all the way down to the careful levels in the mix. Very well done. Fun stuff.

Being a King Crimson* fan, my only request would be to mix the bass just a little stronger. As a bass player, perhaps you might agree. :) But that's just my own love of bass lines speaking; the mix overall is really quite extraordinary as it is.

* Have you heard Tony Levin's "Stick Man" solo album? Bass lovers rejoice!

This is way OT, but for anyone who's never seen a Chapman Stick in such capable hands this clip shows Levin's Stick Men band exploring the range of the instrument:
http://www.youtube.com/watch?v=0X5j2GaTBjM
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply