This shows you the differences between two versions of the page.
user:mtaft4:projects:scripts:experience [2010/12/18 01:31] – created mtaft4 | user:mtaft4:projects:scripts:experience [2010/12/18 01:32] (current) – mtaft4 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | =====D& | ||
+ | This script uses bc to calculate experience in Dungeons and Dragons Edition 3.5 based on the Challenge Rating of the encounter and the average Character Level of the party. | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # xpscript - D&D script for calculating experience from enounters based on CR of | ||
+ | # the encounter and level of the party | ||
+ | |||
+ | if [ $# == 0 ] | ||
+ | then | ||
+ | echo " | ||
+ | exit | ||
+ | fi | ||
+ | cr=$1 | ||
+ | lv=$2 | ||
+ | test1=`echo " | ||
+ | if [ " | ||
+ | then | ||
+ | xp=`echo " | ||
+ | xp=`echo " | ||
+ | echo " | ||
+ | else # CR-LV is odd | ||
+ | cr1=`echo " | ||
+ | cr2=`echo " | ||
+ | xp2=`echo " | ||
+ | xp1=`echo " | ||
+ | xp2=`echo " | ||
+ | xp2=`echo " | ||
+ | xp=`echo " | ||
+ | echo $xp | ||
+ | fi | ||
+ | exit | ||
+ | </ | ||
+ | This script uses a lot of command expansions to do the calculations and variable declarations before finally using bc to calculate the results of the formula for the encounter experience. Not really an important script but goes to further show that bash is a powerful utility that can be used to do many things. |