ID:180311
 
Alright, I have the bug. All I want to do is dblclick a simple enemy which in turn will hit him. So this is what I did...

mob/Dummy
var/mob/player/M
name = "Training Dummy"
icon = 'graphics/gfx/Dummy.dmi'
density=1

DblClick()
M.DummyATTACK()

here's the error I get

Cannot execute null.DummyATTACK().
proc name: DblClick (/mob/Dummy/DblClick)
source file: Enemy.dm,67
usr: Goten84 (/mob/player)
src: Training Dummy (/mob/Dummy)
call stack:
Training Dummy (/mob/Dummy): DblClick(the ground (2,0,0) (/turf/ground))
On 7/24/01 9:19 am Goten84 wrote:
Alright, I have the bug. All I want to do is dblclick a simple enemy which in turn will hit him. So this is what I did...

mob/Dummy
var/mob/player/M
name = "Training Dummy"
icon = 'graphics/gfx/Dummy.dmi'
density=1

DblClick()
M.DummyATTACK()

here's the error I get

<font color="yellow">Cannot execute null.DummyATTACK().</font>
proc name: DblClick (/mob/Dummy/DblClick)
source file: Enemy.dm,67
usr: Goten84 (/mob/player)
src: Training Dummy (/mob/Dummy)
call stack:
Training Dummy (/mob/Dummy): DblClick(the ground (2,0,0) (/turf/ground))

Look at the highlighted clue. Notice the mention of "null?" This means that your variable M = null when DblClick is called. Why is it equal to null? Because you haven't set it to anything.

I'm not sure if this is what you want, but most likely you want the person to click to call DummyATTACK(). If this is the case, try usr.DummyATTACK(). Either that or set M to equal usr after you declare the variable.
In response to Skysaw
Look at the highlighted clue. Notice the mention of "null?" This means that your variable M = null when DblClick is called. Why is it equal to null? Because you haven't set it to anything.

I'm not sure if this is what you want, but most likely you want the person to click to call DummyATTACK(). If this is the case, try usr.DummyATTACK(). Either that or set M to equal usr after you declare the variable.

Actually I got this to work, I was just experimenting and wondering why it's not working when I switch things around. Here's the original code that works

mob/Dummy
var/mob/player/M
name = "Training Dummy"
icon = 'graphics/gfx/Dummy.dmi'
density=1
var/think_delay = 10

New()
..()
spawn(rand(1,think_delay)) AILoop()
proc/AILoop()
for(M in view(src))
if(istype(M,/mob/player))
break
if(!M)
spawn(think_delay) AILoop()
return
else
flick(" ",src)
DblClick()
M.DummyATTACK()

It's almost just the same, just a proc at the top. And yea, I tried putting usr.DummyATTACK() and it showed up like this

loading dbaf.dme
Enemy.dm:42:error:usr:bad var
Enemy.dm:42:error:= :expected a constant expression

dbaf.dmb - 2 errors, 0 warnings