ID:143889
 
Code:
mob/proc
custobj(var/objname)
custom_obj[objname]=new()
custom_obj[objname.icon]=input("What icon do you want?")as icon
custom_obj[objname.icon_state]=input("What icon state should it have?")
custom_obj[objname.name]=input("What do you want to name this object?")
custom_obj[objname.density]=input("What should the density be?") in list(0,1)
custom_obj[objname.opacity]=input("What should the opacity be?") in list(0,1)
objinit = 1
mob
var
custom_obj[obj/]
obj/selectedcustom
verb
Define_Custom_Object()
set category = "Build"
custobj(var/objnum = input("What is this object going to be called in the object list?"))
Custom_Object()
set category = "Build"
if(objinit == 0)
custobj(var/objnum = input("What is this object going to be called in the object list?"))
else
var/obj/o=new(src.loc)
o.name=selectedcustom.name
o.icon=selectedcustom.icon
o.icon_state=selectedcustom.icon_state
o.density=selectedcustom.density
o.opacity=selectedcustom.opacity
o.Owner=src.key
o.Move(src.loc)
Select_Custom_Object
set category = "Build"
selectedcustom = input("Which Object?") in list custom_object


Problem description:
I have no idea what I'm doing at this point. I'm trying to make a dynamic custom object system so a player can have any amount of custom objects as they please. Unfortunately, lists are being satanic to me and I have MORE than enough errors. If anyone cares to tackle this code monster I would appreciate it.
The immediate error i get is this : custom_object: expected end of statement
if I delete the Select custom object verb it tells me that None of the vars in the custom_object list have been initialized.

in custom_object

Not
in list custom_object




In response to Stefm
Thanks for that
but thats not the only problem:
WRPG.dm:245:error:var/objnum:undefined var
WRPG.dm:249:error:var/objnum:undefined var
WRPG.dm:697:error:objname.icon:undefined var
WRPG.dm:698:error:objname.icon_state:undefined var
WRPG.dm:699:error:objname.name:undefined var
WRPG.dm:700:error:objname.density:undefined var
WRPG.dm:701:error:objname.opacity:undefined var
WRPG.dm:480:error:obj/:undefined var
also:
Revision
mob
var
list/custom_obj[obj/]
obj/selectedcustom
mob/proc
custobj(var/objname)
custom_obj[objname] = new()
custom_obj[objname.icon] = input("What icon do you want?")as icon
custom_obj[objname.icon_state] = input("What icon state should it have?")
custom_obj[objname.name] = input("What do you want to name this object?")
custom_obj[objname.density] = input("What should the density be?") in list(0,1)
custom_obj[objname.opacity] = input("What should the opacity be?") in list(0,1)
objinit = 1
mob
verb
Define_Custom_Object()
set category = "Build"
custobj(input("Object name?"))
Custom_Object()
set category = "Build"
if(!custom_obj.len)
custobj(input("Object name?"))
else
var/obj/o=new(src.loc)
o.name=selectedcustom.name
o.icon=selectedcustom.icon
o.icon_state=selectedcustom.icon_state
o.density=selectedcustom.density
o.opacity=selectedcustom.opacity
o.Owner=src.key
o.Move(src.loc)
Select_Custom_Object()
set category = "Build"
selectedcustom = input("Which Object?") as obj in custom_object
In response to WarLin
WarLin wrote:
    custobj(var/objname)


var/objname is a single variable, not a reference such as using var/mob/M or var/obj/O.
In response to RedlineM203
Yes but how does that help me?
In any case
The only issues i have in the code that I can see right now is the proc I have for setting the parameters for the custom object.
It doesnt recognize any of the variables.
also i fixed the var name in the select_obj verb thing
mob/proc
custobj(var/obj/objname)
objname.icon = input("What icon do you want?")as icon
objname.icon_state = input("What icon state should it have?")
objname.name = input("What do you want to name this object?")
objname.density = input("What should the density be?") in list(0,1)
objname.opacity = input("What should the opacity be?") in list(0,1)
objname = new(custom_obj)


I think I'm getting close =D
anyways, now the problem is is that its uh giving me an error saying I cant change something or something in game
WarLin wrote:
custom_obj[obj/]

That syntax doesn't work; you need to put a length in the brackets, not a type.

Unlike a language like C, lists in DM don't have a type.

Lummox JR
In response to Lummox JR
But see, that doesnt help me either ;_;
we're past that.
thanks anyways