Jump to content
Sign in to follow this  
Rails

Script having issues with win7 alt tab

Recommended Posts

Rails

I was given a script from a friend, and I'm having issues with it.

Essentially it is a melee macro for the game Darkfall (attended, it's allowed). I am running two windows of the game with 2 separate accounts (also allowed). This is how the script is supposed to work:

One character swings a sword, the other character blocks it. To accomplish this, the script alt-tabs immediately after the first character swings.

After a few swings, something bugs with the alt-tabbing and the order is reversed where the attacking char is now blocking, and the blocking char is now attacking...it is not supposed to do this.

Is there a way to detect windows so that it guarantees the attacking char is in window 1 and the blocking char is in window 2?

While playing around with alt-tab I noticed that holding it down too long will produce the effect that I'm experiencing with my script.

Any suggestions would be very appreciated. I do have programming experience - but not with this language.

#cs ----------------------------------------------------------------------------
   Script by: Eiles


   Script requires two Accounts running on same computer in window mode.
   4 Individual Weapons should be placed in Hotbar 1 - 4 on the Attacking Account. These will be cycled through to provide a greater amount of durability and keep you skilling up longer.
   4 Individual Shields should be placed in Hotbar 1 - 4 on the Parrying Account. These will be cycled through to provide a greater amount of durability and keep you skilling up longer

   Begin the script with Attacking account unequiped and Focused in FPS mode.
   Make sure the Parrying account has only the sword equiped. The shields should be unequiped and in your inventory.
   Parrying Account should be in FPS mode and in the background upon Scrip activation.

   Script begins 10 seconds after you answer the questions, so you should have enough time to ensure Accounts are setup properly and alt-tabing between each other fluidly.
   
   Pause Key Pauses the Script
   Esc Key Ends the Script

#ce-------------------------------------------------------

Dim $a, $b, $c
Dim $Weapon
Global $Paused
$b = InputBox( "Question", "How many times would you like to swing? (1 sec = 1000)", "50" )
$c = InputBox( "Question", "How long would you like to rest? (1 sec = 1000)", "100000")
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
$Weapon = 1
$Shield = 1
$a = 0
Sleep ( 10000 )

while 1
   sleep ( 100 )
      Call ("EquipAttack")
      sleep ( 500 )
      Call ("CombatMode")
      sleep ( 500 )
      Call ("EquipDefense")
      sleep ( 500 )
      Call ("CombatModeD")
      sleep ( 500 )
      Call("Attack")
      sleep ( 500 )
      Call ("Rest")
WEnd

Func EquipAttack()
   Sleep(1000)
   ;send ("{1} - {4}") ; Weapon
   Send("{" & $Weapon & "}")
   $Weapon = $Weapon + 1
   If $Weapon = 5 Then
      $Weapon = 1
   EndIf
   Sleep(1000)
EndFunc   ;==>Equip

Func CombatMode()
   Sleep (100 )
   Send ( "r" )
   Sleep ( 1000 )
EndFunc

Func EquipDefense()
   send ( "!{TAB}" )
   sleep ( 1000 )
   ;send ("{1} - {4}") ; Shield
   Send("{" & $Shield & "}")
   $Shield = $Shield + 1
   If $Shield = 5 Then
      $Shield = 1
   EndIf
   Sleep(1000)
EndFunc

Func CombatModeD()
   Sleep (100 )
   Send ( "r" )
   Sleep ( 1000 )
   send ( "!{TAB}" )
   Sleep ( 1000 )
EndFunc

Func Attack()
   Do
      sleep ( 100 )
      Mouseclick ( "Left" )
      sleep ( 200 )
      send ( "!{TAB}" )
      sleep ( 200 )
      Send ( "{V DOWN}" )
      sleep ( 300 )
      Send ( "{V UP}" )
      sleep ( 300 )
      send ( "!{TAB}" )
      sleep ( 300 )
      $a = $a + 1
   Until $a = $b
   $a = 0
EndFunc

Func Rest()
   Send ( "R" )
   Sleep ( 1500 )
   Send ( "0" )
   Sleep ( 1500 )
   Mouseclick ( "Left" )
   Sleep ( 1500 )
   send ( "!{TAB}" )
   Sleep ( 1500 )
   Send ( "R" )
   Sleep ( 1500 )
   Send ( "0" )
   Sleep ( 1500 )
   Mouseclick ( "Left" )
   Sleep ( 1500 )
   send ( "!{TAB}" )
   Sleep ( $c )
   Send ( "w" )
   Sleep ( 1500 )
   send ( "!{TAB}" )
   Sleep ( 1500 )
   Send ( "w" )
   Sleep ( 2000 )
   send ( "!{TAB}" )
   Sleep ( 1500 )
EndFunc

Func TogglePause()
   $Paused = Not $Paused
   While $Paused
      Sleep(100)
   WEnd
EndFunc   ;==>TogglePause

Func Terminate( )
    Exit 0
EndFunc

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  

×