ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Coragin on December 27, 2009, 09:16:48 AM

Title: Someone please explain this in childs terms.
Post by: Coragin on December 27, 2009, 09:16:48 AM
Okay so I have the TRUE locations of ALL buttons for crafting and imbuing gumps.  Meaning I can call a click with the size of the window and where the button is located on the window and not on screen.  In case gumps move.

Can someone please explain how to do the clicks?  I know how to do click 50 50, ect, but how do i make it click for just the window?  I am drawing a blank here. 

Please give a few examples, or one really good one, like make last would be awesome, since I know the x/y and all craf gumps are the same size...

So how would a

gosub makelast

sub makelast

the blah blah stuff
return

Thanks guys.  This will make redoing my craft scripts EASY.  Well kinda anyways.
Title: Re: Someone please explain this in childs terms.
Post by: Scrripty on December 27, 2009, 10:33:55 AM
Okay so I have the TRUE locations of ALL buttons for crafting and imbuing gumps.  Meaning I can call a click with the size of the window and where the button is located on the window and not on screen.  In case gumps move.

Can someone please explain how to do the clicks?  I know how to do click 50 50, ect, but how do i make it click for just the window?  I am drawing a blank here. 

Please give a few examples, or one really good one, like make last would be awesome, since I know the x/y and all craf gumps are the same size...

So how would a

gosub makelast

sub makelast

the blah blah stuff
return

Thanks guys.  This will make redoing my craft scripts EASY.  Well kinda anyways.

There's a really good craftgump tutorial somewhere on easyuo...  Not sure where.  Search is your friend. :)
Title: Re: Someone please explain this in childs terms.
Post by: OMGBurgers on December 27, 2009, 10:41:50 AM
here's my craft sub.  not sure if it still works with the imbuing gump change.  i use it in my master craft script and haven't had a problem much with it.  i'm sure it could be a lot better/shorter, but eh oh well lol.

Code: [Select]
;#######################################
;#######################################
; CRAFT
;#######################################
;#######################################
sub craft
   set %craft_1 %1
   set %craft_2 %2
   set %craft_3 %3
   set %craft_4 %4
   
   if %craft_1 = tinker
      set %craft_tool GTL_JTL
   if %craft_1 = tailor
      set %craft_tool HAG
   if %craft_1 = fletching
      set %craft_tool UFG
   if %craft_1 = blacksmith
      set %craft_tool OBG

   set %timeout #SCNT2 + 30
   while #contname <> generic_gump && #contsize <> 530_507
      {
      if #SCNT2 > %timeout
         return ERROR
      set %timeout #SCNT2 + 30
      finditem %craft_tool C_ , #backpackid
      set #lobjectid #findid
      event macro 17
      wait 25
      }

   if %craft_2 = ML
      {
      gosub clickmod 285 450
      wait 5
      return
      }
   else
      {
      set %temp ( %craft_2 * 20 ) + 70
      gosub clickmod 30 %temp
      wait %craftmenuclick
      }

   set %temp %craft_3 - 1
   if %craft_3 > 1
      {
      for %craft_a 1 %temp
         {
         gosub clickmod 380 270
         wait %craftmenuclick
         }
      }

   set %temp ( %craft_4 * 20 ) + 50
   gosub clickmod 235 %temp
   wait %craftmenuclick
return
Title: Re: Someone please explain this in childs terms.
Post by: TrailMyx on December 27, 2009, 10:43:50 AM
OMG:  You forgot the most inportant thing for Cor; the gosub clickmod 285 450 sub.
Title: Re: Someone please explain this in childs terms.
Post by: OMGBurgers on December 27, 2009, 11:02:45 AM
for gump clicks you're going to want a sub that handles clicks, I have one called clickmod I made...  it's pretty simple.

lets say you wana click x50 y120 on a gump, you would call clickmod 50 120 f.
clickmod would do:

Code: [Select]
sub clickmod
   set %x #contposx + %1
   set %y #contposy + %2
   click %x %y %3
return

I think I may have a bit more to mine, but not sure.

Saves writing those lines over and over and makes it real easy.

From there you want a good container/gump handling sub.  I would write it around using #contname, #contsize at the most.  #contkind I would only use if NEEDED because they change #contkinds of most gumps at every patch.
Title: Re: Someone please explain this in childs terms.
Post by: OMGBurgers on December 27, 2009, 11:03:30 AM
OMG:  You forgot the most inportant thing for Cor; the gosub clickmod 285 450 sub.

yeah I forgot it then had this post ready but did a rat spawn instead of pressing submit lol

:P
Title: Re: Someone please explain this in childs terms.
Post by: Coragin on December 27, 2009, 05:35:19 PM
So like this...

Code: [Select]
set %cwin 530_507
set %makelastx 285
set %makelasty 450
gosub waitforgump %cwin
gosub clickmod %makelastx %makelasty


sub waitforgump
set %timeout #scnt + 30
while #contsize <> %1
      {
      wait 1
      if #scnt > %timeout
         {
          return #false
         }
      }
wait %gumpwait
return #true

sub clickmod
   set %x #contposx + %1
   set %y #contposy + %2
   click %x %y %3
return

That would work?
Title: Re: Someone please explain this in childs terms.
Post by: 12TimesOver on December 27, 2009, 05:50:39 PM
So like this...

Code: [Select]
set %cwin 530_507
set %makelastx 285
set %makelasty 450
gosub waitforgump %cwin
gosub clickmod %makelastx %makelasty


sub waitforgump
set %timeout #scnt + 30
while #contsize <> %1
      {
      wait 1
      if #scnt > %timeout
         {
          return #false
         }
      }
wait %gumpwait
return #true

sub clickmod
   set %x #contposx + %1
   set %y #contposy + %2
   click %x %y %3
return

That would work?

Sure.

I would suggest a lower number to wait for the gump before returning #FALSE but maybe that's just me.

Also, you don't need open and close brackets "{" and "}" on "If" arguments that are only one line long, should still work fine just not required.


X
Title: Re: Someone please explain this in childs terms.
Post by: Coragin on December 27, 2009, 05:57:45 PM
dont need them i know, but if it intend to add mroe to that part later or something it dont hurt anything to have it there right?  In some cases and if command can be one line right?

if #mana >= 11 event macro (recall)

heh dont know the number off the top of my head but you get the idea.
Title: Re: Someone please explain this in childs terms.
Post by: OMGBurgers on December 28, 2009, 01:30:53 PM
dont need them i know, but if it intend to add mroe to that part later or something it dont hurt anything to have it there right?  In some cases and if command can be one line right?

if #mana >= 11 event macro (recall)

heh dont know the number off the top of my head but you get the idea.

never tried that.  I think they mean:

Code: [Select]
      if #scnt > %timeout
         {
          return #false
         }

can be:

Code: [Select]
      if #scnt > %timeout
          return #false

a lot of time I put the extra brackets on because I usually add in more things for it to do after the if statements.  Usually when I finish up my script I take out em where they're not needed.
Title: Re: Someone please explain this in childs terms.
Post by: TrailMyx on December 28, 2009, 02:31:01 PM

if #mana >= 11 event macro (recall)

Nope, can't do that.
Title: Re: Someone please explain this in childs terms.
Post by: 12TimesOver on December 28, 2009, 03:24:54 PM
never tried that.  I think they mean:

Code: [Select]
      if #scnt > %timeout
         {
          return #false
         }

can be:

Code: [Select]
      if #scnt > %timeout
          return #false

Yep, that's what I was talking about.

Also, as TM said, you can't have your "IF" condition and action on the same line but you can have multiple conditions on the same line:

Code: [Select]
If #MANA >= 11 || #HITS <= 30   ;<----multiple "IF" conditions
   Event Macro 15 31 ;<----action, Recall the hell outta there!

SeewhadImean Vern?

X
Title: Re: Someone please explain this in childs terms.
Post by: Coragin on December 29, 2009, 12:46:15 AM
gotcha
Title: Re: Someone please explain this in childs terms.
Post by: Scrripty on December 29, 2009, 04:49:37 PM
gotcha

I haven't tried this yet tho I'm sure it will work also:

Code: [Select]
IF %coragin = newb || %coragin = trammy
  IF %coragin NOTIN #property
    IF #coragin = 50
      IF #coragin = uglymanboy
      {
        DO YOUR STUFF HERE
      }
Or you could show that like this also:
Code: [Select]
IF %coragin = newb || %coragin = trammy || %coragin NOTIN #property || #coragin = 50 || #coragin = uglymanboy
  {
    DO YOUR STUFF HERE
  }

I'm sure that would work, but not sure it's a very efficient way of doing it. :)