ID:139303
 
Code:
client/Topic(href,list[])
if(list["CardB"])
var/CardPath = "/obj/Cards/Base/[list["CardB"]]"
var/obj/Cards/A = new CardPath
if(findtext(usr.Deck, "[list["CardB"]]"))
usr << output("<b><font color = red>Error -</b> You can not have more then one of the same card in your deck at one time!","Default.Chat")
else
usr << output("<B><Font color = green>Deck Editor -</b> [A] has been added to your deck.","Default.Chat")
usr.Deck += A
A.suffix = "<font color = [A.FColor]><b>[A.HealthPoints]/[A.Type]"
A.Owner = usr.key
A.TurnFront()


Problem description:
I'm trying to make it to where they can't have more then one card in there one deck, but everytime I run it, it seems to get past the findtext and add the same card everytime without an errior. I figure I'm using the wrong thing to do this, please help?
findtext() is for use on text strings, not lists. Use Find() instead.
In response to Garthor
<code>
if(usr.Deck.Find("[list["CardB"]]"))
I tried that but it did the same thing, is there a different way I'm suppose to put it?
In response to Isadore
Well, another issue is that your deck contains instances of card objects, not text strings. So, you'll either need to use the \ref text macro to pass a reference to an actual object to Topic(), or you'll have to end up looping through the entire deck comparing the names to list["CardB"]