Jump to content

Auto typer


tomtom11
 Share

Recommended Posts

hotkeyset ("{UP}", "_Toggle1")
hotkeyset ("{DOWN}", "_Toggle2")
hotkeyset ("{LEFT}", "_Toggle3")
hotkeyset ("{RIGHT}", "_Toggle4")
hotkeyset ("{+}", "_Exit")

Global $Toggle1 = False
Global $Toggle2 = False
Global $Toggle3 = False
Global $Toggle4 = False

while 1
     If $Toggle1 Then
          send("{ENTER}")
          sleep(100)
          send(" cheese steak jimmy's ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
 wend
 
 while 2
     If $Toggle2 Then
          send("{ENTER}")
          sleep(100)
          send(" robin hood ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
 wend
 
 while 3
     If $Toggle3 Then
          send("{ENTER}")
          sleep(100)
          send(" rock on ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
 wend
 
 while 4
     If $Toggle4 Then
          send("{ENTER}")
          sleep(100)
          send(" lumberjack ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
 wend
     

Func _Toggle1()
     $Toggle1 = Not $Toggle1
 EndFunc

Func _Toggle2()
     $Toggle2 = Not $Toggle2
 EndFunc
 
 Func _Toggle3()
     $Toggle3 = Not $Toggle3
 EndFunc
 
 Func _Toggle4()
     $Toggle4 = Not $Toggle4
EndFunc

Func _Exit()
     Exit
EndFunc

This is a macro for sending in cheats in the game age of empires 2. All i can do now is toggle it to type " cheese steak jimmy's ". Any advise on how to make the rest of the toggles workable?

Link to comment
Share on other sites

hotkeyset ("{UP}", "_Toggle1")
hotkeyset ("{DOWN}", "_Toggle2")
hotkeyset ("{LEFT}", "_Toggle3")
hotkeyset ("{RIGHT}", "_Toggle4")
hotkeyset ("{+}", "_Exit")

Global $Toggle1 = False
Global $Toggle2 = False
Global $Toggle3 = False
Global $Toggle4 = False

while 1
     If $Toggle1 Then
          send("{ENTER}")
          sleep(100)
          send(" cheese steak jimmy's ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
Next
 
 while 2
     If $Toggle2 Then
          send("{ENTER}")
          sleep(100)
          send(" robin hood ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
Next
 
 while 3
     If $Toggle3 Then
          send("{ENTER}")
          sleep(100)
          send(" rock on ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
Next
 
 while 4
     If $Toggle4 Then
          send("{ENTER}")
          sleep(100)
          send(" lumberjack ")
          sleep(100)
          send("{ENTER}")
          sleep(1000)
     EndIf
     Sleep(100)
 Next
 WEnd

Func _Exit()
     Exit
EndFunc

this wont work probably.. you only asked for an 'idea'

[quote name='AceLoc']I gots new sunglasses there cool.[/quote]

Link to comment
Share on other sites

  • Developers

dunno the game but you will get stuck in the first While-Wend which is never ending

Maybe you mean something like this:

HotKeySet("{UP}", "_Toggle1")
HotKeySet("{DOWN}", "_Toggle2")
HotKeySet("{LEFT}", "_Toggle3")
HotKeySet("{RIGHT}", "_Toggle4")
HotKeySet("{+}", "_Exit")

Global $Toggle1 = False
Global $Toggle2 = False
Global $Toggle3 = False
Global $Toggle4 = False

While 1
    If $Toggle1 Then SendInfo (" cheese steak jimmy's "))
    If $Toggle2 Then SendInfo (" robin hood ")
    If $Toggle3 Then SendInfo (" lumberjack ")
    If $Toggle4 Then SendInfo (" rock on ")
    Sleep(50)
WEnd
;
Func SendInfo ($text)
    Send("{ENTER}")
    Sleep(100)
    Send($text)
    Sleep(100)
    Send("{ENTER}")
    Sleep(1000)
EndFunc   ;==>SendInfo
;
Func _Toggle1 ()
    $Toggle1 = Not $Toggle1
EndFunc   ;==>_Toggle1
;
Func _Toggle2 ()
    $Toggle2 = Not $Toggle2
EndFunc   ;==>_Toggle2
;
Func _Toggle3 ()
    $Toggle3 = Not $Toggle3
EndFunc   ;==>_Toggle3
;
Func _Toggle4 ()
    $Toggle4 = Not $Toggle4
EndFunc   ;==>_Toggle4
;
Func _Exit ()
    Exit
EndFunc   ;==>_Exit
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hmm... why toggle? Just simply use functions to send the text!

Or did I get you wrong?

This code here send the respective text when you press the keys (I don't know what the enter then sleep is for, but I added it in anyway)

HotKeySet("{UP}", "Send1")
HotKeySet("{DOWN}", "Send2")
HotKeySet("{LEFT}", "Send3")
HotKeySet("{RIGHT}", "Send4")
HotKeySet("{+}", "Terminate")

Func enter(ByRef $x)
    If $x = 1 Then
        Send("{ENTER}")
        Sleep(100)
    ElseIf $x = 2 Then
        Sleep(100)
        Send("{ENTER}")
    EndIf
EndFunc

Func Send1()
    enter(1)
    Send(" cheese steak jimmy's ")
    enter(2)
EndFunc

Func Send2()
    enter(1)
    Send(" robin hood ")
    enter(2)
EndFunc

Func Send3()
    enter(1)
    Send(" lumberjack ")
    enter(2)
EndFunc

Func Send4()
    enter(1)
    Send(" rock on ")
    enter(2)
EndFunc

Func Terminate()
    Exit
EndFunc

Cheers, I hope I understood you right.. :):P

Link to comment
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
 Share

  • Recently Browsing   0 members

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