amberjo Posted July 4, 2010 Share Posted July 4, 2010 basically what i need is something that makes beeping noise when a certain spot on my screen turns red. it will alert me that i'm being attacked on a game. my brother told me to download this and figure it out. but i have no idea what the hell i'm doing. any help would be appreciated. thanks <3 amber Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2010 Share Posted July 4, 2010 (edited) ;here you can use this script to mouseover a pixel and retrieve values for the xy location of the mouse as well as the pixel color under the mouse ;you can use ;$col = PixelGetColor(x, y) ;if($col==TheRedColorYourTestingFor) then Beep(4000, 2000) ;after you figure out the pixel location and color your looking for $done=0 hotkeyset("{PAUSE}", "endscript") hotkeyset("{HOME}", "getxy") do until $done=1 ;use this function to display mouse coords Func getxy() $pos = MouseGetPos() $col = PixelGetColor($pos[0], $pos[1]) ;tooltip($pos[0] & " " & $pos[1] & $col) MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1] & ",color=" & $col) EndFunc Func endscript() tooltip("") $done=1 exit EndFunc ;end endscript() ;please let me know if I can be more specific ;also please let me know if I was useful in this case Edited July 4, 2010 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
amberjo Posted July 4, 2010 Author Share Posted July 4, 2010 hmm I think it is useful, I just can't figure it out... can you be more specific? I haven't really done this before. I put Func getxy() $pos = MouseGetPos() $col = PixelGetColor($pos[0], $pos[1]) ;tooltip($pos[0] & " " & $pos[1] & $col) MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1] & ",color=" & $col) EndFunc Func endscript() tooltip("") $done=1 exit EndFunc ;end endscript() in the autoit thing, saved it, right clicked on the file in explorer and compiled, and then clicked on it and it did nothing. I'm really a n00b at this.... Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2010 Share Posted July 4, 2010 (edited) ;ok we need to setup hotkeys to call the functions: hotkeyset("{PAUSE}", "endscript") hotkeyset("{HOME}", "getxy") $done=0;unnecessary variable used to flag script as done ;then we need a loop to trap the script while we find mouse locations and colors: do until $done=1 ;i put my functions here at the bottom Func endscript() tooltip("");removes tooltips $done=1 exit EndFunc ;end endscript() Func getxy() $pos = MouseGetPos() $col = PixelGetColor($pos[0], $pos[1]) ;tooltip($pos[0] & " " & $pos[1] & $col);use can use this tooltip instead of the msgbox if you want MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1] & ",color=" & $col) EndFunc this script is only meant to help you find coords and colors to check for while the script is running pressing the "home key" will display the mouse x, y and color below mouse "pause key" will end the script once you have the x, y location of the pixel color you wish to check you use: if(PixelGetColor(x, y)==TheColorYourCheckingFor) then beep(4000, 2000) Edited July 4, 2010 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
amberjo Posted July 4, 2010 Author Share Posted July 4, 2010 okay so what i have in there is: hotkeyset("{PAUSE}", "endscript") hotkeyset("{HOME}", "getxy") Func endscript() tooltip("");removes tooltips $done=1 exit EndFunc ;end endscript() Func getxy() $pos = MouseGetPos() $col = PixelGetColor($pos[0], $pos[1]) ;tooltip($pos[0] & " " & $pos[1] & $col);use can use this tooltip instead of the msgbox if you want MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1] & ",color=" & $col) EndFunc until $done=1 and it says error: "until" statement with no matching "do" statement on lines 13 and 18 line 13 is $col = PixelGetColor($pos[0], $pos[1]) line 18 is until $done=1 Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2010 Share Posted July 4, 2010 (edited) ;this is the script, please copy all code below this line and paste it into your autoit program hotkeyset("{PAUSE}", "endscript") hotkeyset("{HOME}", "getxy") $done=0;unnecessary variable used to flag script as done do until $done=1 Func endscript() tooltip("");removes tooltips $done=1 exit EndFunc ;end endscript() Func getxy() $pos = MouseGetPos() $col = PixelGetColor($pos[0], $pos[1]) ;tooltip($pos[0] & " " & $pos[1] & $col);you can use this tooltip instead of the msgbox if you want MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1] & ",color=" & $col) EndFunc Edited July 4, 2010 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
amberjo Posted July 4, 2010 Author Share Posted July 4, 2010 awesome, thanks so much! that worked, i got the x and y and the color, now how do i do the alarm part? Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2010 Share Posted July 4, 2010 (edited) ;well i'm not sure right now how to write all your code but I do know that you'll want a loop that checks for the color and beeps when the color is found ; code below hotkeyset("{PAUSE}", "endscript") $done=0 do if(PixelGetColor(the_x, the_y)==the_color) Then beep(4000, 2000) until $done=1 Func endscript() tooltip("") $done=1 exit EndFunc ;end endscript() ;i had $done=1 at the begining opps i fixed it Edited July 4, 2010 by songersoft Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
amberjo Posted July 4, 2010 Author Share Posted July 4, 2010 thanks SOOO much! you're the best! one more question, if i wanted it to beep on either of 2 colors, how would i do that? Link to comment Share on other sites More sharing options...
Xandy Posted July 4, 2010 Share Posted July 4, 2010 hotkeyset("{PAUSE}", "endscript") $done=0 do if(PixelGetColor(the_x, the_y)==the_color) Then beep(4000, 2000) if(PixelGetColor(the_x2, the_y2)==the_color2) Then beep(4000, 2000) until $done=1 Func endscript() tooltip("") $done=1 exit EndFunc ;end endscript() Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now