ID:1361614
 
(See the best response by Neimo.)
good afternoon this is my problem:
when talking to NPC and try to buy the explosive tag tells me :

runtime error: Cannot create objects of type null.
proc name: DblClick (/mob/npc/Merchant2/DblClick)
usr: JAIDER (/mob)
src: Vendedor de Armas arrojadizas (/mob/npc/Merchant2)
call stack:
Vendedor de Armas arrojadizas (/mob/npc/Merchant2): DblClick(JAIDER (/mob))
JAIDER (/mob): HablarconF()
//-------------------------------------------//
this is the code of NPC
mob/npc
Merchant2
name = "Vendedor de Armas arrojadizas"
icon = 'waterwots.dmi'
icon_state="salesperson"
DblClick()
if(src in oview(2))
var/list/cosas
cosas = new/list()
cosas.Add(/obj/ExplodingTag)
var/list/cosas2=list()
for(var/F in cosas)
if(F==/obj/ExplodingTag)continue
var/obj/A=new F
A.dir=1
A.name="[A.name] - [A.price]"
cosas2+=A
var/obj/b=skinput(usr,"Que deseas comprar hoy?",options=cosas2,wait=6)
del cosas
del cosas2
if(!b)return
b.name=b.oname
if(b.name=="Sello Explosivo")
var/cuanto = skinwrite(usr,"Cuantos [b.name](s) quieres comprar?")//html
if(!cuanto)return
cuanto=text2num(cuanto)
if(!isnum(cuanto))
usr<<"Escribe solo numeros!"
return
if(usr.Yen >= cuanto*b.price&&cuanto>0)
var/contador=0

for(var/obj/ExplodingTag/Q in usr.contents)
if(Q.name==b.name)
contador+=1

if(b.name=="Sello Explosivo"&&contador>=20)
usr<<"Solo puedes tener 20 al mismo tiempo!"
return
if(b.name=="Bomba de Humo"&&contador>=20)
usr<<"Solo puedes tener 10 al mismo tiempo!"
return
usr.Yen -= cuanto*b.price
if(contador<=0)
var/obj/ExplodingTag/Q = "/obj/[b.name]"
Q=new Q
Q.loc = usr
Q.ammount+=cuanto
Q.name= "[Q.name] ([Q.ammount])"
goto com
else
for(var/obj/ExplodingTag/Q in usr.contents)
if(Q.name==b.name)
Q.ammount+=cuanto
Q.name= "[Q.name] ([Q.ammount])"
break
com
usr<<'monedas.ogg'
usr<<"Gracias por tu compra!"
usr.SaveT()
return
else
usr<<"No tienes suficiente dinero!"
return

and this is the code of obj:
obj
ExplodingTag
name = "Sello Explosivo"
oname = "Sello Explosivo"
icon = 'explodingtag.dmi'
worn = 0
price = 1000
verb
Poner_sello_explosivo()
if(usr.firing||usr.Frozen)
usr<<"No puedes hacer esto ahora"
return
if(usr.tagset>=5)
usr<<"Solo puedes tener equipados 5 a la vez."
return
if(!src.tagset)
var/obj/ExplodingTag/B = new/obj/ExplodingTag
B.loc = src.loc
B.Gowner=usr
B.tagset=1
usr.tagset+=1
B.icon_state="fire"
usr.verbs+= new /mob/tag/verb/Explode
for(var/obj/ExplodingTag/O in usr.contents)
O.ammount-=1
if(O.ammount<=0)
del(O)
else
src.name="[O.oname] ([O.ammount])"

usr.random=rand(1,3)
if(usr.random==3)
usr<<"Tu habilidad de trampas aumenta!"
usr.trapskill+=100


hope please help me as I'm about to go crazy ._.
Best response
Another thing is that he is trying to create an object that isn't defined.

var/obj/ExplodingTag/Q = "/obj/[b.name]"
translates to, with his next line:
Q = new "/obj/Sello Explosivo"

I doubt that's the intended way he wanted to do it, though. Which means he should be using the type variable instead.

var/obj/ExplodingTag/Q = new(usr)
// Q = new "/obj/[b.name] this line isn't even needed
Q.amount += x
Q.name = Q.name + " ([Q.amount])"
the problem persists after placing this code :/
                            var/obj/ExplodingTag/Q = new(usr)
Q.ammount+=cuanto
Q.name= Q.name +"([Q.ammount])"
goto com

runtime error: Cannot create objects of type null.
proc name: DblClick (/mob/npc/Merchant2/DblClick)
usr: JAIDER (/mob)
src: Vendedor de Armas arrojadizas (/mob/npc/Merchant2)
call stack:
Vendedor de Armas arrojadizas (/mob/npc/Merchant2): DblClick(JAIDER (/mob))
JAIDER (/mob): HablarconF()
In response to JEY_SENSEY
Anywhere in your code place this:

#define debug 1

After you do that, run the code and tell me what the error says this time.
follows the same type of error:-s
//---------------------
runtime error: Cannot create objects of type null.
proc name: DblClick (/mob/npc/Merchant2/DblClick)
usr: JAIDER (/mob)
src: Vendedor de Armas arrojadizas (/mob/npc/Merchant2)
call stack:
Vendedor de Armas arrojadizas (/mob/npc/Merchant2): DblClick(JAIDER (/mob))
JAIDER (/mob): HablarconF()
//----------------------
In response to JEY_SENSEY
mob/merchant
DblClick()
var/mob/m = usr
if(get_dist(src, m) > 2)
m << "too far away"
return
// generate the list of objects
var/list/items = list(new/obj/apple, new/obj/orange)
var/list/display = new
// update the display list
for(var/obj/o in items)
display["[o.name] - [o.price]"] = o
// select the desired item
var/x = input(usr, "desc", "title") in display
var/obj/o = display[x]
// now purchase it
switch(alert(m, "are you sure you want to buy [o.name]?", "purchase", "yes", "no"))
if("no")
return
// check whether the user already has it
if(locate(o) in m.contents)
// increase the quantity
o = locate(o) in m.contents // iffy about this
o.amount ++
else
m.contents += o
o.amount = 1
m << "you purchased \a [o.name]"
I'm sorry and thanks so much but it's not what I'm looking for, my problem is that I recognize that specific object and the others if as I put in the complete code below:
mob/npc
Merchant2
name = "salesman"
icon = 'waterwots.dmi'
icon_state="salesperson"
DblClick()
if(src in oview(2))
var/list/cosas
cosas = new/list()
cosas.Add(/obj/Shuriken,/obj/Kunai,/obj/ExplodingTag,/obj/Bombadehumo,/obj/Windmill,/obj/Trikunai)
var/list/cosas2=list()
for(var/F in cosas)
if(F==/obj/Shuriken&&F==/obj/Kunai&&F==/obj/ExplodingTag&&F==/obj/Bombadehumo&&F==/obj/Windmill&&F==/obj/Trikunai)continue
var/obj/A=new F
A.dir=1
A.name="[A.name] - [A.price]"
cosas2+=A
var/obj/b=skinput(usr,"You want to buy today?",options=cosas2,wait=6)//input into the skin leaving with icons.
del cosas
del cosas2
if(!b)return
b.name=b.oname
if(b.name=="Shuriken"||b.name=="Kunai"||b.name=="Bomba de Humo"||b.name=="Sello Explosivo")
var/cuanto = skinwrite(usr,"few [b.name](s) want to buy?")//enter the amount on skin input
if(!cuanto)return//after entering the amount of explosives or bombs seals get the error this:
/*
runtime error: Cannot create objects of type null.

proc name: DblClick (/mob/npc/Merchant2/DblClick)
usr: JAIDER (/mob)
src: salesman (/mob/npc/Merchant2)
call stack:
salesman (/mob/npc/Merchant2):
DblClick(nameusr (/mob))
nameusr (/mob): talkverb()
*/

//the strange thing is that only fail pump seals and other objects the perfect work.
cuanto=text2num(cuanto)
if(!isnum(cuanto))
usr<<"Enter just numbers!"
return
if(usr.Yen >= cuanto*b.price&&cuanto>0)
var/contador=0
for(var/obj/Shuriken/O in usr.contents)
if(O.name==b.name)
contador+=1

for(var/obj/Kunai/P in usr.contents)
if(P.name==b.name)
contador+=1

for(var/obj/ExplodingTag/Q in usr.contents)
if(Q.name==b.name)
contador+=1

for(var/obj/Bombadehumo/R in usr.contents)
if(R.name==b.name)
contador+=1

for(var/obj/Windmill/S in usr.contents)
if(S.name==b.name)
contador+=1

for(var/obj/Trikunai/T in usr.contents)
if(T.name==b.name)
contador+=1

if(b.name=="Sello Explosivo"&&contador>=20)
usr<<"You can only have 20 at the same time!"
return
if(b.name=="Bomba de Humo"&&contador>=20)
usr<<"You can only have 10 at the same time!"
return
usr.Yen -= cuanto*b.price
if(contador<=0)
var/obj/Shuriken/O = "/obj/[b.name]"
O=new O
O.loc = usr
O.ammount+=cuanto
O.name= "[O.name] ([O.ammount])"
goto com

var/obj/Kunai/P = "/obj/[b.name]"
P=new P
P.loc = usr
P.ammount+=cuanto
P.name= "[P.name] ([P.ammount])"
goto com
//------------------------- THESE ARE THE SEALS
var/obj/ExplodingTag/Q = "/obj/[b.name]"
Q=new Q
Q.loc = usr
Q.ammount+=cuanto
Q.name= "[Q.name] ([Q.ammount])"
goto com
//-------------------------- THESE IS A BOMBS
var/obj/Bombadehumo/R = "/obj/[b.name]"
R=new R
R.loc = usr
R.ammount+=cuanto
R.name= "[R.name] ([R.ammount])"
goto com
//---------------------------------------------
var/obj/Windmill/S = "/obj/[b.name]"
S=new S
S.loc = usr
S.ammount+=cuanto
S.name= "[S.name] ([S.ammount])"
goto com

var/obj/Trikunai/T = "/obj/[b.name]"
T=new T
T.loc = usr
T.ammount+=cuanto
T.name= "[T.name] ([T.ammount])"
goto com
else
for(var/obj/Shuriken/O in usr.contents)
if(O.name==b.name)
O.ammount+=cuanto
O.name= "[O.name] ([O.ammount])"
break

for(var/obj/Kunai/P in usr.contents)
if(P.name==b.name)
P.ammount+=cuanto
P.name= "[P.name] ([P.ammount])"
break

for(var/obj/ExplodingTag/Q in usr.contents)
if(Q.name==b.name)
Q.ammount+=cuanto
Q.name= "[Q.name] ([Q.ammount])"
break

for(var/obj/Bombadehumo/R in usr.contents)
if(R.name==b.name)
R.ammount+=cuanto
R.name= "[R.name] ([R.ammount])"
break

for(var/obj/Windmill/S in usr.contents)
if(S.name==b.name)
S.ammount+=cuanto
S.name= "[S.name] ([S.ammount])"
break

for(var/obj/Trikunai/T in usr.contents)
if(T.name==b.name)
T.ammount+=cuanto
T.name= "[T.name] ([T.ammount])"
break

com
usr<<'monedas.ogg'
usr<<"Thank you for your purchase!"
usr.SaveT()
return
else
usr<<"You do not have enough money!"
return

if(usr.Yen>=b.price)
var/i=0
for(var/obj/Windmill/R in usr.contents)
i+=1
for(var/obj/Trikunai/R in usr.contents)
i+=1
if(i>1)
usr<<"You can only have 2 at the same time!"
return
usr.Yen-=b.price
b.loc=usr
usr<<'monedas.ogg'
usr<<"Thank you for your purchase!"
usr.SaveT()
else
usr<<"Thank you for your purchase!"
In response to JEY_SENSEY
You're saying that works?
sorry what is he referring to? , My English is not very good
okey thank you very much for your help I solved the porblema the, as you said he was creating an object with a name that did not exist in the codes, which ise was to replace this code:
obj
ExplodingTag//different names
name = "Sello Explosivo"//different names
oname = "Sello Explosivo"
icon = 'explodingtag.dmi'
worn = 0
price = 1000
verb
Poner_sello_explosivo()
//etc...etc...etc..

for this other:
obj
Sello_Explosivo//equal names
name = "Sello_Explosivo"//equal names
oname = "Sello_Explosivo"//equal names
icon = 'explodingtag.dmi'
worn = 0
price = 1000
verb
Poner_sello_explosivo()

thank you very much for your help and your patience :)
**RESOLVED**