if(int(getcvar "this") != 1) or if(int(getcvar "that") != "1")
or
if(int(getcvar this1) != "1") or if(int(getcvar this1) != 1)
or same with if(getcvar this1 != "1")
what do the quotes do/mean and how should they be used?
int ?
Moderator: Moderators
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
an integer is a whole number like 1 or 2 a float is decimal like 1.5 or 3.9 you may have seen it when creating random numbers as well
local.num = randomint(26) 0 to 25
local.num = randomfloat(26) 0 to 25.9999 ? not sure now many decimal places it uses may only be 2 or could be 10 I don't know
The point is don't use quotes with numbers as was said if you don't use int(getvar whatever) then you will get a string you can use quotes in that case
if( (getcvar whatever) == "1") // ok
if ( int( getcvar whatever) == "1") // wrong
if ( int( getcvar whatever) == 1) //ok
local.num = randomint(26) 0 to 25
local.num = randomfloat(26) 0 to 25.9999 ? not sure now many decimal places it uses may only be 2 or could be 10 I don't know
The point is don't use quotes with numbers as was said if you don't use int(getvar whatever) then you will get a string you can use quotes in that case
if( (getcvar whatever) == "1") // ok
if ( int( getcvar whatever) == "1") // wrong
if ( int( getcvar whatever) == 1) //ok


