Sign in to follow this  
Followers 0
miketh2005

How to script if a variable's number is between one interger and another?

3 posts in this topic

So I am using MouseGetPos, and I want a function to start if the mouse is inside a square area on the screen.

I want to do something like this:

$var = MouseGetPos()

If $var[0] [is between 69 - 84]

and $var[1] [is between 38 - 57]

Then Func()

I know this isn't correct, so how would I script this?

If this script was correct, then it would work, right? It would start the function when the mouse is between those coordinates, effectively a square, right? Thanks.

Btw, I see that And is a function, yet I can find nothing about it in the help file?

Thanks.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello miketh2005,

Maybe this will help:

$var = MouseGetPos()
If $var[0] >= 69 And $var[0] <= 84 And $var[1] >= 38 And $var[2] <= 57 Then Func()

The operator 'And' is covered in the helpfile along with many of the other 'Operators'.

Realm

Edited by Realm

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

Hello miketh2005,

Maybe this will help:

$var = MouseGetPos()
If $var[0] >= 69 And $var[0] <= 84 And $var[1] >= 38 And $var[2] <= 57 Then Func()

And is covered in the helpfile along with many of the other 'Operators'.

Realm

Thanks so much. That is a simple way to do it!

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