Jump to content

Deltoan

Members
  • Posts

    5
  • Joined

  • Last visited

Deltoan's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Yes I did test it, notice that the OP indicates that I'm new to AutoIt. Stupidity would be an assumption on your end. It turns out that the script was working correctly the whole time but due to my error of having the exact same key-press for each execution, I was not able to notice it working properly. Its all good now. Thank you for the help! P.S. I didn't think to use a message box for testing it. Great idea!
  2. Oh wow, I just noticed that the same commands are for each IF statement. I'll adjust that to the right keys presses and test it again. I really shouldn't be doing this at 1 am
  3. I thought the same at first but the line "If $Stage = 0 then" executes every single time I press "o". Even if I don't declare the variable. Just to be sure, I tried declaring it to 0 at the start and sure enough its still only executing the If = 0 line. It should execute If = 1 the 2nd time and If = 2 the third. The fourth would be If = 0 again cause If = 2 sets it back to 0.
  4. I tried using Global and had the same issue. From what I understand, if I don't assign a value to the variable by using "Dim $Stage" or "Global $Stage" then by default, the value of $Stage is 0. Or are you saying that I need to use "Global $Stage = 1" to change the starting value of 0 to 1 in the first IF Statement?
  5. Hello, I have been studying the AutoIt Help files and am currently trying to assign a value to a variable. I'll post the script that I'm using below this message. Basically, I want $Stage to equal 0 at the start and after going through "If $Stage = 0 Then", $Stage's value will change to 1. After If = 1 it changes to 2 and after If = 2 it changes back to 0 to cycle through the If statements again. The issue that I'm having with my current commands is that the value of $Stage does not change from 0. I know this is very basic but its late and I'm not having much luck with it. Thanks in advance for any help. P.S. Sorry for the lack of layout of the text, Its tabbed/spaced properly before submitting the post. I marked the spots that I am questioning proper syntax by making them red. Dim $Stage ;;;;Sets variable for If Statements HotKeySet("o", "Stage") ;;;;Script is triggered when "o" is pressed. While 1 Sleep (100) WEnd ;;;;Required Func Stage () If $Stage = 0 Then $Stage = 1 Send("{numpad4}") Sleep(250) MouseClick("left") Sleep(500) ;;;;If the variable = 0 then the above is executed and the variable's value changes to 1 ElseIf $Stage=1 Then $Stage = 2 Send("{numpad4}") Sleep(250) MouseClick("left") Sleep(500) ;;;;If the variable = 1 then the above is executed and the variable's value changes to 2 ElseIf $Stage=2 Then $Stage = 0 Send("{numpad4}") Sleep(250) MouseClick("left") Sleep(500) ;;;;If the variable = 2 then the above is executed and the variable's value changes to 0 EndIf EndFunc :::::::::::::::::::::::::::::::::::::::::::::::::
×
×
  • Create New...