ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Crisis on February 18, 2013, 05:51:13 PM
-
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)
;======================================================================
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? Gosub OffSetClick 30 450
If so, how did he get those numbers to tell what location to click in?
-
open any gump manually
then run this script
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.
-
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
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 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
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 (http://www.scriptuo.com/index.php?topic=505.msg4031#msg4031)
-
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.
-
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
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