AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PixelSearch, rather annoying problem

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Potential User
Guest





PostPosted: Thu Apr 21, 2005 9:03 am    Post subject: PixelSearch, rather annoying problem Reply with quote

Hello all,

I am trying to make a script that will click the left mouse or hold the left mouse down if it finds a color on a small part of the screen. It is to be used in a FPS game. For some reason, I cannot get this bloody thing to work at all (except my hotkeys).

Maybe someone could find a problem with it:

Code:

SetBatchLines, -1   ;This script has a need for speed

Team = 1      ;Team 1 = Terrorists, Team 2 = Counter-Terrorists
Fire_Mode = 3      ;Fire_Mode 1 = Full Auto, 2 = Burst Fire, 3 = No Fire
Already_Firing = false   ;No Overkill please! :P

Loop
{
   If (Team == 1)
   {
      If (Already_Firing == false)
      {
         PixelSearch,,, 588,559, 692,561, 0xFF3E3E, 0, RGB
         If (ErrorLevel == 0)
         {
            Already_Firing = true
            If (Fire_Mode == 1)
            {
               MouseClick, LEFT
               ;SoundPlay, *32
            }
            Else If (Fire_Mode == 2)
            {
               MouseClick, LEFT,,,,D
               Sleep, 300
               MouseClick, LEFT,,,,U
            }
            Sleep, 100
            Already_Firing = false
         }
      }
   }
   Else
   {
      If (Already_Firing == false)
      {
         PixelSearch,,, 588,559, 692,561, 0x9ACDFF, 0, RGB
         If (ErrorLevel == 0)
         {
            Already_Firing = true
            If (Fire_Mode == 1)
            {
               MouseClick, LEFT
               ;SoundPlay, *32
            }
            Else If (Fire_Mode == 2)
            {
               MouseClick, LEFT,,,,D
               Sleep, 300
               MouseClick, LEFT,,,,U
            }
            Sleep, 100
            Already_Firing = false
         }
      }      
   }
   Sleep, 50 ;No need to loop constantly, saves CPU usage :P

}

*NumPad1::    ;Toggle Fire_Mode
   Fire_Mode++
   If (Fire_Mode > 3)
      Fire_Mode = 1

   If (Fire_Mode == 1)
      SoundPlay, %A_WorkingDir%\FullAuto.wav
   Else If (Fire_Mode == 2)
      SoundPlay, %A_WorkingDir%\BurstFire.wav
   Else
      SoundPlay, %A_WorkingDir%\NoFire.wav
   Return

*NumPad2::   ;Toggle Team
   Team *= -1
   If (Team == 1 )
      SoundPlay, %A_WorkingDir%\Terrorists.wav
   Else
      SoundPlay, %A_WorkingDir%\CounterTerrorists.wav
   Return

*NumPadSub:: ExitApp 0   ;Exit the script


I can't figure out if it is even going into the loop. It is getting on my nerves and I KNOW i'm following the directions in the help file. Maybe I'm missing something.

Thanx
Back to top
Potential User
Guest





PostPosted: Thu Apr 21, 2005 9:14 am    Post subject: Reply with quote

I figured it out, apparently Already_Firing = false/true was the problem... Guess I can't use boolean values afterall.

Now to go smoke a cig and calm down.

I feel like an ass now...
Back to top
BoBo
Guest





PostPosted: Thu Apr 21, 2005 9:44 am    Post subject: Reply with quote

Quote:
I feel like an ass now...
Hm, thought about to re-register as J'Lo ? LaughingLaughingLaughing
Back to top
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10480

PostPosted: Thu Apr 21, 2005 11:41 am    Post subject: Reply with quote

Potential User wrote:
I figured it out, apparently Already_Firing = false/true was the problem... Guess I can't use boolean values afterall.
Since true and false are built-in variables, you can put them into a variable in either of these ways:
CaseSensitive := true
CaseSensitive = %true%

I know the difference between = and := is confusing. It's one of compromises that had to be made to support both the old and new syntaxes.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group