Sign in to follow this  
Followers 0
Orgins

key switcher

1 post in this topic

#1 ·  Posted (edited)

I want to be able to map out the 4 hot keys in a game (say their A S D and F (they random most of the time)). What I though of is when I hold 1 and A it'll IniWrite The letter A under old hot key 1. Then I'd do number pad 1 and Q to re-set the first hot key.

So when I'd hit Q it would send A.

I know how to do If _IsPressed("The key", $dll) Then send(Q) Endif But I don't want that. I want to be able to map the keys per game.

This is what I made when I tried to make it.

#include <Array.au3>
#include <Misc.au3>

Dim $avArray
Global $Paused

HotKeySet("{ENTER}", "TogglePause")

$dll = DllOpen("user32.dll")
$Array = _ArrayCreate("41", "42", "43", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", "4D", "4E", "4F", "50", "51", "52", "53", "54", "55") ; Does a - something
$Array2 = _ArrayCreate("56", "57", "58", "59", "5A") ;does something - Z


$Skill1New = IniRead ( "Skills.ini", "NewSkill", "1", "default" ) ; where the new hot key would go.
$Skill2New = IniRead ( "Skills.ini", "NewSkill", "2", "default" )
$Skill3New = IniRead ( "Skills.ini", "NewSkill", "3", "default" )
$Skill4New = IniRead ( "Skills.ini", "NewSkill", "4", "default" )


$Skill1old = IniRead ( "Skills.ini", "OldSkill", "1", "default" ) ; where the old hot key would be.
$Skill2Old = IniRead ( "Skills.ini", "OldSkill", "2", "default" )
$Skill3Old = IniRead ( "Skills.ini", "OldSkill", "3", "default" )
$Skill4Old = IniRead ( "Skills.ini", "OldSkill", "4", "default" )

$Mapingkey = "{INSERT}"
$Startingkey = "{HOME}"
$Mainkey = "{END}"



Main()
        
        
        
        
Func Main()
  ToolTip("",0,0)
    While 1
        If _IsPressed("2D", $dll) Then; insert
           MapKeys()
           Endif
        If _IsPressed("24", $dll) Then; home
          Start()
        EndIf
    wend
Endfunc



Func MapKeys()
    While 1
            ToolTip("Start Maping keys",0,0)
            
If _IsPressed("31", $dll) and _IsPressed($Array, $dll) Then; 1
    $skill = $Array
    IniWrite ( "Skills.ini", "NewSkill", "1", $skill )
    Beep(500, 500)
Endif

If _IsPressed("32", $dll) and _IsPressed($Array, $dll) Then; 2
    $skill = $Array
    IniWrite ( "Skills.ini", "NewSkill", "2", $skill )
    Beep(500, 500)
Endif

If _IsPressed("33", $dll) and _IsPressed($Array, $dll) Then; 3
    $skill = $Array
    IniWrite ( "Skills.ini", "NewSkill", "3", $skill )
    Beep(500, 500)
Endif

If _IsPressed("34", $dll) and _IsPressed($Array, $dll) Then; 4
    $skill = $Array
    IniWrite ( "Skills.ini", "NewSkill", "4", $skill )
    Beep(500, 500)
    Endif
        

If _IsPressed("31", $dll) and _IsPressed($Array2, $dll) Then; 1
    $skill = $Array2
    IniWrite ( "Skills.ini", "NewSkill", "1", $skill )
    Beep(500, 500)
Endif

If _IsPressed("32", $dll) and _IsPressed($Array2, $dll) Then; 2
    $skill = $Array2
    IniWrite ( "Skills.ini", "NewSkill", "2", $skill )
    Beep(500, 500)
Endif

If _IsPressed("33", $dll) and _IsPressed($Array2, $dll) Then; 3
    $skill = $Array2
    IniWrite ( "Skills.ini", "NewSkill", "3", $skill )
    Beep(500, 500)
Endif

If _IsPressed("34", $dll) and _IsPressed($Array2, $dll) Then; 4
    $skill = $Array2
    IniWrite ( "Skills.ini", "NewSkill", "4", $skill )
    Beep(500, 500)
    Endif


Sleep(50)

If _IsPressed($Array, $dll) and _IsPressed("61", $dll) Then;1
    $skill = $Array
    IniWrite ( "Skills.ini", "OldSkill", "1", $skill )
    Beep(500, 500)
Endif

If _IsPressed($Array, $dll) and _IsPressed("62", $dll) Then;2
    $skill = $Array
    IniWrite ( "Skills.ini", "OldSkill", "2", $skill )
    Beep(500, 500)
Endif

If _IsPressed($Array, $dll) and _IsPressed("63", $dll) Then;3
    $skill = $Array
    IniWrite ( "Skills.ini", "OldSkill", "3", $skill )
    Beep(500, 500)
Endif

If _IsPressed($Array, $dll) and _IsPressed("64", $dll) Then;4
    $skill = $Array
    IniWrite ( "Skills.ini", "OldSkill", "4", $skill )
    Beep(500, 500)
Endif


If _IsPressed($Array2, $dll) and _IsPressed("61", $dll) Then;1
    $skill = $Array2
    IniWrite ( "Skills.ini", "OldSkill", "1", $skill )
    Beep(500, 500)
Endif

If _IsPressed($Array2, $dll) and _IsPressed("62", $dll) Then;2
    $skill = $Array2
    IniWrite ( "Skills.ini", "OldSkill", "2", $skill )
    Beep(500, 500)
Endif

If _IsPressed($Array2, $dll) and _IsPressed("63", $dll) Then;3
    $skill = $Array2
    IniWrite ( "Skills.ini", "OldSkill", "3", $skill )
    Beep(500, 500)
Endif

If _IsPressed($Array2, $dll) and _IsPressed("64", $dll) Then;4
    $skill = $Array2
    IniWrite ( "Skills.ini", "OldSkill", "4", $skill )
    Beep(500, 500)
Endif


    
If _IsPressed("24", $dll) then
    start()
Endif
    
Wend
EndFunc




Func start()
    ToolTip("",0,0)

    while 1

If _IsPressed($Skill1New, $dll) Then
   Send($Skill1Old)
endif

If _IsPressed($Skill2New, $dll) Then
   Send($Skill2Old)
endif

If _IsPressed($Skill3New, $dll) Then
   Send($Skill3Old)
endif

If _IsPressed($Skill4New, $dll) Then
   Send($Skill4Old)
endif


wend
EndFunc



Func TogglePause()
    $Paused = NOT $Paused
        ToolTip('Script is "Paused"',0,0)
    While $Paused
        sleep(100)
    WEnd
      ToolTip("",0,0)
  EndFunc

But I cant seem to get it working. Any pointers?

Edited by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

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