Jump to content

Starting and stopping a loop with keystrokes


Recommended Posts

Hey all, I'm trying to make a script that loops betweeh hitting "R" and "ENTER" when I hit F6, stops when I hit F7, and restarts when I hit F6 again.  (I'm putting a bunch of stuff into a chest in Skyrim, haha).

Here's my code:

 Local $var
Func Simple1()
    $var=1
EndFunc
Func Simple2()
    $var=2
EndFunc
HotKeySet ("{F6}", "Simple1")
HotKeySet ("{F7}", "Simple2")
 Select
     Case $var = 1
            Send ("{ENTER}")
            Send ("{R}")
            Sleep (1000)
            HotKeySet ("{F6}", "Simple1")
            HotKeySet ("{F7}", "Simple2")
     Case $var = 2
         HotKeySet ("{F6}", "Simple1")
         HotKeySet ("{F7}", "Simple2")
     Case Else
         HotKeySet ("{F6}", "Simple1")
         HotKeySet ("{F7}", "Simple2")
 EndSelect

What am I doing wrong?  Is the script just ending itself as soon as it runs?  How do I add a simple "wait for my command" function?

I tried putting a "Sleep" function in the var2 and Else areas, but that didn't seem to help much - the sleep function means the script stops running and accepting input, right?

Thanks for any help.

Edited by 0pie
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...