I have more surrounding it, but that stuff is not important. Might be nice, but I'd rather show this piece off.
These are Orion Sub functions. As I said before these are called from within my script. The point is to show how it can be done in a setting that actually works rather than a hypothetically scenario that might work. The magic line is:
Code: Select all
mobCount = Orion.FindType('any', 'any', "ground", "mobile", distance, 'gray | criminal | enemy | red').length;
Code: Select all
/*
*Description: Attempt to use ability. Smart (based on surounding mobs) or Primitive (goes through selected abilities).
*Parameters: Action - A timer set to the the delay actDelay (Timer).
* actDelay - Delay before each action (1250 for more than 237 stam) (Int).
*
* smartCombat - Want combat based on mob count (Boolean).
* single - Ability to use for single mobs (String). Primary, Secondary, or MomentumStrike.
* multiple - Ability to use for multiple mobs (String). Primary, Secondary, or MomentumStrike.
*
* prim - Want to use primary ability (Boolean).
* meansPrim - The numerical representation of prim (Int).
* sec - Want to use secondary ability (Boolean).
* meansSec - The numerical representation of secondary (Int).
* mom - Want to use momentum strike (Boolean).
* meansMom - The numerical representation of momentum strike (Int).
* actCounter - An action counter to keep track of which action should occur (Int).
*Returns: actCounter - An action counter to keep track of which action should occur (Int).
* Action - A timer reset to 0 (Timer).
*/
function attemptAbility() {
if (Orion.Timer('Action') >= actDelay) {
if (smartCombat) {
distance = usingMelee ? "1" : "10";
mobCount = Orion.FindType('any', 'any', "ground", "mobile", distance, 'gray | criminal | enemy | red').length;
useAbility(mobCount > 1 ? multiple : single);
}
else {
counter = Number(Orion.GetGlobal('actCounter'));
if (prim && counter == Number(Orion.GetGlobal('meansPrim'))) {
Orion.UseAbility('Primary', true);
}
else if (sec && counter == Number(Orion.GetGlobal('meansSec'))) {
Orion.UseAbility('Secondary', true);
}
else if (mom && counter == Number(Orion.GetGlobal('meansMom'))) {
Orion.Cast('momentum strike');
}
counter++;
if (counter >= actCntrMax)
Orion.SetGlobal('actCounter', '0');
else {
Orion.SetGlobal('actCounter', String(counter));
}
}
Orion.SetTimer('Action');
}
}
/*
*Discription: A helper function to use the ability based on the decided type.
*Parameters: type - the type of ability to use (String).
*Returns: None.
*/
function useAbility(type) {
if (Orion.Contains('Primary', type)) {
Orion.UseAbility('Primary', true);
}
else if (Orion.Contains('Secondary', type)) {
Orion.UseAbility('Secondary', true);
}
else if (Orion.Contains('MomentumStrike', type)) {
Orion.Cast('momentum strike');
}
}
/*
*Description: Assign the primitive integer meaning of an ability based on the abilities desired.
*Parameters: prim - Want to use primary ability (Boolean).
* sec - Want to use secondary ability (Boolean).
* mom - Want to use momentum strike (Boolean).
*Returns: actCounterMax - The maximum value for an ability (Int).
* meansPrim - The integer meaning of Primary Ability (Int).
* mennsSec - The integer meaning of the Secondary Ability (Int).
* meansMom - The integer meaning of Momentum Strike (Int).
*/
function assignMeaning() {
actCounterMax = prim + sec + mom;
cntr = 0;
Orion.SetGlobal('meansPrim', String(prim ? cntr++ : 10));
Orion.SetGlobal('meansSec', String(sec ? cntr++ : 10));
Orion.SetGlobal('meansMom', String(mom ? cntr++ : 10));
return actCounterMax;
}
Thank you for humoring my excitement .