getIndexes

Events

Conditions

Actions


-------- F I N D A N I N D E X N U M B E R F O R E A C H A B I L I T Y --------


Set IRS_getSpellIndex = 0


For each (Integer IRSs_Indexes[0]) from 1 to IRSs_Indexes[1], do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






IRSs_Ability[IRSs_Indexes[0]] Equal to IRS_setAbility





Then - Actions






-------- (the ability was previously recognized by the system so it already has an index number) --------






Set IRS_getSpellIndex = IRSs_Indexes[0]





Else - Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




IRS_getSpellIndex Equal to 0



Then - Actions




-------- (this is the first time the ability was recognized by the system, so create a new index number) --------




Set IRSs_Indexes[1] = (IRSs_Indexes[1] + 1)




Set IRS_getSpellIndex = IRSs_Indexes[1]




Set IRSs_Ability[IRS_getSpellIndex] = IRS_setAbility



Else - Actions


-------- F I N D A N I N D E X N U M B E R F O R E A C H I N S T A N C E O F T H E A B I L I T Y --------


Set IRS_getNextIndex = 0


Set IRS_getMaxIndex = 0


For each (Integer IRSs_Indexes[0]) from 1 to IRS_max[IRS_getSpellIndex], do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Load IRSs_Indexes[0] of IRS_getSpellIndex from IRSs_hash) Equal to True





Then - Actions






-------- (finding the index of the cast with the highest index number; eg: max) --------






Set IRS_getMaxIndex = IRSs_Indexes[0]





Else - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








IRS_getNextIndex Equal to 0







Then - Actions








-------- (finding the first inactive slot) --------








Set IRS_getNextIndex = IRSs_Indexes[0]







Else - Actions


-------- (if the max active index number is 0, that means there are no active slots) --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




IRS_getMaxIndex Equal to 0



Then - Actions




Set IRS_getOffable = True



Else - Actions




Set IRS_getOffable = False


-------- (as an assurance, we set the maximum active index as the first inactive slot found if the inactive was found beyond the max's range) --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




IRS_getNextIndex Greater than IRS_getMaxIndex



Then - Actions




Set IRS_getMaxIndex = IRS_getNextIndex



Else - Actions


-------- (if no inactive slot was found, the next available slot must be beyond the maximum) --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




IRS_getNextIndex Equal to 0



Then - Actions




Set IRS_getMaxIndex = (IRS_max[IRS_getSpellIndex] + 1)




Set IRS_getNextIndex = IRS_getMaxIndex



Else - Actions


-------- (save the found maximum) --------


Set IRS_max[IRS_getSpellIndex] = IRS_getMaxIndex