mistersquirrle Posted August 24, 2009 Share Posted August 24, 2009 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 We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
omikron48 Posted August 24, 2009 Share Posted August 24, 2009 As it is, there should be no problem. Did you try printing your $Var1 and $Var2, prior to entering the IF condition? Link to comment Share on other sites More sharing options...
WolfWorld Posted August 24, 2009 Share Posted August 24, 2009 (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 August 24, 2009 by athiwatc Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
mistersquirrle Posted August 24, 2009 Author Share Posted August 24, 2009 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 >_< We ought not to misbehave, but we should look as though we could. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now