ID:263064
 
Code:
Create_Guild_Item(F as file)
set category = "Guild"
if(isfile(F) && isicon(F)) // If F is a file, and an icon
var/list/L
L = list("font size")
var/icon/I = F
switch(alert("Do you wish to use that icon?","Item Icon",,"Yes","No"))
if("Yes")
goto Name
if("No")
return
Name
var/item_name = input("What should it be called?","Guild Item")
if(!item_name)
alert("Item Name may not be blank.")
return
for(var/X in L)
if(findtext(item_name,X))
alert("You may not change your font size.")
return

if(lentext(item_name) > 50)
alert("Cannot be more than 50 Characters!")
return

switch(alert("Do you wish to call your item [item_name]?","Item Name",,"Yes","No"))

if("Yes")
goto Finalise

if("No")
return

Finalise
usr.contents += new /obj/Guild/Item
src.name = item_name
src.icon = I
src.guild_name = usr.guild_name


Problem description:
I need to know what to do to make the obj have those variables not the usr, thanks.
var/obj/O = new /obj/Guild/Item
O.name = item_name
O.icon = I
O.guild_name = src.guild_name
src.contents += O
In response to A.T.H.K
ATHK, it'd be better to locate the object into the usr's contents at new().
In response to Mysame
obj/Guild
Item
Create_Guild_Item(F as file)
set category = "Guild"
if(isfile(F) && isicon(F))
var/list/L
L = list("font size")
var/icon/I = F
var/item_name = input("What should it be called?","Guild Item")
if(!item_name)
alert("Item Name may not be blank.")
return
for(var/X in L)
if(findtext(item_name,X))
alert("You may not change your font size.")
return

if(lentext(item_name) > 50)
alert("Cannot be more than 50 Characters!")
return
var/obj/O = new /obj/Guild/Item
O.name = item_name
O.icon = I
O.guild = usr.guild_name
usr.contents += O

I got it to this but It doesn't add into my inventory when I do it.