# Calculation Problems

## Recommended Posts

Global $ratio = 50 Global$hprtio

If $msg =$button_ratio Then

GUICtrlRead($input_ratio)$ratio = $input_ratio$hprtio = Int($ratio * 0.89) + 36 MsgBox(1, "", "hprat:" &$hprtio & " ratio: " & $ratio) EndIf For some reason,$ratio always ends up being 3, I'm not understaind why. Could anyone tell me if I'm doing something wrong?

##### Share on other sites

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

##### Share on other sites

maybe

If $msg =$button_ratio Then
$ratio = GUICtrlRead($input_ratio)
;$ratio =$input_ratio
$hprtio = Int($ratio * 0.89) + 36
MsgBox(1, "", "hprat:" & $hprtio & " ratio: " &$ratio)
EndIf

8)

##### Share on other sites

maybe

If $msg =$button_ratio Then
$ratio = GUICtrlRead($input_ratio)
;$ratio =$input_ratio
$hprtio = Int($ratio * 0.89) + 36
MsgBox(1, "", "hprat:" & $hprtio & " ratio: " &$ratio)
EndIf

8)

Thanks, that fixed it!

Welcome

8)

##### Share on other sites

what fixed it is u never assigned a variable to the guictrlread

if wanted u can squeeze it all in one line

If $msg =$button_ratio Then
MsgBox(1, "", "hprat:" & Int(GUICtrlRead($input_ratio) * 0.89) + 36 & " ratio: " & GUICtrlRead($input_ratio))
EndIf

##### Share on other sites

what fixed it is u never assigned a variable to the guictrlread

if wanted u can squeeze it all in one line

If $msg =$button_ratio Then
MsgBox(1, "", "hprat:" & Int(GUICtrlRead($input_ratio) * 0.89) + 36 & " ratio: " & GUICtrlRead($input_ratio))
EndIf
More lines is always cooler.. If you say to someone like, i wrote a 3 line script even though it is amazing sounds less cool then i wrote a 600 line script ( and all it did is build 20 GUI's)..

##### Share on other sites

More lines is always cooler.. If you say to someone like, i wrote a 3 line script even though it is amazing sounds less cool then i wrote a 600 line script ( and all it did is build 20 GUI's)..

ok?

lol im just saying for simplicity purposes, for bragging writes as long as u dont show a person your script u can go with i made a 30,000 line script

##### Share on other sites

ok?

lol im just saying for simplicity purposes, for bragging writes as long as u dont show a person your script u can go with i made a 30,000 line script

Ha i think it'll be funny if you wrote a random-script creator that you could fill all the lines in for..

Wow, this would come close to a creative AI if you keep rerunning it and run what it has made.

##### Share on other sites

To illustrate what i'm saying:

$file = FileOpen("RandomScript.au3", 2) Dim$result
$1 = "Dim$woot"

$result =$result & "Dim $woot" & @CRLF While 1$next = Round(Random(2,10))
If $next < 4 then$result = $result & "MsgBox(0, 'result',$woot)" & @CRLF
ExitLoop
Else
$2 = "$woot = $woot + " & Random(0, 5)$result = $result &$2 & @CRLF
EndIf
WEnd
FileWrite($file,$result)
FileClose(\$file)
Run('C:\Program Files\AutoIt3\beta\autoit3.exe "D:\RandomScript.au3"')

## Create an account

Register a new account

×

• Wiki

• Back

• Git