Hi guys
I'm having trouble working with some random numbers I'm trying to use.
Here is my code:
function irand(max)
{
local roll = (1.0 * rand() / RAND_MAX) * (max + 1)
return roll.tointeger()
}
local finform = irand(4);
if ( finform = 1 ) finalform.file_name = "1.png" ;
if ( finform = 2 ) finalform.file_name = "2.png" ;
if ( finform = 3 ) finalform.file_name = "3.png" ;
if ( finform = 4 ) finalform.file_name = "4.png" ;
fe.add_text ( finform, 10, 400, 320, 16 );
From what I can tell, it ALWAYS comes up with 4
Can anyone help me debug?
Also one other side point: The add_text at the end is just for debugging, but it doesn't place it at 10, 400, it places it at 0,0 for some reason (I suspect to do with the way the number is formatted).