ID:147599
 
I currently have a proc called ArrangeCards() which currently works just how I want it. However, I'm having problems calling it:

verb
ArrangeCardsV()
ArrangeCards()


Works fine calling the proc from a verb, but if I try and call it from double-clicking an object, it doesn't:

DblClick()
del(src) //delete the card
usr.ArrangeCards()



And, while I'm at it, any problems you can see with efficiency on Arranging my cards, although it's not a major point, seeing as the project is currently Single-Player:

proc/ArrangeCards(var/Finish)
var/done = 0
for(var/obj/card/C in src.client.screen)
src.client.screen -= C
src.contents.Remove(C)
src.cards.Add(C)
if(Finish) //If battle is ending, finish things off
Finish = null
src.GetCards()
return
if(!src.cards.len)
src << "You have no Cards!"
src.GetCards()

var/amount = src.cards.len
while(done != amount)
for(var/obj/card/Card in src.cards)
switch(done)
if(0)
Card.screen_loc = "4:15,0:9"
if(1)
Card.screen_loc = "5:29,0:9"
if(2)
Card.screen_loc = "7:11,0:9"
if(3)
Card.screen_loc = "8:25,0:9"
if(4) Card.screen_loc = "10:7,0:9"
src.cards.Remove(Card)
src.contents.Add(Card)
src.client.screen += Card
done++


Thanks for any help.
Put the del(src) line at the end of the doubleclick proc. Whenever you delete an object, any of its procedures that were still functioning are killed, so by deleting the source you are terminating that proc before it can call the arranging proc.