ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: razeial on July 18, 2012, 04:31:36 PM

Title: Need some advice w/ this script!
Post by: razeial on July 18, 2012, 04:31:36 PM
Ok guys, I'm using Guadah's Multiskill trainer to train up Bushido. What I also want is a script to scan my journal for a weapon break, and then rearm the last type of weapon so will this script do that while guadah's script runs?

Code: [Select]
set %weapontype YSF

scanjournal 1
if weapon_has_been_destroyed in #journal
{
gosub RearmWep
}
goto Mainloop


Sub RearmWep
SET  #lobjecttype %weapontype
FINDITEM %weapontype C_ , %backpackid
      IF #FINDKIND = -1
      {
      HALT
      }
   SET #RHANDID #findid
   WAIT %ShortDelay
   event macro 24 2
   WAIT 1s
return
Title: Re: Need some advice w/ this script!
Post by: Cerveza on July 18, 2012, 05:07:20 PM
Oh my.... perhaps this could help you out. Of course you'll have to make a couple changes for ID's and which hand the item is in....

Code: [Select]
set %throwing FID_THY_YND_NND_ ; id types of the weapon

repeat
finditem %throwing C_ , #charID
if #findCnt < 1
  gosub equip
wait 1
until #false

sub equip
finditem %throwing C_ , #backpackID
  {
  if #findCnt < 1 ; oops, none in the backpack
  halt
  }
set #rhandid #findid
event macro 24 2
wait 10
return

You could use a finditem and a specific ID then have hotkeys to set the specific weapon/spellbook you want armed. Easy to fast switch it this way.

To make it a sub routine just change this part:

sub CervsWeaponSwapORama
finditem %throwing C_ , #charID
if #findCnt < 1
  gosub equip
wait 1
return

And of course put this somewhere in your mainloop:

gosub CervsWeaponSwapORama
Title: Re: Need some advice w/ this script!
Post by: razeial on July 18, 2012, 06:18:38 PM
So........something like this??!?!?


Code: [Select]
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
; MAIN LOOP
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

set %weapon YSF_ ; id types of the weapon


Gosub CervsWeaponSwapORama
scanjournal 1
if is_destroyed_by_the_attack in #journal
{
gosub equip
}
repeat
;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
; SUBS
;xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
sub CervsWeaponSwapORama
finditem %weapon C_ , #charID
if #findCnt < 1
  gosub cervequip
wait 1
until #false
if #false
   {
    display You are out of Weapons!
    halt
   }

sub equip
finditem %throwing C_ , #backpackID
  {
  if #findCnt < 1 ; oops, none in the backpack
  halt
  }
set #rhandid #findid
event macro 24 2
wait 10
return
Title: Re: Need some advice w/ this script!
Post by: UOMaddog on July 18, 2012, 07:18:16 PM
I think you misunderstood Cerv...

In his method, you're scanning your paperdoll to look for whatever weapon type. If it doesn't find it on the paperdoll (meaning it broke) it goes into the subroutine to equip a new one. No need to scan the journal at all (which is good, because journal scanning can be QUITE messy and not reliable)

The only edit you'll need to make to Cerv's script is to change the first line to whatever weapon types you need:
Code: [Select]
set %throwing FID_THY_YND_NND_ ; id types of the weaponChange to:
Code: [Select]
set %throwing YSF_ ; id types of the weapon
(Disregard the fact that his variable is called "%throwing", you could simply change all occurrences of that variable in the script to "%weapontypes")

As he said, you may also need to change which hand is being equipped ("event macro 24 2" versus "event macro 24 1") and use #lhandid instead of #rhandid, but that's dependent on which hand the weapon is getting equipped into.

So your final script might look like:

Code: [Select]
set %weapontypes YSF_ ; id types of the weapon

repeat
finditem %weapontypes C_ , #charID
if #findCnt < 1
  gosub equip
wait 1
until #false

sub equip
finditem %weapontypes C_ , #backpackID
  {
  if #findCnt < 1 ; oops, none in the backpack
  halt
  }
set #rhandid #findid
event macro 24 2
wait 10
return