Sign in to follow this  
Followers 0
luckys

need help with func resolution()

20 posts in this topic

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

CODE
func 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

Share this post


Link to post
Share on other sites



thx Saunders

could u explain that so next time i know what to do ?

Share this post


Link to post
Share on other sites

how u know my windowwidth ?? i dont have any window .. or i miss something *confused*

btw Saunders 608 doesn't work =(

Share this post


Link to post
Share on other sites

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.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

i need some help please

Share this post


Link to post
Share on other sites

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 = 300

300 - 10 = 290

1024x768:

768/2 = 384

384 - 10 = 374 <- Match

1280x1024:

1024 / 2 = 512

512 - 10 = 502 <- Match

1440x900:

900/2 = 450

450 - 10 = 440

Here is why I don't think 800x600 matches the other formulas:

1280 / 1024 = 1.25

1024 / 800 = 1.28

The 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.

Share this post


Link to post
Share on other sites

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... :)

Share this post


Link to post
Share on other sites

Wow you guys actually tried? I just spat out a random number that looked like it might work.

:)

Share this post


Link to post
Share on other sites

#15 ·  Posted (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

CODE
func 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 by luckys

Share this post


Link to post
Share on other sites

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. :)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Wow, good job figuring it out. Kinda feel bad for being a dink earlier.

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  
Followers 0