[Release: Function] IsFight

Discussion in 'Programming General' started by Nunk, Nov 1, 2007.

[Release: Function] IsFight
  1. Unread #1 - Nov 1, 2007 at 9:59 AM
  2. Nunk
    Joined:
    Jan 22, 2007
    Posts:
    289
    Referrals:
    1
    Sythe Gold:
    0

    Nunk Forum Addict
    Banned

    [Release: Function] IsFight

    Code:
    Public Function IsFight()
    Dim x As Long, y As Long, test As Long, WndRECT As RECT
    GetWindowRect SelWnd, WndRECT
    test = GetDC(SelWnd)
    For y = 70 To 163
      For x = 220 To 329
       If GetPixel(test, x, y) = 65280 Then
         IsFight = True
         Exit Function
        End If
      Next x
    Next y
    IsFight = False
    End Function
    Example Uses:
    Code:
    Sub AutoMine ()
    Do Until Running = 0
    If IsFight = True Then
    RunAway (North)
    Else
    MineRocks
    End If
    Wait 1000, 400
    Loop
    End Sub
    Code:
    Sub AutoFight ()
    Do Until Running = 0
    If IsFight = 0 Then AttackEnemy
    Wait 100,50
    If CheckHP < WhenEat.Text Then EatFood (Food.text)
    Wait 500,100
    Loop
    End Sub
    Please give credits for me if you use this. :)
     
  3. Unread #2 - Nov 2, 2007 at 6:06 AM
  4. Darthatron
    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    [Release: Function] IsFight

    Good job mate, thank you. I'm sure someone will find this useful. =)
     
< [TUT - VB6] Using Msgboxes and simple error handling | Help with first program : ) >

Users viewing this thread
1 guest


 
 
Adblock breaks this site