ScriptUO

General => New member introductions => Topic started by: xapcx on September 01, 2009, 08:34:27 PM

Title: a long time silent scripter, new to SUO
Post by: xapcx on September 01, 2009, 08:34:27 PM
Hello all,

I am a UO adict with 3 128 month old accounts.  I took a two year break from UO and was lucky enough to find my accounts still alive.  Since my return, I have spent the past three years hard at work creating EASYUO scripts to make my video life much more enjoyable.  I have found that I actually spend more time and have more fun writing scripts than I spend "playing" the game.  I have become a scripting adict.  I go to bed dreaming of what I can make my characters do next.  I just stumbled on to this site and recognized a few names from years ago on the EasyUO boards.  I am looking forward to tinkering with your interface!

xApCx

Post Merge: September 02, 2009, 12:42:30 AM
Here is an tidbit of one of my favorite scripts.  Its very generic, but came in real handy durring the TOT drop period.  

Code: [Select]
set %timeWait ( #SCNT - 16 )
set %findtype UE_TC_TH_PI_DH_FD_ME_HI ;FanDancer
;set %findtype WD_R_EB ; lich lichlord
set %lastMon 00000
set %disMon 00000
set %corpse YFM
set %Gold POF
set %keys LZF
set %loot POF_LZF_ZFM_MIG_QIP
set %prize SWO
set %BOS 00000000
set %findPet 00000000
set %instmnt RGP_LQF ;PGP

gosub setPet

gosub setBOS
gosub setLLLt
gosub setURLt



top:
gosub playMusic
wait 1
gosub findMonster
wait 1
gosub allAttack
wait 1
gosub healthcheck
wait 1
gosub findCorpse
wait 1
gosub useBag
wait 1
gosub findPet
wait 1
gosub deathcheck
;gosub mempoCheck
goto top

sub deathcheck
if #charGhost = YES
{
wait 2s
click 845 66
wait 2s
click 542 393
wait 5s
stop
}
return

sub allAttack
finditem %findtype G_6
;if %timeWait < ( #SCNT - 10 )
   ;{
   ;set %lastMon 000000
   ;}
     if #findkind <> -1 && #findid <> %lastMon
     {
      wait 5
      set #ltargetid #findid
      set #ltargetkind 1
      msg all kill$
      target 2s
      event macro 22 0
      wait 2
      set %lastMon #ltargetid
      wait 10
     }
return

sub playMusic
    finditem %instmnt C_ , #BACKPACKID
     set #LOBJECTID #FINDID
     wait 5
     event macro 17 0
     wait 5
return


sub findMonster
   if %timeWait < ( #SCNT - 10 )
   {
    if #targcurs = 0
    {
     set #findkind 0
     set #findid 0
     set #ltargetid X
     finditem %findtype G_10
     if #findkind <> -1 && #findid <> %disMon
     {
      set #ltargetid #findid
      set #ltargetkind 1
      event macro 13 15 ;this part uses skill discord
      target 2s
      event macro 22 0
      wait 5
      if %message2 in #sysmsg || %message3 in #sysmsg
      {
       set %disMon #ltargetid
      }
      if %message5 in #sysmsg
      {
         ignoreitem #ltargetid
         return
      }
      set %timeWait #SCNT
      set %waitCount 0
     }
    }
   }
return

sub findPet
    finditem %findPet G_25
    if #FINDDIST > 4 && #FINDX < %LLLX || #FINDX > %URLX || #FINDY < %URLY || #FINDY > %LLLY )
    {
     msg all follow me$
     wait 60
     finditem %lastMon G_6
     if #findkind <> -1
{
     set #ltargetid %lastMon
     set #ltargetkind 1
     msg all kill$ ;this part tells your animal to kill
     target 2s
     event macro 22 0
     wait 5
}
    }
return

sub healthcheck
    if #CHARSTATUS = C
    {
     gosub cureMe
    }
    if #CHARSTATUS = CA
    {
     gosub cureMe
    }
    if #CHARSTATUS = CB
    {
     gosub cureMe
    }
    if #CHARSTATUS = GC
    {
     gosub cureMe
    }
    if #HITS < 85
    {
     gosub invisMe
     wait 5
     gosub healMe
    }
return

sub cureMe
    if #MANA > 15
    {
     event sysmessage curing
     event macro 15 24 ; cast arch cure
     target 100
     event macro 23 ; target me
     wait 20
    }
return

sub healMe
    if #MANA > 15
    {
     set #ltargetid #ENEMYID
   set #ltargetkind 1
   msg all kill$ ;this part tells your animal to kill
   target 2s
   event macro 22 0
   wait 5
     event macro 15 28 ; cast greater heal
     target 100
     event macro 23 ; target me
     wait 20
    }
return

sub invisMe
if #CHARSTATUS <> HB
       {
       set #ltargetid #ENEMYID
     set #ltargetkind 1
     msg all kill$ ;this part tells your animal to kill
     target 2s
     event macro 22 0
     wait 5
       event macro 15 43
       target 10s
       event macro 23 0
       wait 2s
       }
return

sub findCorpse
fc:
if #WEIGHT <= 440
{
    finditem %corpse G_10
    if #findkind <> -1
    {
    event sysmessage #findx #findy
    event sysmessage %LLLX %URLX %LLLY %URLY
    ;wait 2s
    if #FINDX < %LLLX || #FINDX > %URLX || #FINDY < %URLY || #FINDY > %LLLY )
    {
    ignoreitem #findid 1
    goto fc
    }
     set %corpseID #FINDID
     set #lobjectid %corpseID
     set %movex #findx
     set %movey #findy
     gosub moveNow
     wait 5
     gosub openIT
     wait 5
     ignoreitem #lobjectid 1
    }
}
return

sub openIt
    wait 10
    event macro 17
    OI:
    wait 1s
    finditem %loot C_ , #CONTID ;gold
    if #findkind <> -1
    {
     wait 5
     GOSUB moveItem #FINDID #FINDBAGID #BACKPACKID
     wait 5
     ignoreitem #findid 2
     goto OI
    }
return

Sub moveNow
  set %x %movex
  set %y %movey
  set %z %movez
  movingB:
  event pathfind %x %y
  if #finddist > 1
  {
   wait 10
   goto movingB
  }
Return

Sub useBag
    if #WEIGHT >= 440
    {
    ignoreitem reset
    ignoreitem reset 1
    ignoreitem reset 2
     finditem %BOS C_ , #BACKPACKID
     set #LOBJECTID #FINDID
     wait 5
     event macro 17 0
     target 1s
     finditem %Gold C_ , #BACKPACKID ;gold
     finditem #findid
     set #LTARGETID #FINDID
     event macro 22 0
     wait 10
    }
return

Sub mempoCheck
     finditem %prize C_ , #BACKPACKID
     if #findkind <> -1
     {
     finditem %BOS C_ , #BACKPACKID
     set #LOBJECTID #FINDID
     wait 5
     event macro 17 0
     target 1s
     finditem %prize C_ , #BACKPACKID
     set #LTARGETID #FINDID
     event macro 22 0
     wait 10
    }
return

sub setPet
    display ok please target your pet.
    set #targcurs 1
    target 5s
    watPetLup:
    if #targcurs = 1
    {
    goto watPetLup
    wait 5
    }
    finditem #ltargetid
    set %findPet #ltargetid
return

sub setBOS
    display ok please target your BOS.
    set #targcurs 1
    target 5s
    watBOSLup:
    if #targcurs = 1
    {
    goto watBOSLup
    wait 5
    }
    finditem #ltargetid
    set %BOS #ltargetid
return

sub setLLLt
    display ok please target your Lower Left Loot.
    set #targcurs 1
    target 5s
    watLLLtLup:
    if #targcurs = 1
    {
    goto watLLLtLup
    wait 5
    }

    set %LLLX #charposx
    set %LLLY #charposy
    event sysmessage %LLLX
    event sysmessage %LLLY
return


sub setURLt
    display ok please target your Upper Right Loot.
    set #targcurs 1
    target 5s
    watURLtLup:
    if #targcurs = 1
    {
    goto watURLtLup
    wait 5
    }

    set %URLX #charposx
    set %URLY #charposy
    event sysmessage %URLX
    event sysmessage %URLY
return
Title: Re: a long time silent scripter, new to SUO
Post by: TrailMyx on September 01, 2009, 10:22:19 PM
Welcome to the site!
Title: Re: a long time silent scripter, new to SUO
Post by: Noobie on September 01, 2009, 10:39:03 PM
Welcome to the site. It looks as you will be able to join in on the development of some good stuff. I think that there are like 5 projects going on now!!
Title: Re: a long time silent scripter, new to SUO
Post by: Cerveza on September 02, 2009, 04:07:43 AM
Welcome aboard... you've got a good start in scripting. There is a huge wealth of information here that will help you along.

Code: [Select]
sub setPet
    display ok please target your pet.
    set #targcurs 1
    target 5s
    watPetLup:
    if #targcurs = 1
    {
    goto watPetLup
    wait 5
    }
    finditem #ltargetid
    set %findPet #ltargetid
return
*could* be done more simply with
Code: [Select]
sub setPet
    display ok please target your pet.
    set #targcurs 1
    while #targcurs = 1
      wait 0
    set %findPet #ltargetid
    return

Condensed code and removes one of the evil goto's.
Title: Re: a long time silent scripter, new to SUO
Post by: Endless Night on September 02, 2009, 04:27:03 AM
Welcome and let me chuck in my 2 cents on something that jumped out at me on your code.  Look up the Logical Operator 'IN' and 'NOTIN' quiet helpful

Code: [Select]
sub healthcheck
    if #CHARSTATUS = C
    {
     gosub cureMe
    }
    if #CHARSTATUS = CA
    {
     gosub cureMe
    }
    if #CHARSTATUS = CB
    {
     gosub cureMe
    }
    if #CHARSTATUS = GC
    {
     gosub cureMe
    }
    if #HITS < 85
    {
     gosub invisMe
     wait 5
     gosub healMe
    }
return

Can be Reduced to

Code: [Select]
sub healthcheck
    if C IN #CHARSTATUS
       gosub cureMe
    if #HITS < 85
      {
      gosub invisMe
      wait 5
      gosub healMe
      }
return
Title: Re: a long time silent scripter, new to SUO
Post by: Toptwo on September 02, 2009, 04:33:27 AM
Hi! Welcome to SUO! I WONT be one of the ppl looking and streamlining your code as I dont have a clue what I am looking at! I have a hard enough time just making some of the scripts work for myself LOL.

But as you can see we have some top-notch coders here, so welcome to the site and the and the huge amount of info and help that there is here!
Title: Re: a long time silent scripter, new to SUO
Post by: Xclio on September 02, 2009, 12:35:22 PM
Welcome to the site!  You won't ever want to write code again without SUO!
Title: Re: a long time silent scripter, new to SUO
Post by: SunTigress on September 02, 2009, 01:32:04 PM
Welcome to SUO!
Title: Re: a long time silent scripter, new to SUO
Post by: xapcx on September 02, 2009, 04:31:15 PM
wow guys, thanks for the help.  Honestly i have been scripting on my own for a few years.  this was the first time i have posted one of mine and you guys jumped right in with some awsome suggestions...  THANKS!!!!  i like it here already
Title: Re: a long time silent scripter, new to SUO
Post by: TrailMyx on September 02, 2009, 05:23:06 PM
Really, it's communities like this one that have helped me become a better scripter.  There's lots of brilliant scripters out there, and many of them program for a living in real life.  I even learn new things from time to time by watching the community interaction.  So you're never too good or advanced to learn a new thing or two.

But glad to hear that you are enjoying yourself so far.
Title: Re: a long time silent scripter, new to SUO
Post by: _C2_ on September 02, 2009, 07:36:28 PM
Welcome to the site...  there are so many helpful eyes here at the site you end up with a bunch of point of views helping you round out your flow/ thought process.  Enjoy your time here!
Title: Re: a long time silent scripter, new to SUO
Post by: welgill on September 02, 2009, 09:36:57 PM
Damn good communiy here no bull 8)