#heroicAttributeMinimum = 15 #heroicAttributeCountMinimum = 2 #attributeSumMinimum = 75 #attributeCount = 6 Procedure roll_attribute() Protected i, sum Dim rolls(3) For i = 0 To 3 rolls(i) = Random(6, 1) Next i ;sum the highest three rolls SortArray(rolls(), #PB_Sort_Descending) For i = 0 To 2 sum + rolls(i) Next ProcedureReturn sum EndProcedure Procedure displayAttributes(List attributes(), sum, heroicCount) Protected output$ output$ = "Attributes generated: [" ForEach attributes() output$ + attributes() If ListIndex(attributes()) <> #attributeCount - 1: output$ + ", ": EndIf Next output$ + "]" PrintN(output$) PrintN("Total: " + sum + ", Values " + #heroicAttributeMinimum + " or above: " + heroicCount) EndProcedure Procedure Gen_attributes() Protected i, attributesSum, heroicAttributesCount NewList attributes() Repeat ClearList(attributes()) attributesSum = 0: heroicAttributesCount = 0 For i = 1 To #attributeCount AddElement(attributes()) attributes() = roll_attribute() attributesSum + attributes() heroicAttributesCount + Bool(attributes() >= #heroicAttributeMinimum) Next Until attributesSum >= #attributeSumMinimum And heroicAttributesCount >= #heroicAttributeCountMinimum displayAttributes(attributes(), attributesSum, heroicAttributesCount) EndProcedure If OpenConsole("RPG Attributes Generator") Gen_attributes() Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input() CloseConsole() EndIf