Jump to content

# How do I add to my variable...?

## Recommended Posts

Let me start by saying sorry, this is probably an easy solution, but I've searched the help program and haven't found it. So what I'm trying to do is add to a variable i.e. \$var + 1. Here is exactly what I'm trying to do:

\$mouse = MouseGetCursor()

If \$mouse > 0 Then

\$pos = MouseGetPos()

Do

\$pos[0] + 1 = \$pos[0] PROBLEM

\$pos[1] + 1 = \$pos[1] PROBLEM

MouseMove(\$pos[0], \$pos[1], 0)

\$mouse2 = MouseGetCursor()

Until \$mouse2 = 0

EndIf

I'm want it do add one each time it goes through the do loop thereby making my mouse go diagonal.

It may also be a problem that I'm adding to an array? I'm not sure.. Anyways thanks, sorry about the dumb question.

#### Share this post

##### Share on other sites

I know I dealt with this before, I am nearly certain, that I put in a line, to re-define the value, by ading 1 to the value, in other words like...

\$var = 1

Blah Blah

\$var = \$var + 1

Blah Blah

\$var = \$var +1

Obviously my syntax is all wrong, but until one of the experts on here can help you, I'v done my best...

#### Share this post

##### Share on other sites

cdm_Death is right. Here is another way to do it.

```\$mouse = MouseGetCursor()
If \$mouse > 0 Then
\$pos = MouseGetPos()
Do
\$pos[0] += 1
\$pos[1] += 1
MouseMove(\$pos[0], \$pos[1], 0)
\$mouse2 = MouseGetCursor()
Until \$mouse2 = 0
EndIf```
Edited by chris95219

#### Share this post

##### Share on other sites

Thanks a lot, cdm_Death's method worked the other didn't seem to. Either way I've got it doing what I want it to, thanks.

## 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

×

• Wiki

• Back

• Git