Author Topic: Crafting menu resolution  (Read 3390 times)

0 Members and 1 Guest are viewing this topic.

Offline nekosamaTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • nekosama has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Crafting menu resolution
« on: October 27, 2008, 07:50:23 PM »
0
I had written a simple script for a friend. I play on my machine at 800x600.

But when I call out the locations for menu buttons i.e. use jointing plane, then click on container and click on wood box, it works fine on 2 of my computers, but it doesn't fit the resolution of their screen (also at 800x600).

Is there a way to scan the menu and set the positions without having to hard code it into the script before hand?

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Crafting menu resolution
« Reply #1 on: October 28, 2008, 12:55:05 AM »
0
I'm not sure I understand your question.  There shouldn't be any difference between the systems since they all seem to be running at 800x600.

EasyUO gives you positioning information for the client, #CLIXRES, #CLIYRES to see what you client window size is (can never be less than 640x480).

Also, if you invoke the carpentry tool, wait a bit for the tool gump to come up, you can see where the position of the gump is by looking at #CONTPOSX and #CONTPOSY.  That is the upper left corner of the gump.  From that you can do the math to tell your script where to click RELATIVE to the upper left corner of the gump.

For your example, if you want create a stool:

Code: [Select]
gosub MakeWoodenBox
stop
sub MakeWoodenBox
  finditem IGG C_ , #BACKPACKID
  if #FINDKIND = -1
  {
    display ok Cannot locate a joining plane
    return
  }
  set #LOBJECTID #FINDID
  event macro 17 0
  gosub GumpWait 530_437 generic_gump ; wait for correct gump to open
  gosub OffsetClick 233 70 ; click the button "Wooden Box" relative to the position of the carpentry gump (0,0)
  gosub GumpWait 530_437 generic_gump
return
;-------------------------------------------------------------------------------
sub GumpWait
  wait 10
  set %timedelay #SCNT
  loopwait1:
    if #CONTSIZE = %1 && #CONTNAME = %2
      return
    if #SCNT > %timedelay + 7
      return
    goto loopwait1
return
;-------------------------------------------------------------------------------
sub OffsetClick
  set %tempx %1 + #CONTPOSX
  set %tempy %2 + #CONTPOSY
  click %tempx %tempy f
return

Here's a neat little code snippet I use to generate the offset click values for buttons in a gump:

Code: [Select]
set #LPC 100
gosub showEUOMenu1
set %update_rate 5
set %timer #SCNT2 + %update_rate
set %MODE CAPTURE
repeat
  if #SCNT2 > %timer && %MODE = CAPTURE
  {
    menu set EUOEditMenu #CONTNAME
    menu set EUOEditSize #CONTSIZE
    menu set EUOEditX #CONTPOSX
    menu set EUOEditY #CONTPOSY
    set %tempx #CURSORX - #CONTPOSX
    set %tempy #CURSORY - #CONTPOSY
    set %string gosub , #SPC , OffsetClick , #SPC , %tempx , #SPC , %tempy
    menu set EUOEditString %string
    set %timer #SCNT2 + %update_rate
  }
 
  onhotkey F1 ALT
  {
    if %MODE = CAPTURE
    {
      set %MODE HOLD
      menu delete EUOLabel6
    }
    else
    {
      set %MODE CAPTURE
      menu Text EUOLabel6 4 136 ALT-F1 to capture
    }
    wait 10
  }
until #FALSE
;--------- EasyUO Menu Designer Code Begin ---------
sub showEUOMenu1
menu Clear
menu Window Title TM's Offset Click Generator
menu Window Color BtnFace
menu Window Size 236 147
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font Transparent #false
menu Font Align Left
menu Text EUOLabel1 128 8 Current Menu
menu Text EUOLabel2 128 32 Current Size
menu Text EUOLabel3 60 60 X Coord
menu Text EUOLabel4 60 84 X Coord
menu Text EUOLabel5 176 112 String
menu Text EUOLabel6 4 136 ALT-F1 to capture
menu Font BGColor Window
menu Edit EUOEditMenu 0 4 121
menu Edit EUOEditSize 0 28 121
menu Edit EUOEditX 0 56 53
menu Edit EUOEditY 0 80 53
menu Edit EUOEditString 0 108 169
menu Show 421 270
return
;--------- EasyUO Menu Designer Code End ---------

Just run it and open the gump you want to determine offsets from.  Hover the mouse over the button you want to "click" (be sure the gump is selected).  Then hit ALT-F1 to hold that position, then cut/paste the code string generated by the script into your script.  Be sure to include the OffsetClick sub in your script somewhere.

« Last Edit: October 28, 2008, 01:07:19 AM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline nekosamaTopic starter

  • Newbie
  • *
  • Posts: 5
  • Activity:
    0%
  • Reputation Power: 0
  • nekosama has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Crafting menu resolution
« Reply #2 on: October 28, 2008, 04:31:20 AM »
0
Ok, I got it now, thank you!

I guess what I did wrong, was I attempted to reposition the crafting gump THEN give it offsets in hard coordinate form.

Code: [Select]
sub makebox
finditem carptool C_ , #backpackid ; finds carp tool in pack
if #findkind = -1
   {
             display OK You have no Jointing Planes on you
             halt
   }
set %jointplane #findid
set #lobjectid %jointplane
finditem wood C_ , %backpackid
if #findcnt < 10
   {
             display OK You need at least 10 boards to make a box, you have #findcnt.
             halt
   }
event macro 17
wait 2s
contpos 0000 0000 ; location of gump
wait 1s
click 0000 0000 ; click containers
wait 1s
click 0000 0000 ; click wooden box
wait 2s
click 0000 0000 ; closes gump
return

Of course, I left the script that actually had the values for tools, resources and coordinates in them at home, but this is the basic format I used when I wrote this portion from work.

Thank you for the snippets, I will rework the script to go with offsets instead of coordinate value.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Crafting menu resolution
« Reply #3 on: October 28, 2008, 08:39:17 AM »
0
With those snippets, it won't matter where the gump is located on the screen.  Magical!
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: