Deleting several special cards [Solved]

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
atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Deleting several special cards [Solved]

Post by atout66 » Wed Jul 22, 2015 5:03 pm

Hi to all,

I'm trying to delete some cards of a stack with the char "-" in their name.
Example of names of cards to delete: "ach-pach" or "ach-rach", etc.
Here is the code:

Code: Select all

repeat with bb = 1 to the number of cards
               put the short name of card bb into tName       
               if tName <> "premiereCard" then -- we keep always the card where the script is running
                    get offset("-",tName)
                    if IT > "0" then -- "al-mal" for example
                         delete card tName
                    end if
               end if
          end repeat
This code work fine while I'm debugging, but as they are 1621 cards to remove, I put the breakpoints away (normal!) :wink:
Now I get an error which says that it can't find the card "uz" for example.
And this card has no "-" in its name ?!? :shock:

Any idea what's wrong in that code ?
Thanks in advance, Jean-Paul.
Last edited by atout66 on Wed Jul 22, 2015 5:30 pm, edited 1 time in total.
Discovering LiveCode Community 6.5.2.

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

Re: Deleting several special cards

Post by Klaus » Wed Jul 22, 2015 5:18 pm

Bonjour Jean-Paul,

maybe you should start this way:
...
repeat with bb = the number of cards down to 1
...
:D


Best

Klaus

atout66
Posts: 266
Joined: Wed Feb 02, 2011 12:31 pm

Re: Deleting several special cards

Post by atout66 » Wed Jul 22, 2015 5:30 pm

Wouha, fantastic this "the number of cards down to 1" :)
Works perfectly, thanks a lot Klaus.

Regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.

Post Reply