Jump to content
Sign in to follow this  

Variable with calculation

Recommended Posts

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

func calc($tmp,$tmp2)

;If + inside $tmp
if stringinstr($tmp,"+") Then

        ;Return $tmp2 and calculate + $tmp
    return $tmp2 + stringreplace($tmp,"+","")
        ;Return $tmp2 and calculate - $tmp
    return $tmp2 - stringreplace($tmp,"-","")

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...