handler
proc
playeronebench()
var/obj/x = player1.GetClick()
if(istype(x,/obj/cancel))
return 1
if(istype(x,/obj/card/)&&x in player1.hand)
var/obj/free_spot //used to reference the free card slot.
for(var/obj/table/bench/b in table)
for(var/obj/card/c in b.loc) //for cards in the location it's currently looking
continue //If there's already a card on the spot, continue searching.
//Here is where if the loop ran completely through, and no free spots.
player1<<"\red You don't have any bench space!"
return 1
player1.hand -= x
Okay nevermind, it was as simple as this: EDIT: That actually doesn't work either >_>
playeronebench()
for()
var/obj/x = player1.GetClick()
if(istype(x,/obj/cancel))
return 1
else if(istype(x,/obj/card/)&&x in player1.hand)
for(var/obj/table/bench/b in table)
var/obj/card/c
if(c in b) //if there's a card in that slot...
continue //keep looking
else //else if there's no card in the slot...
x.loc = b.loc
player1.hand -= x
player1.Updategrids()
break
else //something that you shouldn't click.
continue //repeat it all lol
Ok, and then I final figured it out- it was all in the process of elimination!
playeronebench()
for()
var/obj/x = player1.GetClick()
if(istype(x,/obj/cancel))
world<<"u select cancel noob."
return 1
else if(istype(x,/obj/card/)&&x in player1.hand)
var/list/bench_pieces = new
for(var/obj/table/bench/b in table) //add all benches to the list
bench_pieces += b
for(var/obj/table/a in bench_pieces) //looking through bench pieces...
for(var/obj/card/c in a.loc) //find peices of the bench with a card already in it...
bench_pieces -= a //remove that from the list of available slots.
if(!bench_pieces.len) //no available slots!
player1<<"\red There is no room on the bench."
return 1
else //else, if there is available slots...
for(var/obj/table/t in bench_pieces) //pick one in the available
x.loc = t.loc
player1.hand -= x
player1.Updategrids()
break //break this and see if you want to place more cards :)
else //something that you shouldn't click.
continue //repeat it all lol