ID:146252
 
Code:
mob
verb
Add_Item_To_Store_Inventory()
set category = "Roleplay"
if(src.warning3 == 0)
src.warning3 = 1
src << "This verb is for making items if you're making an RP shop, or just to make items. Set a value, name, and icon to each item, and use the other verb to make them (at 50% of the price to you) and sell it to the customer! <B>Note that you must have an icon for the item you create! There are no defaults!</B> (click verb again to activate)"
else
switch(alert("Are you sure you want to make an item? Remember: You MUST have an icon on your computer to use!",,"Yes","No"))
if("Yes")
var/obj/item/X = new /obj/item()
var/Y = input("What price?") as num
if(Y > 1)
X.price = round(Y)
X.icon = input("What icon?") as icon
X.icon_state = input("Icon state?")
X.name = input("Name it")
src.shoplist += X
Make_Item_From_Store_List()
set category = "Roleplay"
switch(alert("Make item? (remember, to create it you must pay half its value, and it will appear IN FRONT of you, so don't be facing a wall)",,"Yes","No"))
if("Yes")
var/obj/item/X = input("Build what?") in src.shoplist
if(src.gold >= round(X.price/2))
src.gold -= X.price/2
var/obj/Y = new X(get_step(src,src.dir))
Y = Y
Get_Item()
set category = "Roleplay"
for(var/obj/O in src.loc)
if(istype(O,/obj/item))
O.loc = null
src.contents += O


Problem description:
what the code is supposed to do, is add an object to your "Shoplist" and allow you to create any item in the "shoplist" for half of its price. It works fine, until I use the second verb (the one that makes it) and I get this runtime error:

runtime error: Cannot create objects of type /obj/item.
proc name: Make Item From Store List (/mob/verb/Make_Item_From_Store_List)
source file: verbs.dm,56
usr: COWDUDE (/mob/Soldier)
src: COWDUDE (/mob/Soldier)
call stack:
COWDUDE (/mob/Soldier): Make Item From Store List()

Cannot create objects of type /obj/item? o_O

var/obj/item/X=new

try that =p
In response to Ol' Yeller
Ol' Yeller wrote:
> var/obj/item/X=new

try that =p

Clearly you did not pay attention to the problem. Please read through problems more thoroughly before trying to help.

He's already creating a new item. The problem is, it's not accepting X as a valid type. The reason is, X is already an object; it's not a type path. Hence he needs to use new X.type(...) instead of new X(...).

Lummox JR