Page 1 of 1

auto Galadriel's Gift

Posted: Sun Feb 28, 2021 8:36 pm
by rmm10
I want to make a macro that checks for debuffs from a list (lets call it debuffs.ini) and auto clicks the Gift.

Code: Select all

Sub Main

|---Spell name of the debuff---


    /declare toondebuff1 string outer "Creeping Doom"
    /declare toondebuff2 string outer "Blight of Hate"
    /declare toondebuff3 string outer "Balance of Zebuxoruk"
    /declare toondebuff4 string outer "Skeleton Plague"
    /declare toondebuff5 string outer "Shout of the Drakeling"
    /declare toondebuff6 string outer "Balance of Zebuxoruk"
    /declare toondebuff7 string outer "Malos"
    /echo Looking for debuffs.

  /call Loop

/return

Sub Loop

 /goto :loopstart

:loopstart
      
  |----Legs Section---

  /if (${Me.Buff[Vengeance of the Forsaken].ID} == NULL) {
  /casting 18851|item
  }

  |---Toon Debuff Section--- needs Gift of Galadriel

  /if (${Me.Buff[${toondebuff1}].ID} || ${Me.Buff[${toondebuff2}].ID} || ${Me.Buff[${toondebuff3}].ID} || ${Me.Buff[${toondebuff4}].ID} || ${Me.Buff[${toondebuff5}].ID} || ${Me.Buff[${toondebuff6}].ID} || ${Me.Buff[${toondebuff7}].ID}) {
  /target ${Me}
  /casting 17892|item
  }   

  /doevents
  /goto :loopstart

/return

Re: auto Galadriel's Gift

Posted: Mon Mar 01, 2021 5:59 pm
by Niixnec
Here is the subroutine I use to go through buffs looking for creeping doom. If found it saves the current target, then targets self, casts the Ssra remove curse item, then goes back to original target. Should be able to add other buffs and change the cast item. I set this in my normal macro for the char and call it when needed for fights to check for Curse (/bct Char //isCursed TRUE).

/declare isCursed bool outer FALSE

/if (${isCursed}) /call BuffCheck


Code: Select all

Sub BuffCheck
   /declare x int inner
   /declare CurrentTarget string inner
   /for x ${Me.CountBuffs} downto 1
      |**
      /if (${Me.Buff[${x}].ID}) /echo Buff ${x} is ${Me.Buff[${x}]}
      /if (${Me.Buff[${x}].ID}) /echo ${Me.Buff[${x}].Spell.ID}
      **|
      /if (${Me.Buff[${x}].Spell.ID}==6646) {
         /varset CurrentTarget ${Target.CleanName}
         /echo ${CurrentTarget}
         /delay 3
         /tar ${Me}
         /casting 4476 |item
         /delay 8s
         /tar ${CurrentTarget}
         }
      /next x
/return

Re: auto Galadriel's Gift

Posted: Mon Mar 01, 2021 6:37 pm
by rmm10
Wow, I just now noticed that most of my original post just...disappeared. It looked ok in preview and it looked ok in draft so I just assumed it would be ok here. But nope. Only the code and the first line of my typing survived. So here is what somehow got deleted:

As you can see from my present macro, its become very un-elegant due to the number of debuffs that I want the macro to look for. And my present list of seven is only going to get bigger. So what I am thinking is a script that will look at a list of debuff names, then one-by-one search for each one of them in my toon's debuff box. When it finds one, it clicks the Gift. The problem is that I don't know how to make a script look at a list and then check the lines (spells) in it.

However, it looks like this might have to be done from another angle. Niixnec's script looks at each buff and see's if its the stated debuff. But even using that method, the same problem comes up...I need the macro to check for multiple debuffs not just one. And I would like it to do so without needing to copy/paste an entire sub for each debuff.

Oh, and no need to have it cycle thru toons...Galadriel's Gift is self-only.

Let me put it another way...see in Niixnec's code where it says ==6646? I need it to say ==6646 OR 8269 OR 2913 OR 9048 OR...I think you get the idea. And I think the best way to do it is to have a file that has a list that can be easily added to without changing the code itself. Not sure if it would be an ini file or an inc file. Something called by #include perhaps.

Note: that script I posted is not usable as-is. It was pasted from Notepad, which had Word Wrap enabled. Thats why the /if statement is 3 lines instead of one long huge line. If anyone is gonna use it then make sure its not broken up by Returns or anything. It has to be all one big line.

Re: auto Galadriel's Gift

Posted: Mon Mar 01, 2021 6:40 pm
by rmm10
Hey Niixnec, I noted this in your script:

|**
/if (${Me.Buff[${x}].ID}) /echo Buff ${x} is ${Me.Buff[${x}]}
/if (${Me.Buff[${x}].ID}) /echo ${Me.Buff[${x}].Spell.ID}
**|

Its commented. Was that used for testing things? And whats the difference between the first /if and the second /if?

Re: auto Galadriel's Gift

Posted: Mon Mar 01, 2021 11:38 pm
by Niixnec
Yes, just for testing. I wanted to see what gets returned.
I would cast debuffs on myself to ensure it would get the True state and kick off the item cast.

regards,
niix

Re: auto Galadriel's Gift

Posted: Tue Mar 02, 2021 6:22 pm
by soandsoEQ
So, I just enable MQ2Debuffs and use this:

Code: Select all

/if ((${Debuff.Detrimentals} || ${Debuff} || ${Debuff.Counters}) && ${Cast.Ready} && ${Cast.Ready[${FindItem[Galadriel's Gift]}|item]}) /casting "${FindItem[Galadriel's Gift]}"|item


With that no need to check for a specific debuff, the donor cure will go off whenever it can and you have a debuff.

Re: auto Galadriel's Gift

Posted: Wed Mar 03, 2021 7:25 am
by rmm10
Wow, that plugin will for sure be a timesaver for me. Thank you for that. I pasted it into a test mac and, after correcting for the inevitable paste mistake that I so often make (i.e. Bracket Hell), it worked right off. But just so you know...I was on my way to a solution dammit (lol). I scoured the mq2 pdf docs from 2016 and found the ini TLO. I learned how to manipulate it into seeing an ini file and how to draw out entries in that ini file:

${Ini[debuffs.ini,debuffs,1]} ---> this would find the file debuffs.ini, look in the section called [debuffs], and look at the value of entry number 1. In this case, I had in that file 1=Creeping Doom. Further entries would have been like 2=Skeleton Plague, 3=Blight of Hate, etc.

The next step I was trying to figure out was to change the 1 into a /for /next routine. Perhaps /for x 1 to 20 and then change the ini to ${Ini[debuffs.ini,debuffs,(x)]}...or maybe ${Ini[debuffs.ini,debuffs,[1]]}, not sure which.

But then I thought ut oh...the ini itself would already be within a for/next...can for/next be nested, i.e. does mq2 allow a for/next to be within a for/next? I don't think all scripting languages allow this.

The next thought I had...after really looking at the nature of buffs...is "how does the GIft know the difference between a buff and a debuff?". And then your timely post answered that. Judging by the mq2debuffs documentation over at redguides:

https://www.redguides.com/community/res ... buffs.117/

I assume that in the emu source code...in its spell database...there is an entry for each spell that simply says "is this a bad buff yes/no?". And that one of the things that mq2debuffs does is add a TLO that looks for that bit of data.

It seems like, in theory, the only $ that should be needed for the auto Gift is ${Debuff.Detrimentals}. But since you included Counters and plain Debuff, then either there are debuffs that should have the detrimentals flag but don't...or...my definition of detrimental and the emu source code's definition of detrimental are not the same. 8-)

I was hoping that mq2debuffs would also have a way to actually name the spell that it sees, but most of the TLO variations look to be either Boolean (it simply returns True or False) or int (integer...returns a number). The only variation seems to be a string is at the bottom of the aforementioned documentation page: Debuff.X. But when I test that using /echo ${Debuff.X} while wearing a debuff, MQ2 says NULL.

Btw...the place where I test this stuff is in dsk2, in the area around the zone in...the Vehemet Bats. They can be agroed singly or in pairs, do not hit hard (with respect to a donored sk), will stand up to numerous ripostes, and cast Bat Sonar.