I think i found a bug



  • I was using javascript function to generate random numbers(i know there is function in bas already, came to know it later) :
    lets say i set, max_variable = 100 AND min_variable = 90 , so random numbers results should be from 90-100 but the results are generating from 0 to 100

    syntax of javascript function:
    Math.floor(Math.random()*(max_variable-min_variable+1)+min_variable);
    so the random numbers are genrated from 0 to 100

    when i put the value of min_variable at the last part of javascript function manually it works perfectly, so it means that BAS is not able to put value of min_variable(in BOLD) -->> Math.floor(Math.random()*(max_variable-min_variable+1)+min_variable);



  • Update: i was reading the integer numbers from a text file and BAS was reading it as string so i think that is the problem, so if any math operations are performed it is creating problems? can you please tell me how to convert string to integer or i am doing something wrong? @support


  • administrators

    @niceusername

    Fixed bug with random number.

    an you please tell me how to convert string to integer or i am doing something wrong?

    String to integer can be converted with "Increase Variable" with 0 param.



  • @support thank you for the fix but i have about 10 variables which is read through file, although they are integers, i need to convert them to integers using javascript parseInt([[VARIABLE]]) function, and similar problem occurs when int type is used with database by importing csv file. It will be awesome if you add a new function which converts string numbers to integers numbers in bulk so we don't need to convert them one by one, it will be easy for beginners also :)


  • administrators

    @niceusername You need to use for or foreach action.



  • @support When i used int type data in database, BAS still read that as string data, although i now know how to convert it to int data but i want to improve BAS.
    Thank you


Log in to reply
 

Looks like your connection to Bablosoft was lost, please wait while we try to reconnect.