Making Changes to Other Cards

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Danny
Posts: 106
Joined: Tue Nov 09, 2010 1:28 am

Making Changes to Other Cards

Post by Danny » Sun Feb 06, 2011 3:31 am

First, Thank you to everyone on these boards who have helped me on my quest to build an app :D You have helped me so graciously (even if when was something small). I always like to learn something new and you guys have been so helpful in that. I'm very close to submitting it and I can't wait for you guys to see it. Now on to the main question...
I want to make this look as professional as possible and I was wondering if you could make a change to another card while using another, let me explain... I have a set parameter like if you catch all these balls then you will have one star added to your total on another card. So my question is how do you do that? I know how to make the parameters but I don't know how to make them affect another card.

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

Re: Making Changes to Other Cards

Post by Klaus » Sun Feb 06, 2011 12:38 pm

Hi Danny,

just add a card descriptor to your script(s)!
...
put "This is new text" into fld "Name of field" OF CD "The other card, but not this one"
...
Get the picture?

You can even address objects in different stack this way:
...
put "This is new text" into fld "Name of field" OF CD "The other card, but not this one" OF STACK "The other stack..."
...


Best

Klaus

Danny
Posts: 106
Joined: Tue Nov 09, 2010 1:28 am

Re: Making Changes to Other Cards

Post by Danny » Tue Feb 08, 2011 2:32 am

Hi Klaus,
Happily I did get the picture but when I ran the script I made didn't work the way I wanted (Isn't that always the case :D ). What I wanted it to do is when you catch a certain amount of balls then you get stars. That is displayed on a different card when you look at it.

Code: Select all

  if fld "fBallsCaught" >= fld  "3stars" then 
         add 3 to fld "minBalls" OF stack "Level Select"
         
        if fld "fBallsCaught" >= fld  "2stars" then 
            add 2 to fld "minBalls" of stack "Level Select"
            
               if fld "fBallsCaught" >= fld  "1stars" then 
            put 1 into fld "minBalls" OF stack "Level Select"
            
         end if
          end if 
         end if 

If I'm going to make more levels how am I going to get the script to add to it without surpassing a 75 star limit. Example: I'm playing and I get the max of 3 stars and I go to the next level (next card) and get 2 stars. I play it again and I get 3 stars. If I get 3 stars for all the levels that will go past 75. See what I mean? I want to add to the stars, but I only want it three stars ONCE no matter how many times you play the level.

Thanks,

Danny

dburdan
Posts: 104
Joined: Fri Jan 28, 2011 5:39 am

Re: Making Changes to Other Cards

Post by dburdan » Tue Feb 08, 2011 3:54 am

I'm still new to LiveCode but try removing the "stack" text. Ex:

Code: Select all

if field "fBallsCaught" >= field  "3stars" then
         add 3 to field "minBalls" OF "Level Select"
Or try using a card id:

Code: Select all

if field "fBallsCaught" >= field  "3stars" then
         add 3 to field "minBalls" OF card 2

Danny
Posts: 106
Joined: Tue Nov 09, 2010 1:28 am

Re: Making Changes to Other Cards

Post by Danny » Tue Feb 08, 2011 4:16 am

Hey Burdan,
Opps I was editing this post earlier and for got to remove the code. I was tinkering with it again after I posted it and found out I needed to make it a less than instead of greater than. Thank you for your post though. I'm new to LiveCode (user since December 2010) too and i'm learning more and more by the day. Let me know if I can be of help I can't guarantee any thing but still...

Thanks,

Danny

P.S I'm trying to figure out how to make a field a "stencil" font and I tried the code

Code: Select all

set the textFont of field "fBallsCaught" to "stencil,English"
but it didn't change in the simulator. If you know how this works better that me let me know!

dburdan
Posts: 104
Joined: Fri Jan 28, 2011 5:39 am

Re: Making Changes to Other Cards

Post by dburdan » Tue Feb 08, 2011 4:53 am

Do you mean the font Stencil? If you just want the font then put:

Code: Select all

set the textFont of field "fBallsCaught" to "Stencil"
I don't think you can stencil a specific font.

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

Re: Making Changes to Other Cards

Post by Klaus » Tue Feb 08, 2011 11:59 am

Hi Danny,

please take look at these stacks here:
http://www.runrev.com/developers/lesson ... nferences/
Great resources!


Best

Klaus

Danny
Posts: 106
Joined: Tue Nov 09, 2010 1:28 am

Re: Making Changes to Other Cards

Post by Danny » Sat Feb 12, 2011 4:27 am

Thanks Klaus! I know I should probably start a new topic for this but do you or anyone else know how to keep the users music playing if they enter your app. Eg. if they are listening to their music how can I keep it playing if I have a sound track.

Post Reply