Help on this PvM automation

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Help on this PvM automation

Post by Xpree »

Well
I´ve tryed to use this script on UO, and this wheres i need help considerations:
1°- checklag goes on a eternal loop because on my sever the backpack shows this: [newbie] backpack (%weight% Kg[THIS IS THE W8 ON KILOS])
2°- my check mana for some reason dont work propely
3°- for some reason the first run execute the delay sub right the other times it only ignored it

well this is my first script, and as a brasilian using tradutors and translates softwares its hard to find materials on this site, since i have to translate to english then to portuguese, plz help me out.

Code: Select all

Sub Delay()
   var mana = uo.mana
   while true
      if uo.injournal("visao|frizzle") then ; out of sight
         return false
      else
         while true
            if uo.mana == mana then ;if the spell didnt land
               wait(100)
            else
               if uo.mana < mana then ;if the spell land
                  return false
               endif
            endif
         wend
      endif
      return false ;brake loop
   wend
endsub
; not my pasted from the Nmys Code
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
; not my pasted from the Nmys Code
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('backpack') then
         return 1
      endif
      wait(200)
   next
endsub
sub Poisoned()
   wait(500)
   repeat ; cure till poison efect is off
      checklife()
      uo.warmode(0)
      uo.waittargetself()
      uo.cast('Cure')
      wait(3000)
   until not uo.poisoned('self')
endsub
Sub checklife()
   repeat
      if uo.life <= 50 then ; check  the life is to low, then use total mana pots
         uo.usetype(0x0F0E,0x00FF) ; <- life pots
         wait(500)
      else
         uo.waittargetself()
         uo.usetype(0x0E21) ; <- the type of the bandages is wrong
         wait(2000)
      endif
   until uo.life >= 80
endsub
Sub checkmana()
   repeat
      var mana2 = uo.int-40
      if uo.mana < 20 then
         uo.usetype(0x0F0E,0x0480) ; mana pots
      endif
   until uo.mana >= mana2
   
   sub pvm()
      While not uo.dead() ; litte automation
         checklag()
         checkmana()
         if uo.poisoned('self') then ; if im poisoned
            poisoned()
         endif
         if uo.life < 60 then ; if life is low
            checklife()
         endif
         if uo.life >= 60 then ; main if for the magics
            if Uo.InJournal('envenena') && UO.count(0x1F5F)>=2 then ;fs scroll
               uo.useobject(0x1F5F,'laststatus')
               delay()
            endif
            if Uo.InJournal('envenena') && UO.count(0x1F5F)<2 then    ;fs book
               UO.Cast('Flame Strike','laststatus')
               delay()
            else
               UO.Cast('Poison','laststatus') ;if others is false poison
               delay()
            endif
         endif
      wend
   endsub
[/b]
CuHTpoH
Posts: 287
Joined: 2007-11-01 19:09:30
Location: Moscow
Contact:

Re: Help on this PvM automation

Post by CuHTpoH »

Xpree wrote:

Code: Select all

   while true
      if uo.injournal("visao|frizzle") then ; out of sight
         return false
      else
         while true
            if uo.mana == mana then ;if the spell didnt land # IMAGINE YOU REGENED SOME MANA, SO HERE NEED TO BE >=
               wait(100)
            else
               if uo.mana < mana then ;if the spell land
                  return false
               endif
            endif
            # OR! YOU CAN PUT DELAY HERE (100) MINIMUM OR IT LAGS CLIENT
         wend # IF YOU LACK REAGENTS YOU'll STUCK HERE FOREVER AND SO ON
      endif
      return false ;brake loop  # HERE YOU INTERRUPT YOUR LOOP, SO IT DOESN'T WORK
   wend
endsub
# ALSO THERE IS WAY TO CHECK SPELL PASSED WITH UO.SET('ANIMECHO','1') AND FIND SOMETHING LIKE anim [0xYYYY] in journal

; not my pasted from the Nmys Code
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
; not my pasted from the Nmys Code
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('backpack') then
         return 1
      endif
      wait(200)
   next
endsub
# THIS IS NOT A CHECKLAG, THIS IS A PIECE OF SHIT, AND THAT IS CHECKLAG:

sub checklag()
   deljournal('backpack')
   uo.click('backpack')
   repeat
      wait(100)
   until uo.injournal('backpack')
endsub

sub deljournal(msg)
   while uo.injournal(msg)
      uo.setjournalline(uo.injournal(msg)-1,'')
   wend
endsub

##############################################


sub Poisoned()
   wait(500)
   repeat ; cure till poison efect is off
      checklife()
      uo.warmode(0)
     # AFTER YOU SET WARMODE YOU NEED TO WAIT A BIT, SAME AS BETWEEN EVERY 2 ACTIONS THAT SEND SOME PACKET TO SERVER
      uo.waittargetself()
      uo.cast('Cure')
      wait(3000)
   until not uo.poisoned('self')
endsub
Sub checklife()
   repeat
      if uo.life <= 50 then ; check  the life is to low, then use total mana pots
         uo.usetype(0x0F0E,0x00FF) ; <- life pots
         wait(500)
      else
         uo.waittargetself()
         uo.usetype(0x0E21) ; <- the type of the bandages is wrong # BETTER TO USE BRACKETS - '0x0E21' - LIKE THAT, AND THE TYPE OF BANDAGES IS RIGHT
         wait(2000)
      endif
   until uo.life >= 80
endsub

Sub checkmana()
   repeat
      var mana2 = uo.int-40
      if uo.mana < 20 then
         uo.usetype(0x0F0E,0x0480) ; mana pots
      endif
   until uo.mana >= mana2 # DIDN'T YOU THINK ABOUT MEDITATION HERE?
   
   sub pvm()
      While not uo.dead() ; litte automation
         checklag()
         checkmana()
       
         if uo.poisoned('self') then ; if im poisoned
            poisoned()
         endif
         if uo.life < 60 then ; if life is low
            checklife()
         endif
         if uo.life >= 60 then ; main if for the magics
            if Uo.InJournal('envenena') && UO.count(0x1F5F)>=2 then ;fs scroll # BRACKETS
               uo.useobject(0x1F5F,'laststatus') # BRACKETS
               delay()
            endif
            if Uo.InJournal('envenena') && UO.count(0x1F5F)<2 then    ;fs book # BRACKETS
               UO.Cast('Flame Strike','laststatus')
               delay()
            else
               UO.Cast('Poison','laststatus') ;if others is false poison
               delay()
            endif
         endif
         # DELAY (100)
      wend
   endsub
[/b]


THAT IS NOT FULL LIST OF CORRECTIONS, JUST WHAT I SEE WITHOUT DEEP LOOKING
**Выставляем отступы в скриптах*** ©Destruction
Feel the Power of Dark Side
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

well im such a sameless newbie yet, ty for this helps, i will make this changes and report here after that, but only like 6 pm here, cuz im at work.


ah about reagentes, my server don´t use reagentes
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

insted of this mad scripting you only need like 3 hotkeys -
usetype mana
usetype great heal
exec fs

Code: Select all

sub fs()
   if uo.count('0x1F5F') then
      uo.waittargetobject('lastattack')
      uo.usetype('0x1F5F')
   else
      uo.cast('Flame Strike','lastattack')
   endif
endsub
Mirage
Posts: 2802
Joined: 2009-05-28 09:58:28
Location: Иваново
Contact:

Post by Mirage »

autoscript is sucks :lol:
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

but i want to create a futher script to afk pvm macro with auto loot and recalling, ressuretion and others, but i have to start with something more easy.
Post Reply