ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Scotch_Tape on November 17, 2008, 06:54:50 AM

Title: Casting wait timer
Post by: Scotch_Tape on November 17, 2008, 06:54:50 AM
I have an EV script I have written that I am constantly trying to make better.  I replaced all the target [seconds] with this while/scan journal stuff...


 
Code: [Select]
ReCastInvis:
   set %jindex #Jindex + 2    ;sets spot to start the Jornal Scanning
   event macro 15 43          ;cast Invis
    while #targcurs = 0        ;While (Until) the spell is being cast does the brackets
    {
     scanjournal              ;Reads the jornal
     if thy_spell in #journal ;If "Thy Spell" is in jornal recast spell and start over
     goto ReCastInvis         ;Goes back up to cast the spell again
     if Spell_Fizzles in #journal ;checks if you fizzle spell
     goto ReCastInvis         ;Goes back up to cast the spell again
     wait 5
    }[/b]
  event macro 23              ;target self
  wait 1s                     ;waits 2 second
  }
 Return

It's getting the job done, but I wanted to see if anyone had any suggestions.  The timers worked good, but I noticed if I was trying to cast a spell and got fizzled it had to wait for the target timer to time out until it tried again. 

This is my first time using scan journal.  It seems a bit unstable and not very efficient in the way I'm using it.

Thanks for any help. 





 
Title: Re: Casting wait timer
Post by: OMGBurgers on November 17, 2008, 12:02:33 PM
Hmm.  Well for starters I can see that you set %jindex as the #jindex, but I don't see you actually using that variable or the #jindex anywhere.

I'd try something like this:

Code: [Select]
ReCastInvis:
   set %LASTSCAN #JINDEX    ;sets spot to start the Jornal Scanning
   event macro 15 43          ;cast Invis
   while #targcurs = 0        ;While (Until) the spell is being cast does the brackets
      {
      wait 5
      if #JINDEX > %LASTSCAN
         {
         set %temp #JINDEX
         for %a %LASTSCAN #JINDEX
            {
            scanjournal %a
            if thy_spell in #journal || Spell_Fizzles in #journal
               goto ReCastInvis
            }
         set %LASTSCAN %TEMP
         }
      }
   while #TARGCURS = 1
      {
      event macro 23              ;target self
      wait 2
      }
   wait 1s                     ;waits 2 second
  }
 Return
Title: Re: Casting wait timer
Post by: TrailMyx on November 17, 2008, 12:16:35 PM
That's a good bit of code there, OMG.

This also works:

OMG, that's a good bit of code there.
Title: Re: Casting wait timer
Post by: OMGBurgers on November 17, 2008, 12:37:10 PM
I'm sure there's better ways to do it since I just learn what I figure out and from others lol.  I'm sure that while loop at the bottom isn't needed but for me sometimes it misses the target from lag or something so I have a sub to make sure it actually targets.