Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Authoring Kit (http://forums.wolflair.com/forumdisplay.php?f=58)
-   -   Example - Die Rolling Procedure (http://forums.wolflair.com/showthread.php?t=61049)

TCArknight August 8th, 2018 01:33 PM

Example - Die Rolling Procedure
 
Howdy!

So many games involve die rolls, I thought that I would share this procedure.

Code:

  <!-- Procedure DieRoll
        Determine the total of a dice roll.

        Outbound parameter: total
        Inbound parameter: NumOfDice  : for 3d6 would be 3, 1d20+2 would be 1, etc.
        Inbound parameter: SizeOfDice : for 3d6 would be 6, 1d20+2 would be 20, etc.
  -->
  <procedure id="DieRoll" scripttype="none"><![CDATA[
    ~declare variables that are used to communicate with our caller
    var NumOfDice as number
    var SizeOfDice as number
    var total as number

        var i as number
       
        total = 0
       
    for i = 0 to NumOfDice
          total += random(SizeOfDice)
          next
       
    ]]></procedure>


tkarn August 8th, 2018 02:57 PM

Thank you.


All times are GMT -8. The time now is 07:20 AM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.