Author Topic: Please help with my auto discord script snippet.  (Read 3151 times)

0 Members and 1 Guest are viewing this topic.

Offline vanzelusTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 1
  • vanzelus has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Please help with my auto discord script snippet.
« on: June 04, 2014, 11:21:46 AM »
0
Hi,

Am trying to get this script snippet to scan the journal so that when disco fails it'll loop back and try again but if disco succeeds it'll stop trying to disco the target.  I got the first part to work but the second part when disco succeeds the script won't stop and continue to disco the target even though the target is already discorded.  I'm not well versed in scanjournal so maybe that's where my problem is.  Please advise; again the goal is to keep looping when disco failed but stop looping when disco succeeds.  Thanks.

Code: [Select]
Set %discord #false
heal:
If #FINDCNT > 0 && #HITS > 81 && #MANA > 50 && %PETS_KILL = #TRUE && %Cast_Wait_Timer <= #sCnt2
      {
        cmppix 1 f
        {
          Event macro 15 28 ; cast Greater Heal
          Target 5s
          click 1412 736
          wait 10
        }
      }
If #FINDCNT > 0 && %PETS_KILL = #TRUE && %DISCORD = #FALSE
      {
        SET #LTARGETID %TARGET_FOUND
        Event macro 13 15 ; use skill Discordance
        Target 5s
        Event macro 22 0 ; last target
        scanjournal 1
          if fail in #journal
          {
            deleteJournal
            wait 2s
            goto heal
          }
          if another_skill in #journal
          {
            deleteJournal
            wait 2s
            goto heal
          }
          if your_target's_strength in #journal
          {
            deleteJournal
            Set %DISCORD #TRUE
            wait 1s
            goto heal
          }
          if that_creature_is_already_in_discord in #journal
          {
            deleteJournal
            Set %DISCORD #TRUE
            wait 1s
            goto heal
          }
      }

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Please help with my auto discord script snippet.
« Reply #1 on: June 05, 2014, 06:03:24 AM »
0
I know you weren't asking about this but, for starters, you should consider changing your healing to targeting self instead of click location. I was also unsure about your use of cmppix, totally unnecessary.

Here's an example, but note that I may have mistakes here, I'm at work and going off memory:
Code: [Select]
If #FINDCNT > 0 && #HITS > 81 && #MANA > 50 && %PETS_KILL = #TRUE && %Cast_Wait_Timer <= #sCnt2
   {
   set #ltargetkind 1 ;<=== need to define targetkind when using target system
   Event macro 15 28 ; cast Greater Heal
   target 5s
   event macro 23 0 ;<=== target self
   wait 10
   }

Now, on your question - here's the thing, you want to capture the #jindex value before you use discordance, then perform your actions, then scan EACH LINE of the journal that has changed since the last "synch" of the index.

You should also get rid of those "deletejournal" items, not necessary. Also you can see how I cleaned things up a little bit and made the code shorter.

For example:

Code: [Select]
If #FINDCNT > 0 && %PETS_KILL = #TRUE && %DISCORD = #FALSE
   {
   SET #LTARGETID %TARGET_FOUND
  
   set %Index #jindex + 1 ;<=== sets a variable to the line following the current #jindex value
  
   Event macro 13 15 ; use skill Discordance
   Target 5s
   Event macro 22 0 ; last target

   if #jindex >= %Index ;<=== just make sure the the journal has new content before bothering to scan it
      {
      for %i %index #jindex ;<=== this for loop says "perform the following actions for all the lines of the journal that have changed
         {
         scanjournal %i ;<=== scans the index value given to %i in the for loop
         if fail in #journal || another_skill in #journal ;<=== you really don't need this anyhow since you aren't doing anything with it
            goto heal
         if your_target's_strength in #journal || that_creature_is_already_in_discord in #journal
            {
            Set %DISCORD #TRUE
            goto heal
            }
         }
      }
   }

Hope this helps!

XII
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Offline vanzelusTopic starter

  • Jr. Member
  • **
  • Posts: 24
  • Activity:
    0%
  • Reputation Power: 1
  • vanzelus has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: Please help with my auto discord script snippet.
« Reply #2 on: June 05, 2014, 08:41:37 AM »
0
Quote
I know you weren't asking about this but, for starters, you should consider changing your healing to targeting self instead of click location. I was also unsure about your use of cmppix, totally unnecessary.

Thanks for your respond 12x.  The cmppix snippet is actually for pet healing; i know i can set #ltargetid as pet id and use last target to heal but was lazy and decided to just use the click location instead lol.  But since you're touching on this topic as well, I want to ask a tangent question.  How do you write a simple script that would drag pet's healthbar to a predetermined x y coordinate?  I looked at a lot of script on easyuo on how to do this and they all don't seem to have a concrete answer or just a bit too much code.  Would this example work?

Code: [Select]
set %pet #ltargetid
execevent drag #ltargetid
conposx 1412
contposy 715

Don't dock me too much for this, I just pulled this out of my head without looking up all necessary codes.  I just want a simple code, not anything complex, to pull pet's healthbar to a predetermined location without having to drag it by hand every time.  Thanks again for your input.

Offline 12TimesOver

  • Another Day, Another Vendetta
  • Global Moderator
  • *
  • *
  • Posts: 3694
  • Activity:
    0%
  • Reputation Power: 41
  • 12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.12TimesOver is a force to reckon with.
  • Gender: Male
  • Respect: +321
  • Referrals: 2
    • View Profile
Re: Please help with my auto discord script snippet.
« Reply #3 on: June 05, 2014, 08:57:55 AM »
0
Hmmm...not sure, haven't done that before. Maybe someone else will weigh in.

XII
When they come for me I'll be sitting at my desk
     with a gun in my hand wearing a bulletproof vest
My, my, my how the time does fly
     when you know you're gonna die by the end of the night

Tags: