Total players online: 3



Take the Tour | Site Map

It is currently Thu Dec 14, 2017 8:35 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Cheffe! ;)
PostPosted: Wed May 10, 2017 7:05 am 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

So I'm playing around with KalInEx's Magnify script, and I tried a few ways of redoing his image pixline, and all of them were very crash prone, and caused euo to throw a lot of errors. This was the only way of doing it that really seemed stable. Do you have a better suggestion? I see why Kal did it the way he did using img pixline. It was an easy way of keeping the amount of img create commands down, which is very error prone if you do too many of them. At least for me. His way worked great, but this is the only way I have found so far of doing it without causing errors with a 80x80 pixel image blown up to 400x400 like his was.

EDIT: Now with the ability to click SPACE SHIFT and scan from wherever your cursor is located. ;) Nearly done fixing KalInEx Magnify.

  1. set %scanStart 0
  2. set %scanLength 80
  3. set %windowSize 400
  4. set %pixelSize %windowSize / %scanLength
  5. set %pixelNum 999
  6. set %cursorPosX 0
  7. set %cursorPosY 0
  8.  
  9. gosub s_createForm form1 80 80 %windowSize 430 KalInEx , #spc , Magnify. #true
  10. menu image create magImage 0 0 %windowSize %windowSize
  11.  
  12. _reDraw:
  13.  
  14. {
  15.   set %x1 0
  16.   set %y1 0
  17.   set %scanX %cursorPosX
  18.   set %scanY %cursorPosY
  19.   set %x2 %x1 + %scanLength - 1
  20.   set %y2 %y1 + %scanLength - 1
  21.   set %
  22.   for %y %y1 %y2
  23.   {
  24.     set %yo %y * 5
  25.     for %x %x1 %x2
  26.     {
  27.       onhotkey space shift
  28.       {
  29.         gosub setCursorPos #cursorx #cursory
  30.         set %break #true
  31.         break
  32.       }
  33.       set %xo %x * 5
  34.       set %xOne %xo + 5
  35.       set %yOne %yo + 5
  36.       set %scanX1 %cursorPosX + %x
  37.       set %scanY1 %cursorPosY + %y
  38.       savePix %scanX1 %scanY1 %pixelNum
  39.       menu image rectangle MagImage %xo %yo %xOne %yOne #pixcol #true
  40.     }
  41.     if %break = #true
  42.       break
  43.   }
  44. }
  45.  
  46. sub setCursorPos
  47.   set %cursorPosX %1 - %scanLength / 2
  48.   set %cursorPosY %2 - %scanLength / 2
  49.  
  50. sub s_createForm
  51.   namespace local s_newMenu
  52.   menu form %1 %2 %3 %4 %5 %6
  53.   if %0 > 6 && %7 = #true
  54.     menu setprop %1 visible #true
  55.   if %0 > 6 && %7 = #false
  56.     menu setprop %1 visible #false

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Wed May 10, 2017 2:47 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

SPACE SHIFT works just as it did in KalInEx's version, and now I've added a red dot to signify the line it's currently scanning. I'll add mouseover of pixels to get pixcol and relevant pixel info like x/y coordinates and such. Then it'll be done. It looks like after a bit it sometimes "wigs out" but you just hit SPACE SHIFT and it "resets" itself. Not sure why it does that after a while. I'll look into it more.

  1. set %scanStart 0
  2. set %scanLength 80
  3. set %windowSize 400
  4. set %pixelSize %windowSize / %scanLength
  5. set %pixelNum 999
  6. set %cursorPosX 0
  7. set %cursorPosY 0
  8.  
  9. gosub s_createForm form1 %scanLength %scanLength %windowSize %windowSize KalInEx , #spc , Magnify. #true
  10. set #lpc 250
  11. menu image create magImage 0 0 %windowSize %windowSize
  12.  
  13. _reDraw:
  14.  
  15. {
  16.   set %x1 0
  17.   set %y1 0
  18.   set %scanX %cursorPosX
  19.   set %scanY %cursorPosY
  20.   set %x2 %x1 + %scanLength - 1
  21.   set %y2 %y1 + %scanLength - 1
  22.   for %y %y1 %y2
  23.   {
  24.     set %yo %y * %windowsize / %scanLength
  25.     for %x %x1 %x2
  26.     {
  27.       onhotkey space shift 3
  28.         gosub setCursorPos #cursorx #cursory
  29.         set %break #true
  30.         break
  31.       set %xo %x * %pixelSize
  32.       set %xOne %xo + %pixelSize
  33.       set %yOne %yo + %pixelSize
  34.       set %scanX1 %cursorPosX + %x
  35.       set %scanY1 %cursorPosY + %y
  36.       savePix %scanX1 %scanY1 %pixelNum
  37.       if %x = 0 4
  38.         menu image rectangle magImage %xo %yo %xOne %yOne red #true
  39.         set %tempMagImage #pixcol
  40.         set %tempYO %yo
  41.         set %tempyOne %yOne
  42.       else 6
  43.         set %bar %x , %y
  44.         if %magImage . %bar <> #pixcol 2
  45.           set %magImage . %bar #pixcol
  46.           menu image rectangle magImage %xo %yo %xOne %yOne #pixcol #true
  47.         if %x = 79
  48.           menu image rectangle magImage 0 %tempYO %pixelSize %tempyOne %tempMagImage #true
  49.     }
  50.     if %break = #true
  51.       break
  52.   }
  53. }
  54.  
  55. sub setCursorPos
  56.   set %cursorPosX %1 - %scanLength / 2
  57.   set %cursorPosY %2 - %scanLength / 2
  58.  
  59. sub s_createForm
  60.   namespace local s_newMenu
  61.   menu form %1 %2 %3 %4 %5 %6
  62.   if %0 > 6 && %7 = #true
  63.     menu setprop %1 visible #true
  64.   if %0 > 6 && %7 = #false
  65.     menu setprop %1 visible #false

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Thu May 11, 2017 1:28 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

Added some of Kal's code to add showing the color you're currently on in the menu, and cursor location on the menu. Will add other functionality as I get time. Also, if it starts drawing all black pixels, you must hit SPACE and SHIFT at the same time to "reinitialize" the scanning. Sometimes it gets out of whack.

EDIT: If you move the window, or when you run the script, you must click the little white button underneath the square showing the colors as you move the mouse, to reset it to match the game play window.

  1. set %scanStart 0
  2. set %scanLength 80
  3. set %windowSize 400
  4. set %pixelSize %windowSize / %scanLength
  5. set %pixelNum 999
  6. set %cursorPosX 0
  7. set %cursorPosY 0
  8. gosub s_createForm form1 %scanLength %scanLength %windowSize %windowSize KalInEx , #spc , Magnify , #spc , Scripty , #spc , Edit #true
  9. set #lpc 250
  10. menu image create magImage 0 0 %windowSize %windowSize
  11.  
  12. menu image create MagColor 10 10 30 30
  13. menu image rectangle MagColor 0 0 30 30 black #false
  14. menu image rectangle MagColor 1 1 29 29 red #false
  15. ;gosub _text MagColor 50 10 black red .
  16. gosub _text Cursor 50 25 black red #spc
  17. set %yo %WindowSize - 25
  18. gosub _text MenuCursor 10 %yo black red #spc
  19. gosub LoadMenuPosFinder 10 50
  20.  
  21. _repeatAgain:
  22.  
  23. {
  24.   set %x1 0
  25.   set %y1 0
  26.   set %scanX %cursorPosX
  27.   set %scanY %cursorPosY
  28.   set %x2 %x1 + %scanLength - 1
  29.   set %y2 %y1 + %scanLength - 1
  30.   for %y %y1 %y2
  31.   {
  32.     set %yo %y * %windowsize / %scanLength
  33.     for %x %x1 %x2
  34.     {
  35.       set %CursorX #cursorx - %MenuPosX
  36.       set %CursorY #cursorY - %MenuPosY
  37.       if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  38.         gosub Cursor
  39.       if #menubutton <> n/a
  40.         gosub MenuButton
  41.       onhotkey space shift 2
  42.         gosub setCursorPos #cursorx #cursory
  43.         set %break #true
  44.       set %xo %x * %pixelSize
  45.       set %xOne %xo + %pixelSize
  46.       set %yOne %yo + %pixelSize
  47.       set %scanX1 %cursorPosX + %x
  48.       set %scanY1 %cursorPosY + %y
  49.       savePix %scanX1 %scanY1 %pixelNum
  50.       if %x = 0 4
  51.         menu image rectangle magImage %xo %yo %xOne %yOne red #true
  52.         set %tempMagImage #pixcol
  53.         set %tempYO %yo
  54.         set %tempyOne %yOne
  55.       else 6
  56.         set %bar %x , %y
  57.         if %magImage . %bar <> #pixcol 2
  58.           set %magImage . %bar #pixcol
  59.           menu image rectangle magImage %xo %yo %xOne %yOne #pixcol #true
  60.         if %x = 79
  61.           menu image rectangle magImage 0 %tempYO %pixelSize %tempyOne %tempMagImage #true
  62.     }
  63.     if %break = #true
  64.       break
  65.   }
  66.   if %y >= %y2
  67.     break
  68. }
  69. menu button rescan 10 70 55 20 Rescan!
  70.     set %CursorX #cursorx - %MenuPosX
  71.   set %CursorY #cursorY - %MenuPosY
  72.   onhotkey space shift
  73.     set #menubutton rescan
  74.   if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  75.     gosub Cursor
  76.   if #menubutton <> n/a
  77.     gosub MenuButton
  78.   menu delete rescan
  79.   goto _repeatAgain
  80.  
  81. sub Cursor
  82.   set %LastCursorX %CursorX
  83.   set %LastCursorY %CursorY
  84.   set %ImageCursorX %cursorPosX + %CursorX / %pixelSize
  85.   set %ImageCursorY %cursorPosY + %CursorY / %pixelSize
  86.   savepix %ImageCursorX %ImageCursorY 1
  87.   menu image floodfill MagColor 10 10 #pixcol
  88.  ; menu set MagColor #dot , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , #spc , Color: #pixcol
  89.   menu set Cursor Color: #pixcol
  90.   set %MenuCursorX %CursorX / %pixelSize
  91.   set %MenuCursorY %CursorY / %pixelSize
  92.   menu set MenuCursor Menu: %MenuCursorX / %MenuCursorY
  93.  
  94. sub MenuButton
  95.   set %MenuButton #menubutton
  96.   if %menubutton = closed
  97.   {
  98.     sound chimes
  99.     halt
  100.   }
  101.   if cc_ in %menubutton
  102.   {
  103.     str del %MenuButton 1 3
  104.     set %MenuButton #strres
  105.     str pos %MenuButton _
  106.     set #strres #strres - 1
  107.     str mid %MenuButton 1 #strres
  108.     set %MenuPosX #cursorx - #strres
  109.     str pos %MenuButton _
  110.     str del %MenuButton 1 #strres
  111.     set %MenuPosY #cursory - #strres
  112.   }
  113.  
  114. sub LoadMenuPosFinder
  115.   menu shape cc_ %1 %2 11 11 6 7 1 red 2 red
  116.   set %1 %1 + 1
  117.   set %2 %2 + 1
  118.   set %3 %1 + 8
  119.   set %4 %2 + 8
  120.   for %y %2 %4
  121.   {
  122.     for %x %1 %3
  123.       menu button cc_ , %x , _ , %y %x %y 1 1 #spc
  124.   }
  125.  
  126. sub _text
  127.   if %0 > 6
  128.   {
  129.     for %_ 7 %0
  130.       set %6 %6 , #spc , % . %_
  131.   }
  132.   for %x 1 1
  133.   {
  134.     set %xo %x + %2
  135.     for %y 1 1
  136.     {
  137.       set %yo %y + %3
  138.       if %xo <> %2 || %yo <> %3
  139.         menu text %1 %xo %yo %6
  140.     }
  141.   }
  142.   menu text %1 %2 %3 %6
  143.  
  144. sub setCursorPos
  145.   set %cursorPosX %1 - %scanLength / 2
  146.   set %cursorPosY %2 - %scanLength / 2
  147.  
  148. sub s_createForm
  149.   namespace local s_newMenu
  150.   menu form %1 %2 %3 %4 %5 %6
  151.   if %0 > 6 && %7 = #true
  152.     menu setprop %1 visible #true
  153.   if %0 > 6 && %7 = #false
  154.     menu setprop %1 visible #false

_________________
Image


Last edited by Scripty on Thu May 11, 2017 3:07 pm, edited 4 times in total.

Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Thu May 11, 2017 2:37 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

Basic functionality is in. Shows color you are currently on in menu, and menu position after you click the little white button to initialize the variables for that. The script now pauses at the end of scanning, and provides a button to rescan, but the functionality of mousing over the image to see the pixcol and mouse location remains working. If you want to rescan an area, just hit SPACE and SHIFT at the same time. Or click the Rescan! button.

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Thu May 11, 2017 4:58 pm 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

Fully functioning edit of KalInEx's great magnify script. A really great tool for scripters trying to find out info on pixels and pixcol/rgb info in euo/uo. Had to change the way it worked after Cheffe took out menu image pixline from euo. Enjoy. Now maybe I'll take a crack at SOS Master. ;)

  1. set %showRGBInfo #true
  2. set %scanStart 0
  3. set %scanLength 40
  4. set %windowSize 400
  5. set %pixelSize %windowSize / %scanLength
  6. set %pixelNum 999
  7. set %cursorPosX 0
  8. set %cursorPosY 0
  9.  
  10. gosub s_createForm form1 %scanLength %scanLength %windowSize %windowSize KalInEx , #spc , Magnify , #spc , Scripty , #spc , Edit #true
  11. gosub s_createForm form2 450 200 200 200 Scriptys , #spc , Menu , #doc #true
  12.  
  13.  
  14. menu setDef parent form1
  15. set #lpc 250
  16. menu image create magImage 0 0 %windowSize %windowSize
  17. menu image create MagColor 10 10 30 30
  18. menu image rectangle MagColor 0 0 30 30 black #false
  19. menu image rectangle MagColor 1 1 29 29 red #false
  20. if %showRGBInfo = #true
  21. {
  22.   menu image create RedComponent 10 70 10 10
  23.   menu image floodfill RedComponent 0 0 red
  24.   menu image rectangle RedComponent 0 0 10 10 black #false
  25.   gosub _text RedComponent 23 67 black red R:
  26.   menu image create GreenComponent 10 85 10 10
  27.   menu image floodfill GreenComponent 0 0 green
  28.   menu image rectangle GreenComponent 0 0 10 10 black #false
  29.   gosub _text GreenComponent 23 82 black red G:
  30.   menu image create BlueComponent 10 100 10 10
  31.   menu image floodfill BlueComponent 0 0 blue
  32.   menu image rectangle BlueComponent 0 0 10 10 black #false
  33.   gosub _text BlueComponent 23 97 black red B:
  34.   menu text RedComponent1 37 67 0/0
  35.   menu text GreenComponent1 37 82 0/0
  36.   menu text BlueComponent1 37 97 0/0
  37. }
  38. gosub _text MagColor 50 10 black red #spc
  39. gosub _text Cursor 50 25 black red #spc
  40. set %yo %WindowSize - 25
  41. gosub _text MenuCursor 10 %yo black red #spc
  42. gosub LoadMenuPosFinder 10 50
  43. _repeatAgain:
  44.  
  45. {
  46.   set %x1 0
  47.   set %y1 0
  48.   set %scanX %cursorPosX
  49.   set %scanY %cursorPosY
  50.   set %x2 %x1 + %scanLength - 1
  51.   set %y2 %y1 + %scanLength - 1
  52.   for %y %y1 %y2
  53.   {
  54.     set %yo %y * %windowsize / %scanLength
  55.     for %x %x1 %x2
  56.     {
  57.       set %CursorX #cursorx - %MenuPosX
  58.       set %CursorY #cursorY - %MenuPosY
  59.       if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  60.         gosub Cursor
  61.       if #menubutton <> n/a
  62.         gosub MenuButton
  63.       onhotkey space shift 3
  64.         _scanFromHere:
  65.         gosub setCursorPos #cursorx #cursory
  66.         set %break #true
  67.       set %xo %x * %pixelSize
  68.       set %xOne %xo + %pixelSize
  69.       set %yOne %yo + %pixelSize
  70.       set %scanX1 %cursorPosX + %x
  71.       set %scanY1 %cursorPosY + %y
  72.       savePix %scanX1 %scanY1 %pixelNum
  73.       if %x = 0 4
  74.         menu image rectangle magImage %xo %yo %xOne %yOne red #true
  75.         set %tempMagImage #pixcol
  76.         set %tempYO %yo
  77.         set %tempyOne %yOne
  78.       else 6
  79.         set %bar %x , %y
  80.         if %magImage . %bar <> #pixcol 2
  81.           set %magImage . %bar #pixcol
  82.           menu image rectangle magImage %xo %yo %xOne %yOne #pixcol #true
  83.         if %x >= %y2
  84.           menu image rectangle magImage 0 %tempYO %pixelSize %tempyOne %tempMagImage #true
  85.     }
  86.     if %break = #true
  87.       break
  88.   }
  89.   if %y > %y2
  90.     break
  91. }
  92.   menu button rescan 10 117 55 20 Rescan!
  93.   set %CursorX #cursorx - %MenuPosX
  94.   set %CursorY #cursorY - %MenuPosY
  95.   onhotkey space shift 2
  96.     delete rescan
  97.     goto _scanFromHere
  98.   if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  99.     gosub Cursor
  100.   if #menubutton <> n/a
  101.     gosub MenuButton
  102.   menu delete rescan
  103.   goto _repeatAgain
  104.  
  105. sub Cursor
  106.   set %LastCursorX %CursorX
  107.   set %LastCursorY %CursorY
  108.   set %ImageCursorX %cursorPosX + %CursorX / %pixelSize
  109.   set %ImageCursorY %cursorPosY + %CursorY / %pixelSize
  110.   savepix %ImageCursorX %ImageCursorY 1
  111.   menu image floodfill MagColor 10 10 #pixcol
  112.   menu set Cursor Color: #pixcol
  113.   set %MenuCursorX %CursorX / %pixelSize
  114.   set %MenuCursorY %CursorY / %pixelSize
  115.   menu set MenuCursor Menu: %MenuCursorX / %MenuCursorY
  116.   if %ShowRGBInfo = #true
  117.   {
  118.     set %B1 #pixcol % 16777216 / 65536
  119.     set %_ %B1 / 8 + 1
  120.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  121.     set %B2 #strres
  122.     set %G1 #pixcol % 65536 / 256
  123.     set %_ %G1 / 8 + 1
  124.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  125.     set %G2 #strres
  126.     set %R1 #pixcol % 65536 % 256
  127.     set %_ %R1 / 8 + 1
  128.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  129.     set %R2 #strres
  130.     menu set BlueComponent1 %B2 %B1
  131.     menu set GreenComponent1 %G2 %G1
  132.     menu set RedComponent1 %R2 %R1
  133.   }
  134.  
  135. sub MenuButton
  136.   set %MenuButton #menubutton
  137.   if %menubutton = closed 2
  138.     sound chimes
  139.     halt
  140.   if cc_ in %menubutton
  141.   {
  142.     str del %MenuButton 1 3
  143.     set %MenuButton #strres
  144.     str pos %MenuButton _
  145.     set #strres #strres - 1
  146.     str mid %MenuButton 1 #strres
  147.     set %MenuPosX #cursorx - #strres
  148.     str pos %MenuButton _
  149.     str del %MenuButton 1 #strres
  150.     set %MenuPosY #cursory - #strres
  151.   }
  152.  
  153. sub LoadMenuPosFinder
  154.   menu shape cc_ %1 %2 11 11 6 7 1 red 2 red
  155.   set %1 %1 + 1
  156.   set %2 %2 + 1
  157.   set %3 %1 + 8
  158.   set %4 %2 + 8
  159.   for %y %2 %4
  160.   {
  161.     for %x %1 %3
  162.       menu button cc_ , %x , _ , %y %x %y 1 1 #spc
  163.   }
  164.  
  165. sub _text
  166.   menu text %1 %2 %3 %6
  167.  
  168. sub setCursorPos
  169.   set %cursorPosX %1 - %scanLength / 2
  170.   set %cursorPosY %2 - %scanLength / 2
  171.  
  172. sub s_createForm
  173.   namespace local s_newMenu
  174.   menu form %1 %2 %3 %4 %5 %6
  175.   if %0 > 6 && %7 = #true
  176.     menu setprop %1 visible #true
  177.   if %0 > 6 && %7 = #false
  178.     menu setprop %1 visible #false

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Tue May 16, 2017 10:48 am 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

Made some changes to ensure buttons all work correctly. Scanning pauses after you scan the image. Just put your mouse over the game window where you'd like to rescan, and hit SPACE and SHIFT at the same time. That will rescan the image at the location of your mouse over the game window. Don't forget to "initialize" the menu by clicking the white button, to make it match the pixel coordinates in game. If you don't do that, the info you see when you mouse over the menu will be incorrect! ;)

  1. set %showRGBInfo #true
  2. set %scanStart 0
  3. set %scanLength 40
  4. set %windowSizeX 400
  5. set %windowSizeY 400
  6. set %pixelSize %windowSizeX / %scanLength
  7. set %pixelNum 999
  8. set %cursorPosX 0
  9. set %cursorPosY 0
  10.  
  11. gosub s_createForm form1 %scanLength %scanLength %windowSizeX %windowSizeY KalInEx , #spc , Magnify , #spc , Scripty , #spc , Edit #true
  12. ;gosub s_createForm form2 450 200 200 200 Scriptys , #spc , Menu , #doc #true
  13.  
  14.  
  15. menu setDef parent form1
  16. set #lpc 500
  17. menu image create magImage 0 0 %windowSizeX %windowSizeX
  18. menu image create MagColor 10 10 30 30
  19. menu image rectangle MagColor 0 0 30 30 black #false
  20. menu image rectangle MagColor 1 1 29 29 red #false
  21. if %showRGBInfo = #true
  22. {
  23.   menu image create RedComponent 10 70 10 10
  24.   menu image floodfill RedComponent 0 0 red
  25.   menu image rectangle RedComponent 0 0 10 10 black #false
  26.   gosub _text RedComponent 23 67 black red R:
  27.   menu image create GreenComponent 10 85 10 10
  28.   menu image floodfill GreenComponent 0 0 green
  29.   menu image rectangle GreenComponent 0 0 10 10 black #false
  30.   gosub _text GreenComponent 23 82 black red G:
  31.   menu image create BlueComponent 10 100 10 10
  32.   menu image floodfill BlueComponent 0 0 blue
  33.   menu image rectangle BlueComponent 0 0 10 10 black #false
  34.   gosub _text BlueComponent 23 97 black red B:
  35.   menu text RedComponent1 37 67 0/0
  36.   menu text GreenComponent1 37 82 0/0
  37.   menu text BlueComponent1 37 97 0/0
  38. }
  39. gosub _text MagColor 50 10 black red #spc
  40. gosub _text Cursor 50 412 black red #spc ; 25
  41. set %yo %windowSizeX - 25
  42. gosub _text MenuCursor 10 %yo black red #spc
  43. gosub LoadMenuPosFinder 10 50
  44. _repeatAgain:
  45.  
  46. {
  47.   set %x1 0
  48.   set %y1 0
  49.   set %scanX %cursorPosX
  50.   set %scanY %cursorPosY
  51.   set %x2 %x1 + %scanLength - 1
  52.   set %y2 %y1 + %scanLength - 1
  53.   for %y %y1 %y2
  54.   {
  55.     set %yo %y * %windowSizeX / %scanLength
  56.     for %x %x1 %x2
  57.     {
  58.       set %CursorX #cursorx - %MenuPosX
  59.       set %CursorY #cursorY - %MenuPosY
  60.       if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  61.         gosub Cursor
  62.       if #menubutton <> n/a
  63.         gosub MenuButton
  64.       onhotkey space shift 3
  65.         set %break #true
  66.         _scanFromHere:
  67.         gosub setCursorPos #cursorx #cursory
  68.       set %xo %x * %pixelSize
  69.       set %xOne %xo + %pixelSize
  70.       set %yOne %yo + %pixelSize
  71.       set %scanX1 %cursorPosX + %x
  72.       set %scanY1 %cursorPosY + %y
  73.       savePix %scanX1 %scanY1 %pixelNum
  74.       if %x = 0 4
  75.         menu image rectangle magImage %xo %yo %xOne %yOne red #true
  76.         set %tempMagImage #pixcol
  77.         set %tempYO %yo
  78.         set %tempyOne %yOne
  79.       else 6
  80.         set %bar %x , %y
  81.         if %magImage . %bar <> #pixcol 2
  82.           set %magImage . %bar #pixcol
  83.           menu image rectangle magImage %xo %yo %xOne %yOne #pixcol #true
  84.         if %x >= %y2
  85.           menu image rectangle magImage 0 %tempYO %pixelSize %tempyOne %tempMagImage #true
  86.     }
  87.     if %break = #true
  88.       break
  89.   }
  90.   if %y > %y2
  91.     break
  92. }
  93.   menu button rescan 10 117 55 20 Rescan!
  94.   set %CursorX #cursorx - %MenuPosX
  95.   set %CursorY #cursorY - %MenuPosY
  96.   onhotkey space shift 2
  97.     menu delete rescan
  98.     goto _scanFromHere
  99.   if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  100.     gosub Cursor
  101.   if #menubutton <> n/a && #menuButton <> rescan
  102.     gosub MenuButton
  103.   menu delete rescan
  104.   goto _repeatAgain
  105.  
  106. sub Cursor
  107.   set %LastCursorX %CursorX
  108.   set %LastCursorY %CursorY
  109.   set %ImageCursorX %cursorPosX + %CursorX / %pixelSize
  110.   set %ImageCursorY %cursorPosY + %CursorY / %pixelSize
  111.   savepix %ImageCursorX %ImageCursorY 1
  112.   menu image floodfill MagColor 10 10 #pixcol
  113.   menu set Cursor Color: #pixcol
  114.   set %MenuCursorX %CursorX / %pixelSize
  115.   set %MenuCursorY %CursorY / %pixelSize
  116.   menu set MenuCursor Menu: %MenuCursorX / %MenuCursorY
  117.   if %ShowRGBInfo = #true
  118.   {
  119.     set %B1 #pixcol % 16777216 / 65536
  120.     set %_ %B1 / 8 + 1
  121.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  122.     set %B2 #strres
  123.     set %G1 #pixcol % 65536 / 256
  124.     set %_ %G1 / 8 + 1
  125.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  126.     set %G2 #strres
  127.     set %R1 #pixcol % 65536 % 256
  128.     set %_ %R1 / 8 + 1
  129.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  130.     set %R2 #strres
  131.     menu set BlueComponent1 %B2 %B1
  132.     menu set GreenComponent1 %G2 %G1
  133.     menu set RedComponent1 %R2 %R1
  134.   }
  135.  
  136. sub MenuButton
  137.   set %MenuButton #menubutton
  138.   if %menubutton = closed 2
  139.     sound chimes
  140.     halt
  141.   if cc_ in %menubutton
  142.   {
  143.     str del %MenuButton 1 3
  144.     set %MenuButton #strres
  145.     str pos %MenuButton _
  146.     set #strres #strres - 1
  147.     str mid %MenuButton 1 #strres
  148.     set %MenuPosX #cursorx - #strres
  149.     str pos %MenuButton _
  150.     str del %MenuButton 1 #strres
  151.     set %MenuPosY #cursory - #strres
  152.   }
  153.  
  154. sub LoadMenuPosFinder
  155.   menu shape cc_ %1 %2 11 11 6 7 1 red 2 red
  156.   set %1 %1 + 1
  157.   set %2 %2 + 1
  158.   set %3 %1 + 8
  159.   set %4 %2 + 8
  160.   for %y %2 %4
  161.   {
  162.     for %x %1 %3
  163.       menu button cc_ , %x , _ , %y %x %y 1 1 #spc
  164.   }
  165.  
  166. sub _text
  167.   menu text %1 %2 %3 %6
  168.  
  169. sub setCursorPos
  170.   set %cursorPosX %1 - %scanLength / 2
  171.   set %cursorPosY %2 - %scanLength / 2
  172.  
  173. sub s_createForm
  174.   namespace local s_newMenu
  175.   menu form %1 %2 %3 %4 %5 %6
  176.   if %0 > 6 && %7 = #true
  177.     menu setprop %1 visible #true
  178.   if %0 > 6 && %7 = #false
  179.     menu setprop %1 visible #false

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Thu May 25, 2017 2:31 am 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

#pixcol is moved back to where you can see it. Added Cursor position and menu position. Menu position is the pixel that is on the menu, based on menu size and pixel size. Cursor position is the position of where the cursor would be in the game window when it's hovered over the menu pixels.

  1. set %showRGBInfo #true
  2. set %scanStart 0
  3. set %scanLength 80
  4. set %windowSizeX 400
  5. set %windowSizeY 400
  6. set %pixelSize %windowSizeX / %scanLength
  7. set %pixelNum 999
  8. set %cursorPosX 0
  9. set %cursorPosY 0
  10.  
  11. gosub s_createForm form1 %scanLength %scanLength %windowSizeX %windowSizeY KalInEx , #spc , Magnify , #spc , Scripty , #spc , Edit #true
  12. ;gosub s_createForm form2 450 200 200 200 Scriptys , #spc , Menu , #doc #true
  13.  
  14.  
  15. menu setDef parent form1
  16. set #lpc 200
  17. menu image create magImage 0 0 %windowSizeX %windowSizeX
  18. menu image create MagColor 10 10 30 30
  19. menu image rectangle MagColor 0 0 30 30 black #false
  20. menu image rectangle MagColor 1 1 29 29 red #false
  21. if %showRGBInfo = #true
  22. {
  23.   menu image create RedComponent 10 70 10 10
  24.   menu image floodfill RedComponent 0 0 red
  25.   menu image rectangle RedComponent 0 0 10 10 black #false
  26.   gosub _text RedComponent 23 67 black red R:
  27.   menu image create GreenComponent 10 85 10 10
  28.   menu image floodfill GreenComponent 0 0 green
  29.   menu image rectangle GreenComponent 0 0 10 10 black #false
  30.   gosub _text GreenComponent 23 82 black red G:
  31.   menu image create BlueComponent 10 100 10 10
  32.   menu image floodfill BlueComponent 0 0 blue
  33.   menu image rectangle BlueComponent 0 0 10 10 black #false
  34.   gosub _text BlueComponent 23 97 black red B:
  35.   menu text RedComponent1 37 67 0/0
  36.   menu text GreenComponent1 37 82 0/0
  37.   menu text BlueComponent1 37 97 0/0
  38. }
  39. gosub _text MagColor 50 10 black red #spc
  40. gosub _text Cursor 50 26 black red #spc ; 25
  41. gosub _text CursorPos 50 9 black red #spc
  42. set %yo %windowSizeX - 25
  43. gosub _text MenuCursor 10 %yo black red #spc
  44. gosub LoadMenuPosFinder 10 50
  45. _repeatAgain:
  46.  
  47. {
  48.   set %x1 0
  49.   set %y1 0
  50.   set %scanX %cursorPosX
  51.   set %scanY %cursorPosY
  52.   set %x2 %x1 + %scanLength - 1
  53.   set %y2 %y1 + %scanLength - 1
  54.   for %y %y1 %y2
  55.   {
  56.     set %yo %y * %windowSizeX / %scanLength
  57.     for %x %x1 %x2
  58.     {
  59.       set %CursorX #cursorx - %MenuPosX
  60.       set %CursorY #cursorY - %MenuPosY
  61.       if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  62.         gosub Cursor
  63.       if #menubutton <> n/a
  64.         gosub MenuButton
  65.       onhotkey space shift 3
  66.         set %break #true
  67.         _scanFromHere:
  68.         gosub setCursorPos #cursorx #cursory
  69.       set %xo %x * %pixelSize
  70.       set %xOne %xo + %pixelSize
  71.       set %yOne %yo + %pixelSize
  72.       set %scanX1 %cursorPosX + %x
  73.       set %scanY1 %cursorPosY + %y
  74.       savePix %scanX1 %scanY1 %pixelNum
  75.       if %x = 0 4
  76.         menu image rectangle magImage %xo %yo %xOne %yOne red #true
  77.         set %tempMagImage #pixcol
  78.         set %tempYO %yo
  79.         set %tempyOne %yOne
  80.       else 6
  81.         set %bar %x , %y
  82.         if %magImage . %bar <> #pixcol 2
  83.           set %magImage . %bar #pixcol
  84.           menu image rectangle magImage %xo %yo %xOne %yOne #pixcol #true
  85.         if %x >= %y2
  86.           menu image rectangle magImage 0 %tempYO %pixelSize %tempyOne %tempMagImage #true
  87.     }
  88.     if %break = #true
  89.       break
  90.   }
  91.   if %y > %y2
  92.     break
  93. }
  94.   menu button rescan 10 117 55 20 Rescan!
  95.   set %CursorX #cursorx - %MenuPosX
  96.   set %CursorY #cursorY - %MenuPosY
  97.   onhotkey space shift 2
  98.     menu delete rescan
  99.     goto _scanFromHere
  100.   if %CursorX <> %LastCursorX || %CursorY <> %LastCursorY
  101.     gosub Cursor
  102.   if #menubutton <> n/a && #menuButton <> rescan
  103.     gosub MenuButton
  104.   menu delete rescan
  105.   goto _repeatAgain
  106.  
  107. sub Cursor
  108.   set %LastCursorX %CursorX
  109.   set %LastCursorY %CursorY
  110.   set %ImageCursorX %cursorPosX + %CursorX / %pixelSize
  111.   set %ImageCursorY %cursorPosY + %CursorY / %pixelSize
  112.   menu set CursorPos Cursor: %ImageCursorX / %ImageCursorY
  113.   savepix %ImageCursorX %ImageCursorY 1
  114.   menu image floodfill MagColor 10 10 #pixcol
  115.   menu set Cursor # , PIXCOL: #pixcol
  116.   set %ImageCursorX %ScanPosX + %CursorX / %ScanScale
  117.   set %ImageCursorY %ScanPosY + %CursorY / %ScanScale
  118.   set %MenuCursorX %CursorX / %pixelSize
  119.   set %MenuCursorY %CursorY / %pixelSize
  120.   menu set MenuCursor Menu: %MenuCursorX / %MenuCursorY
  121.   if %ShowRGBInfo = #true
  122.   {
  123.     set %B1 #pixcol % 16777216 / 65536
  124.     set %_ %B1 / 8 + 1
  125.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  126.     set %B2 #strres
  127.     set %G1 #pixcol % 65536 / 256
  128.     set %_ %G1 / 8 + 1
  129.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  130.     set %G2 #strres
  131.     set %R1 #pixcol % 65536 % 256
  132.     set %_ %R1 / 8 + 1
  133.     str mid ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 %_ 1
  134.     set %R2 #strres
  135.     menu set BlueComponent1 %B2 %B1
  136.     menu set GreenComponent1 %G2 %G1
  137.     menu set RedComponent1 %R2 %R1
  138.   }
  139.  
  140. sub MenuButton
  141.   set %MenuButton #menubutton
  142.   if %menubutton = closed 2
  143.     sound chimes
  144.     halt
  145.   if cc_ in %menubutton
  146.   {
  147.     str del %MenuButton 1 3
  148.     set %MenuButton #strres
  149.     str pos %MenuButton _
  150.     set #strres #strres - 1
  151.     str mid %MenuButton 1 #strres
  152.     set %MenuPosX #cursorx - #strres
  153.     str pos %MenuButton _
  154.     str del %MenuButton 1 #strres
  155.     set %MenuPosY #cursory - #strres
  156.   }
  157.  
  158. sub LoadMenuPosFinder
  159.   menu shape cc_ %1 %2 11 11 6 7 1 red 2 red
  160.   set %1 %1 + 1
  161.   set %2 %2 + 1
  162.   set %3 %1 + 8
  163.   set %4 %2 + 8
  164.   for %y %2 %4
  165.   {
  166.     for %x %1 %3
  167.       menu button cc_ , %x , _ , %y %x %y 1 1 #spc
  168.   }
  169.  
  170. sub _text
  171.   menu text %1 %2 %3 %6
  172.  
  173. sub setCursorPos
  174.   set %cursorPosX %1 - %scanLength / 2
  175.   set %cursorPosY %2 - %scanLength / 2
  176.  
  177. sub s_createForm
  178.   namespace local s_newMenu
  179.   menu form %1 %2 %3 %4 %5 %6
  180.   if %0 > 6 && %7 = #true
  181.     menu setprop %1 visible #true
  182.   if %0 > 6 && %7 = #false
  183.     menu setprop %1 visible #false

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Thu May 25, 2017 3:45 am 
Offline
Apprentice Scripter
Apprentice Scripter

Joined: 07/07/2004 23:13
Posts: 32
Location: Couch!

Groups:
Well Done!

now we can crack uo again :P


Top
  ProfileShow poster's scripts in the public script library 
 Post subject: Re: Cheffe! ;)
PostPosted: Thu May 25, 2017 7:38 am 
Offline
Legendary Scripter
Legendary Scripter
User avatar

Joined: 07/10/2004 17:11
Posts: 2124

Just so you're aware. When Kal wrote this, he has it scan the pixels that correspond to the menu in the game window when you mouse over them. So if anything in the game window is different than what's in the menu, it will show a different color, and pixcol. Like if you scan your character, and your character fidgets... or you move him, but don't update the menu window, it will be all wrong info when you mouse over the menu. Because it scans those pixels in real time from the game window as you mouse over the menu. It might be a better way to save the pixel info as it scans it, on a per pixel basis, so it always matches the menu. Not a huge deal because I think most people use it to scan static gump windows. But it's something to be aware of when you use it, and you think if you scan something that moves in game that the info is correct. Hint: It's not. ;) What is in the menu MUST match what is in the game window for it to show correct pixcol info for each pixel.

_________________
Image


Top
  ProfileShow poster's scripts in the public script library 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Hosted by CalWeb Internet Services, Inc.