Help - Search - Members - Calendar
Full Version: First macro, need a little help
AC Tools Everything Macro > AC Tool Macros > Macro Development
Yosharu
Well I am trying to develop a GunZ macro, here is what I got so far:
CODE
SetActiveWindow Trinity
// Insta Sword using TBF
While 1=1
If {Globalkeys} contains 070
ClearGlobalKeys
//
RightMouseDown
Delay 200
Keydown ~ 5
Delay 10
RightMouseUp
Keydown {space} 10
Delay 252
LeftMouseDown
Delay 13
LeftMouseUp
Keydown ~ 10
Delay 252
LeftMouseDown
Delay 13
LeftMouseUp
Keydown ~ 10
Delay 252
Keydown {space} 10     <----- This and everything under it
LeftMouseDown
Delay 13
LeftMouseUp
Keydown ~ 10
Delay 252
LeftMouseDown
Delay 13
LeftMouseUp
Keydown ~ 10
Delay 252
LeftMouseDown
Delay 13
LeftMouseUp
Keydown ~ 10
Delay 252
  End
End

How would I make the 2nd Keydown {space} 10 and everything under it go into a loop and end when I press the desired hotkey (R in my case). Any help would be greatly appreciated.
Bear
QUOTE(Yosharu @ Nov 12 2009, 02:36 AM) *
How would I make the 2nd Keydown {space} 10 and everything under it go into a loop and end when I press the desired hotkey (R in my case). Any help would be greatly appreciated.


Well for one, the Macro won't Start the stuff you want to run until you hit R and well only run once. Instead of using Keydown with the {space} try using Keys. Plus you have a lot of repeating code.

CODE
SetActiveWindow Trinity
// Insta Sword using TBF
Procedure Shiftclick
  Leftclick
  Keydown ~ 10
  Delay 252
End

While 1=1
  If {Globalkeys} contains 070
    ClearGlobalKeys
    RightMouseDown
    Delay 200
    Keydown ~ 5
    Delay 10
    RightMouseUp
    Keys {space}
    Delay 252
    Loop 2
      Call ShiftClick
    End
    Keys {space}     //<----- This and everything under it
    Loop 3
      Call ShiftClick
    End
  End
End
Yosharu
Thanks a million. I just don't get how you would make something start by pressing a button and then end it whenever you press the button again. I've looked at some codes and still can not figure it out.
Like say I wanted it to press R and then press left click until I pressed the key I used to make it start. How would I do that?
Bear
QUOTE(Yosharu @ Nov 14 2009, 12:52 AM) *
Like say I wanted it to press R and then press left click until I pressed the key I used to make it start. How would I do that?

Instead of using a IF statement to get it started, we use a While to stop it. So after the ClearGlobalKeys you add a While statement which well loop until you hit R again. But then after while's End statement you have to add another ClearGlobalKeys so it doesn't start right away again.
CODE

SetActiveWindow Trinity
// Insta Sword using TBF
Procedure Shiftclick
Leftclick
Keydown ~ 10
Delay 252
End

Procedure Guts
End

While 1=1
If {Globalkeys} contains 070
ClearGlobalKeys
While {Globalkeys} <> 070 // Loop until R is pressed again
RightMouseDown
Delay 200
Keydown ~ 5
Delay 10
RightMouseUp
Keys {space}
Delay 252
Loop 2
Call ShiftClick
End
Keys {space}
Loop 3
Call ShiftClick
End
End
ClearGlobalKeys // Clear again
End
Delay 500 // If you don't have some delay while you wait to run the macro, it's been proven that you can actually cause your PC to slow down.
End
Yosharu
Okay, I have this now
CODE
If {Globalkeys} contains 071
  ClearGlobalKeys
  Keydown r 180
  RightMouseDown
  Delay 5
  RightMouseUp
  Delay 10
  While {Globalkeys} <> 071
  Keys {space}
  Call TBF
End
  ClearGlobalKeys
End
  Delay 10
End

I want it to repeat this

CODE
Keys {space}
Call TBF

after

CODE
Keydown r 180
RightMouseDown
Delay 5
RIghtMouseUp
Delay 10


these keys have been pressed, and end when I press G again. Been trying to figure it out on my own, this is getting kinda stressful. Thank you for all you're help, I'll post back here if I can figure this out.
Bear
CODE
If {Globalkeys} contains 071  // Looking for G to Start
  ClearGlobalKeys
  Keydown r 180
  RightMouseDown
  Delay 5
  RightMouseUp
  Delay 10
  While 1 = 1
    If {Globalkeys} contains 071  // Looking for G to Stop
      ClearGlobalKeys
      Break
      // Exit // If this Starting IF statement is inside a Procedure use "Exit"
    Else // No G Let's Loop
      Keys {space}
      Call TBF
    End
  End
End
skater4ud22
What exactly is globalkeys? first time hearing about it
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.