Delay time

Anything and all.

Moderators: Murderator+, Murderator

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

Delay time

Post by Xpree »

Hi russian ppl, im a brasilian and i´m desenvolving a script to automatic cast spells with a dinamic wait(), its more or less like this

Code: Select all

inicio:
UO.Cast('Flame Strike','laststatus') ;cast poison
         while true
            if uo.injournal("visao|frizzle") then ; if is out of sight
               goto inicio
            else
               while true
                  [b]if not uo.injournal("HERE IS MY PROBLEM") then ; i dont know what to put to verify if the FS actualy not was sucessfull, so if not it will do the while again till it damages the oponent
                     wait(100)
                  else
                     if uo.injournal("HERE IS MY PROBLEM") then ;if the damage was sucessfull breaks the loop[/b]
                     return false
                     endif
                  endif
               wend
            endif
            return false ;break the loop
         wend



help me plz
Mirage
Posts: 2802
Joined: 2009-05-28 09:58:28
Location: Иваново
Contact:

Post by Mirage »

Why use a goto?
You can use the gethp('ID') like this.

Code: Select all

if uo.GetHP(OBJ)<>uo.GetMAXHP(OBJ) then

If I understood correctly. :roll:
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

OBJ would be my target?

Code: Select all

inicio:
UO.Cast('Flame Strike','laststatus') ;cast poison
         var targetlife = uo.gethp('lasttarget')
         while true
            if uo.injournal("visao|frizzle") then ; if is out of sight
               goto inicio
            else
               while true
                  [b]if not uo.gethp('laststatus') <> targetlife then
                     wait(100)
                  else
                     if uo.gethp('laststatus') <> targetlife then
                     return false
                     endif
                  endif
               wend
            endif
            return false ;break the loop
         wend


like this?

but that dont work with magic that dont land damage like paralize i would like something more general to work with all magics if possible. ty
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

Code: Select all

sub fstarget()
   var m
   repeat
      repeat
         checklag()
         m=uo.mana
         if uo.mana < 22 then
            uo.print('no mana')
            return
         endif
         uo.cast('Flame Strike','laststatus')
         wait(600)
      until not uo.injournal('Target is not in line of sight')
      repeat
         wait(100)
      until uo.mana<m
   until not uo.injournal('The spell fizzles')
endsub
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a backpack') then
         return 1
      endif
      wait(200)
   next
endsub
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

you got it Nmy, MANA CHECK, PERFECT!!!!

TY.
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

this is my medium to finish script well the quotes is still needing debug, javascript:emoticon(':?')

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('a 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(0x0E21) ; <- the type of the mana pots is wrong
            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()
   var mana = uo.maxmana-40
   repeat
      if uo.mana < 20 then
         uo.usetype(0x0E21) ; <- total mana pots is wrong
      endif
   until uo.mana >= mana
         


sub pvp()
   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
:? :?
Scripts Writer
Posts: 2259
Joined: 2005-04-19 18:00:29
Location: Московская область
Contact:

Post by Scripts Writer »

I check it so:

Code: Select all

  var mana = uo.mana
  var BM = uo.BM
  var SA = uo.SA
  var GS = uo.GS
  var SS = uo.SS
  var MR = uo.MR
  var BP = uo.BP
  var NS = uo.NS
  var GA = uo.GA
 
  uo.DeleteJournal()
  repeat
    wait(10)
  until uo.mana < mana || uo.InJournal('fizzles') || uo.InJournal('lack') || uo.InJournal('in line') || uo.BM < BM || uo.MR < MR || uo.SA < SA || uo.BP < BP || uo.NS < NS || uo.SS < uo.SS || uo.GA < GA || uo.GS < GS


Don't u think what'll happen if u drink total mana until the cast finish?

Mana: 30
*Casting*
*Drink total mana*
Mana: 100
*Cast finished*
Mana: 70

Script still waiting until mana will be less 30.
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

the script won't use mana and he won't do in either, and the shard doesn't have reagents

Code: Select all

uo.usetype('type')

or

Code: Select all

uo.usetype("type")

all functions use quotation marks except if it's an object variable

Code: Select all

var chest="0x12345678"
uo.useobject(chest)

or

Code: Select all

uo.addobject('chest')
uo.useobject('chest')
this is the object, not variable
the same applies to 'backpack', 'lastcontainer', etc
Scripts Writer
Posts: 2259
Joined: 2005-04-19 18:00:29
Location: Московская область
Contact:

Post by Scripts Writer »

Nmy wrote:the script won't use mana

Телепат?

Nmy wrote:the script won't use mana

Кто сказал что мана будет питься в рамках этого скрипта? Отдельный хоткей для восполнения маны во время каста никто не отменял, или первое что в голову пришло написал даже не вдумываясь в то что я отписал выше?

Nmy wrote:and the shard doesn't have reagents

Он ещё и шард указал? Может я что-то пропустил, как название?

То что у него есть наработка на восполнение маны, не знаю каким уже там у них в бразилии образом, тотал маной или бубном, ты конечно тоже пропустил?

П.С. На досуге проверь что быстрее работает- проверка на изменение маны, или реагентов, если конечно гордыня не затуманит глаза.

П.С.С. Не надо меня передёргивать когда я к тебе не обращаюсь, не дорос ещё.
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

Он ещё и шард указал? Может я что-то пропустил, как название?

viewtopic.php?p=84467#84467

Кто сказал что мана будет питься в рамках этого скрипта?

viewtopic.php?p=84478#84478

Еще вопросы есть?

П.С.Быдло: Читай молча форум и не указывай мне что я могу или не могу делать.
Last edited by Nmy on 2010-01-09 11:26:07, edited 2 times in total.
Nmy
Expert!
Posts: 2152
Joined: 2005-09-14 15:31:58
Location: Latvia

Post by Nmy »

if it helps i fixed your code a bit

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
sub checklag()
   repeat
      UO.DeleteJournal()
      UO.Click('backpack')
   until backpack()==1
endsub
sub backpack()
   var n
   for n=0 to 200
      if uo.injournal('a 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("0x0E21")
         wait(500)
      else
         uo.waittargetself()
         uo.usetype("0x0E21")
         wait(2000)
      endif
   until uo.life >= 80
endsub
Sub checkmana()
   var mana = uo.int-40
   repeat
      if uo.mana < 20 then
         uo.usetype("0x0E21")
      endif
   until uo.mana >= mana
endsub     
sub pvp()
   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.waittargetobject('laststatus')
            uo.usetype("0x1F5F")
            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

this one is dynamic mana check - it ends loop in 20 seconds if nothing happens or quits immediately if mana drops

Code: Select all

sub WaitForMana()
   VAR w,m=uo.mana
   for w=0 to 100
      if uo.mana<m then
         return
      endif
      wait(200)
   next
endsub
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

i will try it

sry for the late reponse, cuz im working like hell, but i will try it.

this its what i need:

1- a dinamic delay checker for any magic

2- well in my shard(that dont use reags), i found a full insntance that the npc, well they dont walk or walk like a tile off 3 secs, so when i am working i want to stay killing them, and they are very very strong, kill vortexes 1 hit, but they are fully vunerable to fire and poison, so i poison them and then fs their ass of, but sometimes they poison me, that why the cure there, and also they teleport close, thats why i need the dinamic delay, if i get poisoned or my magic failure before it complete the delay they have, i have to move fast so they dont kill me on a 1 hit basis, and the check life if some one trys to kill me i will heal and go invis(with a item that i won on a champ that cant be revealed)

i think its about it.
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

well, my shard removed the Spell Fizzles message, how i would get the error by sound or by the animation smoke?

ty
Noite
Posts: 7
Joined: 2010-01-14 14:50:13

Post by Noite »

When you cast and flizzes you lost mana in your shard ? May be a solution.
However, you could try:

Code: Select all

 ,set animecho 1
 ,set soundecho 1
 ,showjournal
Xpree
Posts: 19
Joined: 2010-01-06 17:18:40

Post by Xpree »

gadly they returned the error message, so i will do it with it =)
Noite
Posts: 7
Joined: 2010-01-14 14:50:13

Post by Noite »

Very nice script!
I try change this and made my own script, but the problem is try use this sub in pvp.
With me ever crashs in unspected sometime.
Post Reply