Jump to content
Sign in to follow this  
SnipaZ

Suggestions?

Recommended Posts

SnipaZ

Hello heres a script about the program i was going to make but its kinda crappy i got help.

Can you guys help me out? If you play Starcraft you can test it out with a unit, its supposed to autolock a unit. without pressing A, you'll see by the script. I'll appreciate it thanks, This is suppose to be meant for a game called snipers if you want the map just tell me.

Opt("WinTitleMatchMode", 3) ;sets winactive to exact match

Global $FirstLoad

Global $HotCold

Global $PausedApp

Global $MoveCord[1]

Global $Pos[1]

HotKeySet("{F9}", "ToggleSide")

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

HotKeySet("{F7}", "ShowIT")

;F9 will toggle which side to attack

;F11 will toggle the app being paused

;Notes:

;Theres a color I used to check as cold that some times targets HOT players. Most likely white.

;---Needs to be changed

While 1

Sleep(200)

;to not use a lot of cpu

If not $PausedApp then

If WinActive("Brood War") Then Call("CheckArea") ;only do checks if brood war is active window

endif

;calls the function to check for bad guys in the area!

WEnd

;loop check

if not $FirstLoad Then

$FirstLoadoad = Not $FirstLoad

;so we dont loop

$PausedApp = Not $PausedApp

$HotCold = Not $HotCold

EndIf

;initial load settings

Func ShowIT()

msgbox(0,"":: Don't bitch about bad coding, this is my first time coding in this language and I made this in less than hour.")

EndFunc

;isnt it obvious?

Func TogglePause()

$PausedApp = Not $PausedApp

$iTmp0 = 0

While $iTmp0 <= 12

sleep(100)

if $PausedApp then

ToolTip('Fleetsauce is paused',150,0)

Else

ToolTip('Fleetsauce is no longer paused',150,0)

EndIf

$iTmp0 = $iTmp0 + 1

WEnd

ToolTip("")

EndFunc

;pauses the app

Func ToggleSide()

$HotCold = Not $HotCold

$iTmp1 = 0

While $iTmp1 <= 12

sleep(100)

If $HotCold Then

ToolTip('Targeting Cold!',5,5)

Else

ToolTip('Targeting Hot!',5,5)

Endif

$iTmp1 = $iTmp1 + 1

WEnd

ToolTip("")

EndFunc

;changes which side to target, default is hot

func CheckArea()

$pos = MouseGetPos()

if $HotCold then ;target cold side

$MoveCord = PixelSearch($pos[0] - 20, $pos[1] - 20,$pos[0] + 20, $pos[1] + 20, 0x209070, 0)

;the - 20 + 20 basically creates a 40 pixil sqaure area to check. while using MouseMove at the bottom you could

;home in on the target, often lags and misses though. Bigger 'square area', less closer to the player you have to be

If Not @error Then

call("MoveClick")

return

endIf

;found teal

$MoveCord = PixelSearch($pos[0] - 20, $pos[1] - 20,$pos[0] + 20, $pos[1] + 20, 0x083498, 0)

If Not @error Then

call("MoveClick")

return

endIf

;found blue

$MoveCord = PixelSearch($pos[0] - 20, $pos[1] - 20,$pos[0] + 20, $pos[1] + 20, 0xCCE0D0, 0)

If Not @error Then

call("MoveClick")

return

endIf

;found white

else ;target hot side

$MoveCord = PixelSearch($pos[0] - 20, $pos[1] - 20,$pos[0] + 20, $pos[1] + 20, 0xF40404, 0)

If Not @error Then

call("MoveClick")

return

endIf

;found red

$MoveCord = PixelSearch($pos[0] - 20, $pos[1] - 20,$pos[0] + 20, $pos[1] +10, 0xDCDC3C, 0)

If Not @error Then

call("MoveClick")

return

endIf

;found yellow

$MoveCord = PixelSearch($pos[0] - 20, $pos[1] - 20,$pos[0] + 20, $pos[1] + 20, 0xE87824, 0)

If Not @error Then

call("MoveClick")

return

endIf

;found orange

endif

EndFunc

;checks for players near

func MoveClick()

local $TurretCord[1]

local $TurretVerify

$TurretCord = PixelSearch($pos[0] - 200, $pos[1] - 200,$pos[0] + 200, $pos[1] + 200, 0x84849C, 0)

if @error then

;MouseMove($MoveCord[0], $MoveCord[1], 0) ;moves to where the pixil was found, remove ; in front to activate

send("a")

sleep(20) ;need to do this, if we dont pause it clicks the unit before attack cmd is sent

MouseClick("left")

sleep("400") ;almost a half second delay between clicks so the player can pull away if needs to

;no turret pixils found in the area

Else

;turret pixil found so checking for a pixil that would be close by first pixil checked, this way

;we're 100% sure its a turret not a player, being players share a lot of common pixil colors as turrets

$TurretVerify = PixelGetColor($TurretCord[0] - 1,$TurretCord[1] )

if $TurretVerify = 5789784 Then

Else

;MouseMove($MoveCord[0], $MoveCord[1], 0) ;moves to where the pixil was found, remove ; in front to activate

send("a")

sleep(20) ;need to do this, if we dont pause it clicks the unit before attack cmd is sent

MouseClick("left")

sleep("400") ;almost a half second delay between clicks so the player can pull away if needs to

EndIf

endif

;if no turrets near then send move n click

EndFunc

;sends movements if okay

Edited by SnipaZ

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

do not get your wuestion?

Nevertheless, this line

msgbox(0,"":: Don't bitch about bad coding, this is my first time coding in this language and I made this in less than hour.")

Should be

msgbox(0,"" ,"Don't bitch about bad coding, this is my first time coding in this language and I made this in less than hour.")

So long,

Mega

Edited by th.meger

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
SnipaZ

thanks, well i need help making the unit attack the enemy unit precicely without pressing the attack button this is the program i want to make but in VB so you guys can get an idea, Thanks

http://thesource.staghost.com/progs/sniper_assist.zip Run this program with starcraft this is the exact program i want to make but i need some help with the Auto IT script.

If it doesn't work on you're comp its because you need to be an admin ><

Edited by SnipaZ

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  

×