FD Code

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

NeedMacroHelp
orc pawn
orc pawn
Posts: 14
Joined: Thu May 20, 2004 7:08 pm

FD Code

Post by NeedMacroHelp » Fri May 21, 2004 8:32 pm

I would like to thank the people who I got a tiny bit of this code from can't remember names, but just would like to say thanks if any of this code looks familiar...

Ok so you all stated I should do something for myself... so here I wrote this FD code. I don't know how to check to see if a skill failed or not or whether or not it is possible to do that. If so please let me know how. Also tear this code apart . The idea of it is so when you are in a battle it checks your health, when below 40 you mend, when 30 and below it tries to FD you. Not that I would need to explain anyways...so here it is:

Code: Select all

|-------------------------------------------------------------------------------- 
|SUB: Check Health
|-------------------------------------------------------------------------------- 
Sub Checkhealth
/if (${Me.PctHPs}<40) { 

/doability "Mend"
}

/if (${Me.PctHPs}<30) { 
/attack off
/doability "Feign Death"
/look 
/echo << ${Me.PctHPs}% LOW HP - FD >> 
:Mendanchor1
/doability "Mend"
/if (${Me.PctHPs}>80{
/stand
/call Gotoanchor
}
/if (${Me.PctHPs}<85){
/goto :Mendanchor1
}
}
/if (${Me.PctHPs}<20) { 
/doability "Feign Death"
/look 
/echo << ${Me.PctHPs}% LOW HP - FD1 FAILED - TRY 2 >>
:Mendanchor2
/doability "Mend"
/if (${Me.PctHPs}>80{
/stand
/call Gotoanchor
}
/if (${Me.PctHPs}<85){
/goto :Mendanchor2
}
}
/if (${Me.PctHPs}<10) { 
/doability "Feign Death"
/look 
/echo << ${Me.PctHPs}% LOW HP - FD2 FAILED - TRY 3(Better Fucking Work) >> 

/echo /loc

:Mendanchor3
/doability "Mend"
/if (${Me.PctHPs}>80{
/stand
/call Gotoanchor
}
/if (${Me.PctHPs}<85){
/goto :Mendanchor3
}
}
/if (${Me.PctHPs}==0) { 
/doability "Feign Death"
/look 
/echo << FUCK I DIED >> 
/quit
/endmacro
}


} 
Oh...and anchor is like the place u start hunting from...

Programmer
a hill giant
a hill giant
Posts: 195
Joined: Mon Dec 01, 2003 2:41 am

Post by Programmer » Fri May 21, 2004 8:40 pm

To determine if a skill succeeded or not, you will need to use events. Set up one event based on the text of a succesful FD, set up another event based on the text of a failed FD, and handle the events as appropriate.

Looks like you are trying to repeat at most 3 times in case of failure, and you've repeated that code three times. This can work and is not a bad thing for an initial effort, but if not now, at least in the future, you should try to reduce the three (nearly) identical blocks of code to a single block that gets passed through multiple times. Less code = less chance of mistakes and more chance of finding mistakes.

NeedMacroHelp
orc pawn
orc pawn
Posts: 14
Joined: Thu May 20, 2004 7:08 pm

Post by NeedMacroHelp » Fri May 21, 2004 9:59 pm

Would this work? here are the snippets:

Code: Select all

#Event FDFail "has fallen to the ground."

|--------------------------------------------------------------------------------
|SUB: Check Health
|--------------------------------------------------------------------------------
Sub Checkhealth

/if (${Me.PctHPs}<30) {
/attack off
/doability "Feign Death"
/look
/echo << ${Me.PctHPs}% LOW HP - FD >>

/doability "Mend"
/if (${Me.PctHPs}>80{
/stand
}
}


/if (${Me.PctHPs}<40) {

/doability "Mend"
}



|--------------------------------------------------------------------------------
|SUB: FDFail
|--------------------------------------------------------------------------------
Sub Event_FDFail
/varset RV_FDFail 1
:Feign
/if ({Me.AbilityReady["Feign Death"]}) {
/echo FD'ing at ${Me.PctHPs} health...
/doability "Feign Death"
/varset RV_FDFail 0
}
/if (${RV_FDFail == 1}){
	/goto :Feign
}
:Health
/if (${Me.PctHPs}% > 80){
/call Checkhealth
}
/goto :Health
/return

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Sat May 22, 2004 3:19 am

Untested, but should be close

Code: Select all

#event FDFail "#1# has fallen to the ground."

Sub Main
    /declare FDGood int outer
    | do whatever checks you need to determine if you should Feign

    /call FDNow

     | you should be Feigned, so do whatever you want if you are feigned
    /return

Sub FDNow
    /varset FDGood 1
  :NeedToFeign
    /if (!${Me.AbilityReady[Feign Death]}) /goto :NeedToFeign

    /doability "Feign Death"
    /if (!${FDGood}) {
        /varset FDGood 1
        /goto :NeedToFeign
    }

    /return

Sub Event_FDFail(WhoFailed)
    /if (${Me.Name.Equal[${WhoFailed}]}) /varset FDGood 0

    /return
You should also check for feign breaking, and refeign if you are trying to stay down a while.

Programmer
a hill giant
a hill giant
Posts: 195
Joined: Mon Dec 01, 2003 2:41 am

Post by Programmer » Sat May 22, 2004 8:54 pm

I'm not sure, but you may need to add a delay in here.

Code: Select all

    /varset FDGood 1 
  :NeedToFeign 
    /if (!${Me.AbilityReady[Feign Death]}) /goto :NeedToFeign 

    /doability "Feign Death" 
    [color=red]/delay 1[/color]
    /if (!${FDGood}) {
A delay of 1 could even be too small, depending on lag and perhaps just general use. Without some appropriate delay, I think there is a timing logic error. The code assumes that the event that can set FDGood to 0 upon a fail will always happen between the /doability and the check. Without actually testing it, I would think that MQ will get to the next line before EQ has made a determination.

Another option is to have FGDood preinitialized to 0, and change the event to one that sets it to 1 on a good feign. Then you can follow logic like:

Code: Select all

/varset FDGood 0
:NeedToFeign
    /if ($FDGood}) /goto :Feigned
    /if (!${Me.AbilityReady[Feign Death]}) /goto :NeedToFeign 

    /doability "Feign Death"
    /goto :NeedToFeign
:Feigned
In this snippet, I would rename the lable NeedToFeign to something like "FDUntilSuccess", since it sets up a loop FD'ing until we succeed.

There needs to be one additional event also - an event looking to see if you've died and, if so, break out of the FDUntilSuccess loop. Might even include a hp check to stop trying to FD if someone heals you enough.[/code]

s16z
a ghoul
a ghoul
Posts: 97
Joined: Thu Apr 01, 2004 12:03 pm

Post by s16z » Sun May 23, 2004 4:22 am

I wrote that off the top of my head, so it hasn't been tested. But, looking at it again, there needs to be a /doevents right after the /doablity "feign death" or nothing will happen.

Yes, I'd put other checks in there, and other conditions. How long do I want to stay FD? What should I do if a spell hits me and I'm FD?

As for reversing the 0/1 meanings, you can do that, I'm just in the habit of 0 meaning false, so wrote it that way. You could even use boolean values instead of ints.

Mainly I was trying to give an idea of a direction that could be taken.