Author Topic: Crafting Script Question  (Read 3071 times)

0 Members and 1 Guest are viewing this topic.

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3019
  • Activity:
    3.2%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Crafting Script Question
« on: February 18, 2013, 05:51:13 PM »
0
Ok I am trying to learn more about scripting and I am more of a hands on person. I have read the tutorials which were very helpful but I didn't see one that addressed crafting. I am dissecting Paulonius' Blacksmith Script and can not figure out how or where he gets the numbers to tell the mouse where to click. (Well if I am understanding this sub correctly anyways)

Code: [Select]
;======================================================================
sub InitTinkerGump    ; Makes sure you have two kits and sets it to use iron
    finditem %Tinkertools C_ , #backpackid
      if #findcnt < 1
         {
          display Get a tinker tool in your backpack and restart the script.
          halt
         }
      if #findcnt < 2
      {
       gosub MakeTinkerKit
      }
      TinkerSetLoop:
      finditem %Tinkertools C_ , #backpackid
      set #lobjectid #findid
         event macro 17
               gosub waitforgump %cwin
              if ! #result
              {
              Goto TinkerSetLoop
              }
         Gosub OffSetClick 30 370
               gosub waitforgump %cwin
              if ! #result
              {
              Goto TinkerSetLoop
              }
         Gosub OffSetClick 230 70
               gosub waitforgump %cwin
               if ! #result
               {
              Goto TinkerSetLoop
               }
         Gosub OffSetClick 30 450
         wait 5
Return


If I am understanding it correctly, the numbers in this tell the mouse where to click?
Code: [Select]
Gosub OffSetClick 30 450
If so, how did he get those numbers to tell what location to click in?

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Crafting Script Question
« Reply #1 on: February 18, 2013, 06:17:15 PM »
0
open any gump manually

then run this script

Code: [Select]
contpos 0 0
halt

Now move your mouse over the gump button you want to know the location of... and see what #cursorx #cursory values are in the right hand column of euo.
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3019
  • Activity:
    3.2%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Crafting Script Question
« Reply #2 on: February 18, 2013, 06:38:11 PM »
0
That is awesome! If I were to need to go to a 2nd page, I would use that to find the coords for the next page button and then I would do it on the next page for the item that I needed crafted?

For example, lets say that next page would be 40 250 I would do

Code: [Select]
Gosub OffSetClick 40 250 ;click next page button
gosub waitforgump %cwin  ;pause for gump to reset to next page
Gosub OffSetClick 30 370  ;makes item

or something like that?

Offline slyone

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: Crafting Script Question
« Reply #3 on: February 18, 2013, 06:41:16 PM »
0
That is awesome! If I were to need to go to a 2nd page, I would use that to find the coords for the next page button and then I would do it on the next page for the item that I needed crafted?

For example, lets say that next page would be 40 250 I would do

Code: [Select]
Gosub OffSetClick 40 250 ;click next page button
gosub waitforgump %cwin  ;pause for gump to reset to next page
Gosub OffSetClick 30 370  ;makes item

or something like that?

That sounds correct.

TM wrote a nice OffsetClick generator if you want to check it out:

http://www.scriptuo.com/index.php?topic=505.msg4031#msg4031
Started playing back at the Second Age

Offline CrisisTopic starter

  • Global Moderator
  • *
  • *
  • Posts: 3019
  • Activity:
    3.2%
  • Reputation Power: 41
  • Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.Crisis is a force to reckon with.
  • Gender: Male
  • Scripting well enough to break things!
  • Respect: +206
  • Referrals: 2
    • View Profile
Re: Crafting Script Question
« Reply #4 on: February 18, 2013, 08:35:41 PM »
0
What command set the crafting window in particular place? I notice that the coords for the button change if the window is in a different location.

Offline Endless Night

  • Global Moderator
  • *
  • *
  • Posts: 5467
  • Activity:
    0%
  • Reputation Power: 62
  • Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!Endless Night is awe-inspiring!
  • Respect: +393
  • Referrals: 1
    • View Profile
Re: Crafting Script Question
« Reply #5 on: February 19, 2013, 07:01:05 AM »
0
What command set the crafting window in particular place? I notice that the coords for the button change if the window is in a different location.

The command that sets all gumps in a particualr place is contpos  http://wiki.easyuo.com/index.php?title=ContPos

But it does not matter where the gump is .. if you find out the button location when the gump is at 0 0 then say button is 20 20   then if the gump is at 100 100... you click 100+20 100+20  ie 120 120  if its at 370 240 ... guess what you click 370 + 20 240 + 20 ... You always click in the gump in the same location relative to the gumps top left corner... if the left corner moves you just add the moved amount...   if gump at -50 100  you click -30 120


Gosub OffSetClick   <--- well that is a sub that does the additions for you.. ie something like below

Code: [Select]
sub Myoffsetclick ; pass x y
 set !clickx #contposx + %1   ; the current x position of the gump + the position to click if gump is at 0 0
 set !clicky #contposx + %2   ; the current y position of the gump + the position to click if gump is at 0 0
 click !clickx !clicky
return
Outlaw Josey Wales - "Manwink, A Long Gone Scripty, and Endless are always teasing us with their private sections lol. What there realy saying is scripters rule and users drool."
Briza - "Your a living breathing vortex of usefulness."

Tags: