Sign in to follow this  
Followers 0
mistersquirrle

Math issues

4 posts in this topic

I'm having issues with some math for a program I'm making. I have 2 variables, $Var1 and $Var2. $Var1 is a preset value from a GUI that is then written to a ini file, and read to $Var1 later. $Var2 is a number read from the source of a web page, and I've made sure that all formatting in the number is removed.

I've tested it with just straight numbers (no variables) and that works fine, and with setting the variables right before they're used, and that works fine, so what's wrong with how this is set up?

If $Var1 > $Var2 Then
    $Var1 = $Var2
EndIf

RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites



As it is, there should be no problem.

Did you try printing your $Var1 and $Var2, prior to entering the IF condition?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Lol, reading from INI file will make the variable(dynamic, very confusing!) as string so.

If Int($Var1) > Int($Var2) Then
    $Var1 = Int($Var2)
EndIf

This should do the job.

Now $Var1 is Int and you no longer required to use Int()

>> To point out this is the weakness of this, it gets confusing when your program becomes big(hard to find bug)

Edited by athiwatc

Share this post


Link to post
Share on other sites

Did you try printing your $Var1 and $Var2, prior to entering the IF condition?

I don't know what printing the variable is but...

Lol, reading from INI file will make the variable(dynamic, very confusing!) as string so.

If Int($Var1) > Int($Var2) Then
    $Var1 = Int($Var2)
EndIf

This should do the job.

Now $Var1 is Int and you no longer required to use Int()

this worked, thanks for the fast reply. I was looking for something like this in the help file but I didn't see the Int() function.

both of y'alls help is much appreciated >_<


RAWR! I'm hungry :( Feed the panda squirrle

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0