Adding Functionality to KissAssist Using the new /mycmd.
I am sure there are many of you that have just skipped over this new ability, as outlined in the manual:
So I decided to give an example of how this could be used.
In this example I am going to add the ability to position your ranger to use his ranged attack(/autofire).
There is no reason to re-invent the wheel, so lets got grab the code from MuleAssist.
Now lets shorten the name of the routine, because this is going to be our new command we have to use when calling this routine.
I would change Sub FindvalidRangeLocation(int targetID, string radius) to Sub fvrl(string p_P1, string p_P2, string p_P3). I also want to add in some additional Target.ID checks. My altered routine now looks like this.
Now I just need to add the code to my kissmycmds.inc file.
Now from within KissAssist I can use my new fvrl routine using the /mycmd command. /mycmd fvrl Target.ID 35. I could even add it into the DSP section and use it.
Example:
DPS1=Command:/mycmd fvrl Target.ID 35|100|ambush|cond1
...
DPS5=Command:/mycmd fvrl Target.ID 35|99|cond1
Cond1=${Target.ID} && (${Target.Distance3D} < 30 || !${Target.LineOfSight})
The DPS5 entry is added in case the mob gets to close to you, and you need to reposition.
I am sure there are many of you that have just skipped over this new ability, as outlined in the manual:
So I decided to give an example of how this could be used.
In this example I am going to add the ability to position your ranger to use his ranged attack(/autofire).
There is no reason to re-invent the wheel, so lets got grab the code from MuleAssist.
Rich (BB code):
| -------------------------------------------------------------------------------------
| SUB: FindvalidRangeLocation
| -------------------------------------------------------------------------------------
Sub FindvalidRangeLocation(int targetID, string radius)
/declare i int local 0
/declare XOff float local 0
/declare YOff float local 0
/declare ZOff float local 0
/declare XMove float local 0
/declare YMove float local 0
/declare BaseRadians local
|we incrememnt by 5 feet around the circle...
/declare Multiplier local 10
/declare MyHeading float local ${Math.Calc[${Spawn[${targetID}].Heading.Degrees} - ${Multiplier}]}
/declare BaseRadian float local ${Math.Calc[360 / 36]}
/for i 1 to 36
/varcalc XMove ${Math.Cos[ ${BaseRadian} * ${Float[${i}]} + (${MyHeading}) ]}
/varcalc YMove ${Math.Sin[ ${BaseRadian} * ${Float[${i}]} + (${MyHeading}) ]}
/varcalc XOff ${Spawn[${targetID}].X} + ( ${Int[${radius}]} * ${XMove} )
/varcalc YOff ${Spawn[${targetID}].Y} + ( ${Int[${radius}]} * ${YMove} )
/varcalc ZOff ${Spawn[${targetID}].Z}
/if (${Navigation.PathExists[locyxz ${YOff} ${XOff} ${ZOff}]}) {
/if (${LineOfSight[${YOff},${XOff},${ZOff}:${Spawn[${targetID}].Y},${Spawn[${targetID}].X},${Spawn[${targetID}].Z}]}==TRUE) {
|/echo ${SpawnCount[pc loc ${XOff} ${YOff} radius 20]}
/if (${EverQuest.ValidLoc[${XOff} ${YOff} ${ZOff}]}) {
/if (${SpawnCount[npc loc ${XOff} ${YOff} radius 50]}<=${Me.XTarget}) {
/echo [${i}] We have a valid loc at ${YOff} ${XOff} ${ZOff}
/squelch /nav locyxz ${YOff} ${XOff} ${ZOff}
/delay 1s ${Navigation.Active}==TRUE
/delay 5s ${Navigation.Active}==FALSE
/break
}
}
}
}
/next i
/return
Now lets shorten the name of the routine, because this is going to be our new command we have to use when calling this routine.
I would change Sub FindvalidRangeLocation(int targetID, string radius) to Sub fvrl(string p_P1, string p_P2, string p_P3). I also want to add in some additional Target.ID checks. My altered routine now looks like this.
Rich (BB code):
| ----------------------------------------------------------------------------
| Find Ranged Location Sub. Used to position Rangers.
| Shamelessly stolen from MuleAssist Macro(EQMule).
| p_P1 must be the name of a valid TLO member or declared outer variable.
| Examples: Target.ID or MyTargetID
| p_P2 is a static int value. Example: 35
| p_P3 not use at this time.
| ----------------------------------------------------------------------------
Sub fvrl(string p_P1, string p_P2, string p_P3)
/declare targetID int local ${${p_P1}}
/declare radius int local ${p_P2}
/if (${Target.ID}) {
/if (!${targetID} || ${targetID}!=${Target.ID} || ${Bool[${Target.Mezzed.ID}]}) /return 0
/if (${Target.Distance3D}>30 && ${Target.LineOfSight}) /return 1
} else {
/return 0
}
| Can't use a ranged item if less than 30 distance.
/if (${radius}<30) /varset radius 35
/declare i int local 0
/declare XOff float local 0
/declare YOff float local 0
/declare ZOff float local 0
/declare XMove float local 0
/declare YMove float local 0
/declare BaseRadians local
|we incrememnt by 5 feet around the circle...
/declare Multiplier local 10
/declare MyHeading float local ${Math.Calc[${Spawn[${targetID}].Heading.Degrees} - ${Multiplier}]}
/declare BaseRadian float local ${Math.Calc[360 / 36]}
/for i 1 to 36
/varcalc XMove ${Math.Cos[ ${BaseRadian} * ${Float[${i}]} + (${MyHeading}) ]}
/varcalc YMove ${Math.Sin[ ${BaseRadian} * ${Float[${i}]} + (${MyHeading}) ]}
/varcalc XOff ${Spawn[${targetID}].X} + ( ${Int[${radius}]} * ${XMove} )
/varcalc YOff ${Spawn[${targetID}].Y} + ( ${Int[${radius}]} * ${YMove} )
/varcalc ZOff ${Spawn[${targetID}].Z}
/if (${Navigation.PathExists[locyxz ${YOff} ${XOff} ${ZOff}]}) {
/if (${LineOfSight[${YOff},${XOff},${ZOff}:${Spawn[${targetID}].Y},${Spawn[${targetID}].X},${Spawn[${targetID}].Z}]}==TRUE) {
|/echo ${SpawnCount[pc loc ${XOff} ${YOff} radius 20]}
/if (${EverQuest.ValidLoc[${XOff} ${YOff} ${ZOff}]}) {
/if (${SpawnCount[npc loc ${XOff} ${YOff} radius 50]}<=${Me.XTarget}) {
/echo [${i}] We have a valid loc at ${YOff} ${XOff} ${ZOff}
/squelch /nav locyxz ${YOff} ${XOff} ${ZOff}
/delay 1s ${Navigation.Active}==TRUE
/delay 5s ${Navigation.Active}==FALSE
/break
}
}
}
}
/next i
/return 1
Now I just need to add the code to my kissmycmds.inc file.
Rich (BB code):
|kissmycmds.inc
|
| ----------------------------------------------------------------------------
| Sub mycmds: Include side of commands feature.
| ----------------------------------------------------------------------------
Sub mycmds(myCMD, p_1, p_2, p_3)
/declare str_returnStatus string local
/if (${SubDefined[${myCMD}]}) {
/call ${myCMD} "${p_1}" "${p_2}" "${p_3}"
/varset str_returnStatus ${Macro.Return}
} else {
/varset str_returnStatus CMDInvalid_${myCMD}
}
/return ${str_returnStatus}
| ----------------------------------------------------------------------------
| Above here is manditory. Do NOT remove.
| ----------------------------------------------------------------------------
| Add additional Subs below here.
| ----------------------------------------------------------------------------
| ----------------------------------------------------------------------------
| Find Ranged Location Sub. Used to position Rangers.
| Shamelessly stolen from MuleAssist Macro(EQMule).
| p_P1 must be the name of a valid TLO member or declared outer variable.
| Examples: Target.ID or MyTargetID
| p_P2 is a static int value. Example: 35
| p_P3 not use at this time.
| ----------------------------------------------------------------------------
Sub fvrl(string p_P1, string p_P2, string p_P3)
/declare targetID int local ${${p_P1}}
/declare radius int local ${p_P2}
/if (${Target.ID}) {
/if (!${targetID} || ${targetID}!=${Target.ID} || ${Bool[${Target.Mezzed.ID}]}) /return 0
/if (${Target.Distance3D}>30 && ${Target.LineOfSight}) /return 1
} else {
/return 0
}
| Can't use a ranged item if less than 30 distance.
/if (${radius}<30) /varset radius 35
/declare i int local 0
/declare XOff float local 0
/declare YOff float local 0
/declare ZOff float local 0
/declare XMove float local 0
/declare YMove float local 0
/declare BaseRadians local
|we incrememnt by 5 feet around the circle...
/declare Multiplier local 10
/declare MyHeading float local ${Math.Calc[${Spawn[${targetID}].Heading.Degrees} - ${Multiplier}]}
/declare BaseRadian float local ${Math.Calc[360 / 36]}
/for i 1 to 36
/varcalc XMove ${Math.Cos[ ${BaseRadian} * ${Float[${i}]} + (${MyHeading}) ]}
/varcalc YMove ${Math.Sin[ ${BaseRadian} * ${Float[${i}]} + (${MyHeading}) ]}
/varcalc XOff ${Spawn[${targetID}].X} + ( ${Int[${radius}]} * ${XMove} )
/varcalc YOff ${Spawn[${targetID}].Y} + ( ${Int[${radius}]} * ${YMove} )
/varcalc ZOff ${Spawn[${targetID}].Z}
/if (${Navigation.PathExists[locyxz ${YOff} ${XOff} ${ZOff}]}) {
/if (${LineOfSight[${YOff},${XOff},${ZOff}:${Spawn[${targetID}].Y},${Spawn[${targetID}].X},${Spawn[${targetID}].Z}]}==TRUE) {
|/echo ${SpawnCount[pc loc ${XOff} ${YOff} radius 20]}
/if (${EverQuest.ValidLoc[${XOff} ${YOff} ${ZOff}]}) {
/if (${SpawnCount[npc loc ${XOff} ${YOff} radius 50]}<=${Me.XTarget}) {
/echo [${i}] We have a valid loc at ${YOff} ${XOff} ${ZOff}
/squelch /nav locyxz ${YOff} ${XOff} ${ZOff}
/delay 1s ${Navigation.Active}==TRUE
/delay 5s ${Navigation.Active}==FALSE
/break
}
}
}
}
/next i
/return 1
Now from within KissAssist I can use my new fvrl routine using the /mycmd command. /mycmd fvrl Target.ID 35. I could even add it into the DSP section and use it.
Example:
DPS1=Command:/mycmd fvrl Target.ID 35|100|ambush|cond1
...
DPS5=Command:/mycmd fvrl Target.ID 35|99|cond1
Cond1=${Target.ID} && (${Target.Distance3D} < 30 || !${Target.LineOfSight})
The DPS5 entry is added in case the mob gets to close to you, and you need to reposition.
Attachments
Last edited by a moderator:


