ID:150174
 
Ok, I have just about everything working in my librarian code, except this. It's the proc that should allow a player to return their library items to the librarian. The items are held in the player's items_on_loan list. It's that way, becuase I didn't want to change every other function in Foomer's code to deal with library items.

Here is the relevant code, if there is something else you need to see, I will post it:

mob/var/items_on_loan[0]

mob/proc/returnstuff(obj/O as obj in usr:items_on_loan, mob/npcs/librarian/L as mob in oview(2))
set name = "Return an Item"
set category = "Librarian"
if(!istype(L,/mob/npcs/librarian))
usr << "You can only return library items to the librarian!"
else
if(O.Move(L.contents))
usr << " The librarian says, 'Thank you!'"
usr:items_on_loan.len--
else
usr << "The item could not be returned!"


Please note, that when the player checks out an item, the length of items_on_loan is incremented once for each item. I tried to use usr.items_on_loan, but got some error that said bad var, or the like. I can re-produce them , if you wish. Thnanks for taking the time to subject yourself to my hideous excuse for DM code! :-)

~X
Variables that arent of the /list type dont have a len variable, as far as I recall. If you want to decrease a number, its as simple as using the -= operator.

Alathon