luckys Posted December 8, 2007 Share Posted December 8, 2007 hi i'm new to autoit but i play around with it and i think i like it =) well i'm just trying to modifi a script to work with 1440x900 resolution CODEfunc resolution() $width = @DesktopWidth $hight = @DesktopHeight if $width = 800 And $hight = 600 Then $offset = 262 ElseIf $width = 1024 And $hight = 768 Then $offset = 374 ElseIf $width = 1280 And $hight = 1024 Then $offset = 502 ElseIf $width = 1440 And $hight = 900 Then $offset = ??? Else MsgBox(16,"", "Game resolution not supportet.") Exit EndIf return $offset EndFunc so maybe someone can help me finding the right $offset for the last resolution is there a way to calculate it or what do i have to do to find the right value thx a lot Link to comment Share on other sites More sharing options...
therks Posted December 8, 2007 Share Posted December 8, 2007 608 My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
luckys Posted December 8, 2007 Author Share Posted December 8, 2007 thx Saunders could u explain that so next time i know what to do ? Link to comment Share on other sites More sharing options...
Developers Jos Posted December 8, 2007 Developers Share Posted December 8, 2007 Why not just calculate it: $yourwindowwidth = 276 $offset = @DesktopWidth/2-$yourwindowwidth/2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
luckys Posted December 8, 2007 Author Share Posted December 8, 2007 how u know my windowwidth ?? i dont have any window .. or i miss something *confused* btw Saunders 608 doesn't work =( Link to comment Share on other sites More sharing options...
Developers Jos Posted December 8, 2007 Developers Share Posted December 8, 2007 how u know my windowwidth ?? i dont have any window .. or i miss something *confused*btw Saunders 608 doesn't work =(What do you use the $offset for ?I assumed that you are positioning a window in the center of the screen ... that is what the formula is for. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
luckys Posted December 8, 2007 Author Share Posted December 8, 2007 What do you use the $offset for ?I assumed that you are positioning a window in the center of the screen ... that is what the formula is for. no the script grabs some ingame informations and write them in a log file so the offset is used for the pixel_check function Link to comment Share on other sites More sharing options...
luckys Posted December 8, 2007 Author Share Posted December 8, 2007 i need some help please Link to comment Share on other sites More sharing options...
BrettF Posted December 8, 2007 Share Posted December 8, 2007 How did you get the $offset value in the first place?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
weaponx Posted December 8, 2007 Share Posted December 8, 2007 We have no clue what this $offset value is, is it a distance from the left, right, bottom, or top? Is it a diaganol length from a corner? I tried to find a pattern with some luck.800x600:600/2 = 300300 - 10 = 2901024x768:768/2 = 384384 - 10 = 374 <- Match1280x1024:1024 / 2 = 512512 - 10 = 502 <- Match1440x900:900/2 = 450450 - 10 = 440Here is why I don't think 800x600 matches the other formulas:1280 / 1024 = 1.251024 / 800 = 1.28The multiplier is different between the two. If you had working numbers for 1600x1200 I might be able to verify the pattern because 1600/1280 = 1.25 as well. Link to comment Share on other sites More sharing options...
BrettF Posted December 8, 2007 Share Posted December 8, 2007 It could be something to do with the $offset=w/h*x where x is a value calulated using w and h?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted December 8, 2007 Share Posted December 8, 2007 Ok.... 800+600 = 1400 1400/1.3333 = 1050.0262506562664066601665041626 1050.0262506562664066601665041626 / 4 = 262.50656266406660166504162604065 Hmmmmmmmm.... the 1.3333 could be the 800/600?? I gtg to work now. So no more tinkering... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
therks Posted December 9, 2007 Share Posted December 9, 2007 Wow you guys actually tried? I just spat out a random number that looked like it might work. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
BrettF Posted December 9, 2007 Share Posted December 9, 2007 I think ((w + h)/(w/h))/4 might work... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
luckys Posted December 9, 2007 Author Share Posted December 9, 2007 (edited) thx for your help guys but it still don't work so 608 and 440 are not the right values.. maybe it helps when i post the function where the offset is used CODEfunc resolution() $width = @DesktopWidth $hight = @DesktopHeight if $width = 800 And $hight = 600 Then $offset = 262 ElseIf $width = 1024 And $hight = 768 Then $offset = 374 ElseIf $width = 1280 And $hight = 1024 Then $offset = 502 ElseIf $width = 1440 And $hight = 900 Then $offset = ??? Else MsgBox(16,"", "Game resolution not supportet.") Exit EndIf return $offset EndFunc Func check_pixel() $sum1 = 0 $sum2 = 0 $sum3 = 0 $i = 0 $test = 0 Do $line1[$i]= PixelGetColor($offset+$i,133) $line2[$i]= PixelGetColor($offset+$i,137) $line3[$i]= PixelGetColor($offset+$i,141) If $line1[$i] = 16777215 Then $sum1 = $sum1 + $i EndIf If $line2[$i] = 16777215 Then $sum2 = $sum2 + $i EndIf If $line3[$i] = 16777215 Then $sum3 = $sum3 + $i EndIf $i = $i + 1 Until $i = 120 $sum_total = $sum1 + $sum2 +$sum3 return $sum_total EndFunc Edit: i'll try ((w + h)/(w/h))/4 now =) Edited December 9, 2007 by luckys Link to comment Share on other sites More sharing options...
therks Posted December 9, 2007 Share Posted December 9, 2007 I really think you're just going to have to run your game with one of those supported resolutions, or figure out where the pixels it's looking for exist when running it in your chosen resolution.All that $offset is doing is adjusting where, on the X axis, the script looks for a pixel of pure white. I wouldn't be surprised if there's not any calculation that will work.But don't give up on my account. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
luckys Posted December 9, 2007 Author Share Posted December 9, 2007 I really think you're just going to have to run your game with one of those supported resolutions, or figure out where the pixels it's looking for exist when running it in your chosen resolution.All that $offset is doing is adjusting where, on the X axis, the script looks for a pixel of pure white. I wouldn't be surprised if there's not any calculation that will work.But don't give up on my account. well i have 2 pc one with a "normal" screen and one with a widescreen, i would like to run the script on both BUT i have no idea how to figure out where the pixel is maybe u could give me some hints how to start Link to comment Share on other sites More sharing options...
therks Posted December 9, 2007 Share Posted December 9, 2007 Sorry, not my area of expertise. I wouldn't even know where to begin since I don't even know what game you're playing. My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
luckys Posted December 9, 2007 Author Share Posted December 9, 2007 OK i finally got it after hours of staring at the numbers i found the dependency resolution to offset: CODE$width = 800 And $hight = 600 Then $offset = 262 ElseIf $width = 1024 And $hight = 768 Then $offset = 374 ElseIf $width = 1280 And $hight = 1024 Then $offset = 502 ElseIf $width = 1440 And $hight = 900 Then $offset = ??? (width2*-width1*)/2+offset1*=offset2 1*=known resolution&offset 2*=new resolution&offset for example (1024-800)/2+262=374 or in my case (1440-800)/2+262=582 quite easy ? so big thx to all that tryed to help me !! u guys gave me the right ideas to figure it out Link to comment Share on other sites More sharing options...
therks Posted December 10, 2007 Share Posted December 10, 2007 Wow, good job figuring it out. Kinda feel bad for being a dink earlier. My AutoIt Stuff | My Github 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