Code: Select all
#turbo 10
Sub Main
/zapvars
/declare GroupNumber global
/declare GroupNames array
/declare GroupLevels array
/declare GroupClass array
/declare GroupMax global
/declare GroupMin global
/declare LoopVar global
/call ScanGroup
/call Report
/return
Sub ScanGroup
/varset GroupNumber $calc($group(count)-1) | group count minus one. Alone==0 Full==5
/for LoopVar 0 to @GroupNumber
/if "@GroupNames(@LoopVar)"!="$spawn($group(@LoopVar),name)" { |Assume new member
| /echo <<New Member Joined>> $spawn($group(@LoopVar),name) is a level $spawn($group(@LoopVar),level) $spawn($group(@LoopVar),class)
}
/varset GroupNames(@LoopVar) "$spawn($group(@LoopVar),name)"
/varset GroupLevels(@LoopVar) $spawn($group(@LoopVar),level)
/varset GroupClass(@LoopVar) "$spawn($group(@LoopVar),class)"
/next LoopVar
/call EchoRange
/return
Sub EchoRange
/declare Min local
/declare Max local
/varset Min $char(level)
/varset Max $char(level)
/if n $group(count)==1 /goto :SkipMath
/for LoopVar 0 to @GroupNumber
| Find the highest and lowest level in group
/if n $spawn($group(@LoopVar),level)<@Min /varset Min $spawn($group(@LoopVar),level)
/if n $spawn($group(@LoopVar),level)>@Max /varset Max $spawn($group(@LoopVar),level)
/next LoopVar
:SkipMath
|Find the min and max level with a span of 7 from the previous levels.
/varset GroupMin $calc(@Max-7)
/varset GroupMax $calc(@Min+7)
/if n @GroupMax>65 /varset GroupMax 65
/if n $calc(@Min+7)<@Max {
|Assume that the lowest level MUST be within seven levels of the highest
/echo ***************WARNING*****************
/echo Lowest Level in group is: Level @GroupMin
/echo Highest Level in group is: Level @GroupMax
/echo This is larger than the 7 level span limit.
/echo ****************************************
/return
}
/echo Level span Avalible is @GroupMin to @GroupMax
/return
Sub Report
/echo -- GROUP REPORT --
/for LoopVar 0 to @GroupNumber
/echo <<Group Member>> $spawn($group(@LoopVar),name) is a level $spawn($group(@LoopVar),level) $spawn($group(@LoopVar),class)
/next LoopVar
/echo -- END REPORT --
/return
