burners Posted August 24, 2008 Share Posted August 24, 2008 Wakummaci asked in a pm hello, what is the $resolution in your script? Im posting this here so anyone can use this. I generally get the pixels in 800x600. That way it will work in any res higher then 800x600. Im going to show you some code I have posted on my site in a few tutorials. Im only posting this here because my site is NOT free to register. Before anyone flames its because a handfull of people have their own software there and dont want the general public to have it. Setting up resolutions for pixel reading Its no surprise my codes are pixel based and what that means is they generally never break. This saves time when updates are needed because focus can be made on improving the code instead of constantly fixing it. Of course there are downsides as well, you cant do anything while the bot is running, sometimes its unpredictable, especially in zones like the dunes in the middle of the day. But never the less I am stil going to program this way until all the bots are remade then I will work on some C scripts to aide my scripts later one so they can operate in both modes. OK lets get back to reading pixels. One bitch about reading pixels is that pixels are in different places depending ont he screen res. This can be fixed with some simple math. I orginally programmed all my old bots in 800x600 and this means the lowest res possible can not be less the 800 on the width and no lower then 600 on the height. To determine what res a user is running in we can look at several things then we need to determine the FFXI res which we can get form a FFXI registry entry. We will need to make sure the resolutions match other wise when running a windower the pixels will be in the wrong places. We can also write to the registry to force the FFXI game into the same res as windows. OK OK on with the code expandcollapse popup800 600 0 0 1024 768 224 168 1152 864 352 264 1280 720 480 120 1280 768 480 168 1280 800 480 200 1280 960 480 360 1280 1024 480 424 1360 768 560 168 1360 1024 560 424 1400 1050 600 450 1440 900 640 300 1600 1200 800 600 1680 1050 880 450 The first set of numbers are the actual resolution then the second set is the difference from 800x600 which is our zero point and the lowest possible res. One thing to note is a pixel located @ 1x1 on a screen will be @ 1x1 on any screen res. This needs to be taken into account when programming. The reason for this is that the screen is broken into 4 segments and we can use simple math the find the pixel at the same location on any resolution. The above values are important for making a pixel reading bot that supports any resolution. I will post next how to get the resolution from the registry ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
burners Posted August 24, 2008 Author Share Posted August 24, 2008 Reading ffxi resolution from registry The ffxi resolution in the memory is set @ HKLM\SOFTWARE\PlayOnlineEU\SquareEnix\FinalFantasyXIor for EU people HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXIThe values are stored in 0001 & 0002 The way I always figured out someones res and what to do with it was by adding 1 & 2 together then acting on that. If you looked at the first post about the screen res you will know what the first 2 numbers represent. The third number is the res added up like we just talked about. I do this because its an easy number that is never the same and its quick to determin the screen res by just 1 set of numbers expandcollapse popup800 600 0 0 1400 1024 768 224 168 1792 1152 864 352 264 2016 1280 720 480 120 2000 1280 768 480 168 2048 1280 800 480 200 2080 1280 960 480 360 2240 1280 1024 480 424 2304 1360 768 560 168 2128 1360 1024 560 424 2384 1400 1050 600 450 2450 1440 900 640 300 2340 1600 1200 800 600 2800 1680 1050 880 450 2730 ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
burners Posted August 24, 2008 Author Share Posted August 24, 2008 (edited) Making your bot work in any resolution If you have read primer 1 & 2 you know a little about screen resolution. Now lets put that knowledge to use in some simple code. This will read the memory for both US and EU RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001") If @error = 1 Then Global $resx = RegRead("HKLM\SOFTWARE\PlayOnlineEU\SquareEnix\FinalFantasyXI", "0001") Global $resy = RegRead("HKLM\SOFTWARE\PlayOnlineEU\SquareEnix\FinalFantasyXI", "0002") Else Global $resx = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0001") Global $resy = RegRead("HKLM\SOFTWARE\PlayOnlineUS\SquareEnix\FinalFantasyXI", "0002") EndIfThis sets up our variable Local $resnumber = $resx + $resyThis takes the res and puts it into variables If $resnumber = 1400 Then $res = 1 ElseIf $resnumber = 1792 Then $res = 2 ElseIf $resnumber = 2016 Then $res = 3 ElseIf $resnumber = 2000 Then $res = 4 ElseIf $resnumber = 2048 Then $res = 5 ElseIf $resnumber = 2080 Then $res = 6 ElseIf $resnumber = 2240 Then $res = 7 ElseIf $resnumber = 2304 Then $res = 8 ElseIf $resnumber = 2128 Then $res = 9 ElseIf $resnumber = 2384 Then $res = 10 ElseIf $resnumber = 2450 Then $res = 11 ElseIf $resnumber = 2340 Then $res = 12 ElseIf $resnumber = 2800 Then $res = 13 ElseIf $resnumber = 2730 Then $res = 14 EndIfWe can support 14 resolutions which should be every resolution the game can support. Now lets take those variables and turn them into some more fun variables expandcollapse popupIf $res = 1 Then;800x600 $resolution = 0 $resolution2 = 0 EndIf If $res = 2 Then;1024x768 $resolution1 = 224 $resolution2 = 168 EndIf If $res = 3 Then;1152x864 $resolution1 = 352 $resolution2 = 264 EndIf If $res = 4 Then;1280x720 $resolution1 = 480 $resolution2 = 120 If $res = 5 Then;1280x768 $resolution1 = 480 $resolution2 = 168 EndIf If $res = 6 Then;1280x800 $resolution1 = 480 $resolution2 = 200 Endif If $res = 7 Then;1280x960 $resolution1 = 480 $resolution2 = 360 EndIf If $res = 8 Then;1280x1024 $resolution1 = 480 $resolution2 = 424 Endif If $res = 9 Then;1360x768 $resolution1 = 560 $resolution2 = 168 EndIf If $res = 10 Then;1360x1024 $resolution1 = 560 $resolution2 = 424 Endif If $res = 11 Then;1400x1050 $resolution1 = 600 $resolution2 = 450 EndIf If $res = 12 Then;1440x900 $resolution1 = 640 $resolution2 = 300 Endif If $res = 13 Then;1600x1200 $resolution1 = 800 $resolution2 = 600 Endif If $res = 14 Then;1680x1050 $resolution1 = 880 $resolution2 = 450 EndIfWow so now our bot can handle any resolution WoooOOOt Edited August 24, 2008 by burners ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 24, 2008 Moderators Share Posted August 24, 2008 If you only use Client Coordinates, and Opt("PixelCoordMode", 2)/Opt("MouseCoordMode", 2) you can avoid all the confusion on resolution all together. 1 set of coords to do the job on all resolutions. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
burners Posted August 24, 2008 Author Share Posted August 24, 2008 If you only use Client Coordinates, and Opt("PixelCoordMode", 2)/Opt("MouseCoordMode", 2) you can avoid all the confusion on resolution all together. 1 set of coords to do the job on all resolutions.I made that about 3 or 4 years ago when I first started coding. It was just what I had handy and I had to work with what I already knew how to do.Its long and dirty but it works.I will look into pixelcoordmode and check it out. ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 24, 2008 Moderators Share Posted August 24, 2008 I made that about 3 or 4 years ago when I first started coding. It was just what I had handy and I had to work with what I already knew how to do. Its long and dirty but it works. I will look into pixelcoordmode and check it out.You'll be much more satisfied. One thing though, if you aren't comfortable, an easy way to convert would be:Local $i_resW, $i_resH _SetResolution($i_resW, $i_resH) MsgBox(64, "Info", "Width Difference = " & $i_resW & @CRLF & "Height Difference = " & $i_resH) Func _SetResolution(ByRef $i_width_resolution, ByRef $i_height_resolution) $i_width_resolution = @DesktopWidth - 800 $i_height_resolution = @DesktopHeight - 600 Return EndFuncAnd again, you don't have to worry about all the code and getting all the possible resolutions correct ... In this day and age, seeing widths in the 2000's isn't uncommon. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
burners Posted August 24, 2008 Author Share Posted August 24, 2008 Wow thats awesome. So instead of adding resolution 1 & 2 I just add $i_resw & $i_resh but with alot less code. ~~--Feel Free to Steal my Sigs --~~FLAT LOOK____________________________________ROUNDED LOOK 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