bobbby Posted April 9, 2010 Share Posted April 9, 2010 How do i make an variable/iniread that can use calculation? I will save +x or -x in the inifile. How can i fix, so it can calculate with the mouse position. I have created an function, but its much slower when i using it. ;Set variables $x = "+5" $y = "+10" $pos = MouseGetPos() ;Move the mouse X + 5 and Y + 10 mousemove(calc($x,$pos[0]),calc($y,$pos[1])) func calc($tmp,$tmp2) ;If + inside $tmp if stringinstr($tmp,"+") Then ;Return $tmp2 and calculate + $tmp return $tmp2 + stringreplace($tmp,"+","") Else ;Return $tmp2 and calculate - $tmp return $tmp2 - stringreplace($tmp,"-","") EndIf EndFunc Link to comment Share on other sites More sharing options...
somdcomputerguy Posted April 9, 2010 Share Posted April 9, 2010 Does this do what you're trying to do? $x = 5 $y = 10 $pos = MouseGetPos() mousemove($x + $pos[0], $y + $pos[1]) - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
bobbby Posted April 9, 2010 Author Share Posted April 9, 2010 Does this do what you're trying to do? $x = 5 $y = 10 $pos = MouseGetPos() mousemove($x + $pos[0], $y + $pos[1]) I want too use the "+5" or "-5" in the inifile. Then use it that way. If i have "-5" inside the ini-file, it should use "5 - $pos[0]" and "5 + $pos[0]" if it's + inside the settings. I just used variables for example. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 9, 2010 Share Posted April 9, 2010 This seems to work: $1 = Number("+4") $2 = Number("-4") MsgBox(0, "", 8 + $1) MsgBox(0, "", 8 + $2) The numbers are defined as strings since IniRead() returns a string. Number() may not be necessary, but it sure feels better to have it there. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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