ID:155351
 
Ok so i think i have a general idea of how to bank player gold, under checking for a var like src.BankedGOld etc...



but what about Items?

How would I go about storing player items in something, and then checking to see what items that player stored, and insuring they were only getting their items? ANNND most importantly SAVING those items?
mob
var
list
Banked = list()

mob
NPC
verb
Interact()
set src in oview(usr,1)
switch(input("Would you like to deposit items?") in list ("Yes","No"))
if("Yes")
var/obj/X = input("Select an item to place in the bank!") in usr.contents
usr.contents -= X
usr.Banked = X
if("No")
switch("Would you like to make a withdrawal?") in list ("Yes","No"))
if("Yes")
var/obj/X = input("Select an item to withdraw!")
usr.Banked -= X
usr.contents += X


Please pardon the lack of comments, I felt that it was pretty self explanatory. You save the banked items with the player.

EDIT: I suppose you might have been thinking of a master list. In that case you would want something like this

var
list
Bank = list() // Global list Bank

mob
NPC
verb
Interact()
set src in oview(usr,1)
switch(input("Deposit or Withdrawal?") in list ("Deposit","Withdrawal")
if("Deposit")
var/obj/X = input("Select an object to deposit") in usr.contents
usr.contents -= X
X.Owner = usr
Bank += X
if("Withdrawal")
var/list/L = list() // Define L to be an empty list
for(var/obj/O in Bank)
if(O.Owner == usr)
L += O
var/obj/X = input("Select an object to withdraw") in L
Bank -= X
usr.contents += X
del(L)


The problem with that system is that you'd have to devise a little save procedure which would make a save file of the objects in the bank, where the first example is much easier to handle.

2nd Edit: So Sorry! I was missing a few lines because I did a rush job!
In response to Lugia319
Thank you lugia, always find you quite helpful.


Looking for a job xD?
In response to Komuroto
Not at all, I am not nearly skilled enough. But I certainly don't mind helping people if they need it.
In response to Lugia319
I was only joking, i like how you explain something without being too direct, and without being too indirect.


PS:

Saw your comment about "1" !=1 , thought that was rather obvious, even to me! ;)