ID:1692115
 
Keywords: error, mismatch, runtime, type
Code:
so I got this error in attempting Falacy's tutorials im not sure how to fix it below is the runtime error and what I believe  to be the relevant code.

Attack()
flick("Attack",src)
for(var/mob/M in get_step(src,src.dir))
var/Damage=max(0,src,Str-M.Def)
view(M)<<"[src] hit [M] for [Damage] Damage"
M.TakeDamage(Damage,src)


runtime error: type mismatch: cannot compare -3 to the enemy1 (/mob/Enemies/enemy1)
verb name: Attack (/mob/verb/Attack)
source file: verbs.dm,15
usr: the enemy1 (/mob/Enemies/enemy1)
src: the enemy1 (/mob/Enemies/enemy1)
call stack:
the enemy1 (/mob/Enemies/enemy1): Attack()
the enemy1 (/mob/Enemies/enemy1): CombatAI()
the enemy1 (/mob/Enemies/enemy1): New(Grass (9,4,1) (/turf/Grass))


Problem description:

max() is looking for only numerical input. src refers to the mob, which is not numerical. Although max() does take more than two arguments into consideration, it's a little bit confusing to use more than two in some cases.

Anyway, that's why you're getting a type mismatch. Take out src from the max() function and leave only max(0,Str-M.Def) and see if this fixes your problem.
Dark sage biko wrote:
Code:
Attack()
flick("Attack",src)
for(var/mob/M in get_step(src,src.dir))
var/Damage=max(0,src,Str-M.Def)
view(M)<<"[src] hit [M] for [Damage] Damage"
M.TakeDamage(Damage,src)
/*
runtime error: type mismatch: cannot compare -3 to the enemy1 (/mob/Enemies/enemy1)
verb name: Attack (/mob/verb/Attack)
source file: verbs.dm,15
usr: the enemy1 (/mob/Enemies/enemy1)
src: the enemy1 (/mob/Enemies/enemy1)
call stack:
the enemy1 (/mob/Enemies/enemy1): Attack()
the enemy1 (/mob/Enemies/enemy1): CombatAI()
the enemy1 (/mob/Enemies/enemy1): New(Grass (9,4,1) (/turf/Grass))
*/

Problem description: so I got this error in attempting Falacy's tutorials im not sure how to fix it below is the runtime error and what I believe to be the relevant code.

It looks like you typed a comma instead of a dot in max(). Big difference!
In response to Mr_Goober
Thank you this worked thanks for the help ^^