ID:147216
 
ok i have two verbs that let players add a card to there deck and remove i get this error when u try to remove
runtime error: cannot append to list
proc name: Remove from deck (/mob/verb/Remove_from_deck)
source file: verbs.dm,49
usr: Kavumaster (/mob/Kavumaster)
src: Kavumaster (/mob/Kavumaster)
call stack:
Kavumaster (/mob/Kavumaster): Remove from deck()

i also belive that when you clcik add it dosnt really add it here are my verbs

Add_to_deck()
var/obj/cards/todeck = input("What would you like to add?") in usr.contents
todeck.Move(deck)
usr << "You have added [todeck.name] to your deck."

Remove_from_deck()
var/obj/cards/fromdeck = input("What would you like to remove?") in usr.deck
usr.contents += fromdeck
usr << "You have taken [fromdeck.name] from your deck."
del fromdeck

Where do you define deck?
In response to Garthor
Garthor wrote:
Where do you define deck?

I'm guessing under his mob/ type. But sure enough if thats true those functions should be under the same mob type.
In response to Green Lime
there under my mob varables i have deck = list() but verbs and it ar not in same file
Kavumaster wrote:
ok i have two verbs that let players add a card to there deck and remove i get this error when u try to remove
runtime error: cannot append to list
proc name: Remove from deck (/mob/verb/Remove_from_deck)
source file: verbs.dm,49
usr: Kavumaster (/mob/Kavumaster)
src: Kavumaster (/mob/Kavumaster)
call stack:
Kavumaster (/mob/Kavumaster): Remove from deck()

i also belive that when you clcik add it dosnt really add it here are my verbs

Add_to_deck()
var/obj/cards/todeck = input("What would you like to add?") in usr.contents
todeck.Move(deck)
usr << "You have added [todeck.name] to your deck."

Remove_from_deck()
var/obj/cards/fromdeck = input("What would you like to remove?") in usr.deck
usr.contents += fromdeck
usr << "You have taken [fromdeck.name] from your deck."
del fromdeck


I can take a guess at usr.contents += fromdeck is where your getting this runtime error. But why you couldnt add any thing to ur contents is beyond me. Umm why not do a fromdeck.Move(usr) :). Try that k.
In response to Green Lime
I find it weird that you're changing the location of this 'fromdeck', then after you changed the location you're deleting it?
How about:
mob/verb/Remove_from_deck()
var/Card=input("What would you like to remove?")in usr.deck
if(Card)
Card:Move(usr)
usr<<"You removed [Card] from your deck!"

Try something like that, then get back to me when it goes wrong.
In response to JohnReaper
hmm says the var/card part is an invalid proc definition oh and thanks for putting up with my bad grammer
In response to Kavumaster
Actually, I salvagged what I could from what Green Lime had written. Though it too was bad, I could make out the errors and what needed to be fixed.
In response to JohnReaper
JohnReaper wrote:
Actually, I salvaged what I could from what Green Lime had written. Though it too was bad, I could make out the errors and what needed to be fixed.

WHATs Bad!
In response to JohnReaper
i think the whole problem with my code is the adding to deck i got a statpanel that looks like this

statpanel("[src.DN]","[src.deck]")

the DN stands for deck name but on the stat panel when i add it to deck it dosnt show up or if i write the code a diffrent way it says

undefined proc or verb /list/Enter()

thats when i write like this

todeck.Move(usr.deck)
In response to Green Lime
prob my writting lol
In response to Green Lime
Green Lime wrote:
JohnReaper wrote:
Actually, I salvaged what I could from what Green Lime had written. Though it too was bad, I could make out the errors and what needed to be fixed.

WHATs Bad!

Not to be picky, but your grammar use, and spelling of words.
In response to JohnReaper
Can you show us exactly how you have the lists defined, and how you use them. Along with the two current verbs you're using. (Add, remove)
In response to JohnReaper
mob/
var
Money = 100.100
Gender
guild
DN="default"
Wins
Loses
music
class
deck = list()
verb
Add_to_deck()
var/obj/cards/todeck = input("What would you like to add?") in usr.contents
todeck.Move(usr.deck)
usr << "You have added [todeck.name] to your deck."


/* Remove_from_deck()
var/obj/cards/fromdeck = input("What would you like to remove?") in usr.deck
fromdeck.Move(usr)
usr << "You have taken [fromdeck.name] from your deck."
*/
Remove_from_deck()
var/obj/cards/card=input("What would you like to remove?")in usr.deck
card:Move(usr)
usr<<"You removed [card] from your deck!"
In response to Kavumaster
i gtg now so cant keep posting if u can make it work or write one yoursef i can use im sure me and my icon artist could give you master Gm in this game
In response to Kavumaster
mob/var
Money = 100
Gender
guild
DN="default"
Wins
Loses
music
class
deck = list()

mob/verb/Add()
set name="Add card to deck"
var/obj/cards/Card=input("Add which card?")in usr.contents
if(Card&&Card.loc==usr.contents)
usr.deck+=Card;usr.contents-=Card
usr<<"You add [Card] to your deck."
mob/verb/RemovE()
set name="Remove card from deck"
var/obj/cards/Card=input("Remove which card?")in usr.deck
if(Card&&Card.loc==usr.deck)
usr.contents+=Card;usr.deck-=Card
usr<<"You remove [Card] from your deck."

Not guaranteed to work, but you get the jiffy of it.
In response to JohnReaper
Thx it works just had to tweak it a little the if statement wasnt working but without it it does(Ill give u perm MGM if i see you on the game ever but i was wondering why on my statpanel

statpanel("src.DN","src.deck")

when playing under ur deck statpanel it gives you the contents of your deck as /list
In response to Kavumaster
Eh? I thought statpanels all ready listed out the items in a list and displayed them! Here's how you fix it:
mob/Stat()
..()
statpanel("Your infinite amount of space in your hands")
stat(contents)
statpanel("The cards you moved from your hands to here")
for(var/i in deck)stat(i)