ID:262489
 
Code:
encrypt(atom/ref,g)
var/n=0
var/t=0
for(var/a in ref.vars)
world<<ref.vars[a]
if(isnum(ref.vars[a]))
n++
if(!(n%g))t/=n
else t*=n
return t


Problem description:
Most vars are a num, but isnum() isn't picking it up! Is there anyway to fix this?
Ol' Yeller wrote:
Most vars are a num, but isnum() isn't picking it up! Is there anyway to fix this?

Indeed; you have to stop assuming those vars are actually numbers. If isnum() says they aren't, they aren't. They're really a string or something else.

Lummox JR
In response to Lummox JR (#1)
o.O
So vars are strings entirely?
Because I did:
mob
var
a=7
j=9

And it should come out as numbers unless they get treated as text strings in the var list. :/
Ol' Yeller wrote:
Code:
> encrypt(atom/ref,g)
> var/n=0
> var/t=0
> for(var/a in ref.vars)
> world<<ref.vars[a]
> if(isnum(ref.vars[a]))
> n++
> if(!(n%g))t/=n
> else t*=n
> return t
>


Problem description:
Most vars are a num, but isnum() isn't picking it up! Is there anyway to fix this?

Simple work around:
var/Test=ref.vars[a]
if(isnum(Test))