ID:180653
 
This is my code:

obj
New()
src.verbs += /obj/proc/Use
var
usable
using
used

proc
using()
Use()
switch(src.usable)
if("weapon")
if(usr.weapon == null)
usr.contents -= src
usr.weapon = src
src.verbs += /obj/proc/Stop_using
src.verbs -= /obj/proc/Use
using()
else
usr << "blaha"
if("armor")
if(usr.armor == null)
usr.contents -= src
usr.armor = src
src.verbs += /obj/proc/Stop_using
src.verbs -= /obj/proc/Use
using()
else
usr << "bla bla"
if("special")
if(usr.special == null)
usr.contents -= src
usr.special = src
src.verbs += /obj/proc/Stop_using
src.verbs -= /obj/proc/Use
using()
else
usr << "blaj"

Stop_using()
set src in world
switch(src.usable)
if("weapon")
usr.weapon -= src
if("armor")
usr.armor -= src
if("special")
usr.special -= src
usr.contents += src
src.verbs -= /obj/proc/Stop_using
src.verbs += /obj/proc/Use
usr << "You stop using the [src]."
verb
Get()
set src in oview(1)
Move(usr)


knife
icon = 'kniv.dmi'
usable = "weapon"



and when I try to use the Stop using() (from a statpanel) it gives me this:

type mismatch
verb name: Stop using (/obj/proc/Stop_using)
usr: Kaidorin (/mob/guy)
src: Knife (/obj/knife)
call stack:
Knife (/obj/knife): Stop using()
On 4/17/01 1:37 pm Kaidorin wrote:

and when I try to use the Stop using() (from a statpanel) it gives me this:

type mismatch
verb name: Stop using (/obj/proc/Stop_using)
usr: Kaidorin (/mob/guy)
src: Knife (/obj/knife)
call stack:
Knife (/obj/knife): Stop using()

Try putting
#define DEBUG

at the top of your .dm file, recompiling, and repeating the scenario. It will tell you which line is causing the crash. The code seems to look okay to me, but I'm likely missing something too.
In response to Tom
I did what you told me, this is the line causing the error:

Stop_using()
set src in world
switch(src.usable)
if("weapon")
usr.weapon -= src <------- This line.
if("armor")
usr.armor -= src


I don't get whats wrong with it, any idea?
In response to Kaidorin
I got it working by changing "-= src" to "= null", it gives the same effect. But shoulfn't the "-= src" work?
In response to Kaidorin
On 4/18/01 7:38 am Kaidorin wrote:
I got it working by changing "-= src" to "= null", it gives the same effect. But shoulfn't the "-= src" work?

Oh, I see the problem now. The addition and subtraction operations apply to lists, not individual items. Since 'weapon' is just a reference to an object, you can't subtract things from it. So, yes, assigning it to null is the way to clear it.
In response to Tom
Oh, I see the problem now. The addition and subtraction operations apply to lists, not individual items. Since 'weapon' is just a reference to an object, you can't subtract things from it. So, yes, assigning it to null is the way to clear it.

but I put it into "weapon" using the += operator ;>
In response to Kaidorin
On 4/18/01 8:21 am Kaidorin wrote:
Oh, I see the problem now. The addition and subtraction operations apply to lists, not individual items. Since 'weapon' is just a reference to an object, you can't subtract things from it. So, yes, assigning it to null is the way to clear it.

but I put it into "weapon" using the += operator ;>

You shouldn't, and that's probably a bug if it lets you do that. =)

Actually, if you ran it, you'd probably get a 'type mismatch' error.