ID:1040751
 
Code:
mob/monster/DblClick(mob/monster/M) 
if(get_dist(usr,M) <= 1)
if(usr.dex < M.dex)
var/randomness = rand(1,3)
if(randomness == 1)
view() << "[usr.name] attacks [M] and does [usr.atk - M.def] damage!"
M.hp -= usr.atk + M.def
view() << "[M] has [M.hp] left!"
M.Enemy_Death_Check(M)
if(randomness == 2)
view() << "[usr] attacks [M], but misses!"
if(randomness == 3)
view() << "[M] dodges [usr]'s attack!"
else
view() << "[usr] attacks [M] and does [usr.atk - M.def] damage!"
M.hp -= usr.atk + M.def
view() << "[M] has [M.hp] left!"
M.Enemy_Death_Check(M)
else
return


Problem description:

It gives me a runtime error that says: "undefined variable /turf/Cave_Floor/var/dex
proc name: DblClick (/mob/monster/DblClick)
usr: (/mob/Player)
src: Cavern Slime (/mob/monster/Cavern_Slime)
call stack:
Cavern Slime (/mob/monster/Cavern_Slime): DblClick(Cave Floor (8,7,2) (/turf/Cave_Floor), "default.map1", "icon-x=12;icon-y=14;left=1;scr...")"
In response to Matthewkind
The first argument in atom.DblClick() is "location." You're setting M to src's location.

Simply remove M from the arguments and replace M in the body with src because src is the object clicked, while usr is the clicker.