;~ Create the temp xml #include #include #include #include Local Const $sFilePath = "G:\D&DSessions\Player_" Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("C:\Users\XXXX\AppData\Roaming\Fantasy Grounds\campaigns\DelvPrac1\db.xml") Local $oClasses Local $iChars = 0 Local $arrClassNum[8] Local $arrCharNam[8] Local $arrCharAC[8] Local $arrCharAblCha[8] Local $arrCharAblCon[8] Local $arrCharAblDex[8] Local $arrCharAblInt[8] Local $arrCharAblStr[8] Local $arrCharAblWis[8] Local $arrCharHPTmp[8] Local $arrCharHPWnd[8] Local $arrCharHPMax[8] Local $arrCharClassNam[8][10] Local $arrCharClassLvl[8][10] Local $oCharSheet = $oXML.selectSingleNode("//root/charsheet") $oXML.unload Local $oChars = $oCharSheet.childNodes While 1 $iChars = 0 For $oChar IN $oChars $iChars = $iChars+1 $arrClassNum[$iChars] = 0 $oNodes1 = $oChar.childNodes For $oNode1 IN $oNodes1 If($oNode1.tagName = 'abilities')Then $oAbils = $oNode1.childNodes For $oAbil IN $oAbils If($oAbil.tagName = 'charisma')Then $oSubAbils = $oAbil.childNodes For $oSubAbil IN $oSubAbils If($oSubAbil.tagName = 'score')Then $arrCharAblCha[$iChars]=$oSubAbil.text EndIf Next ElseIf($oAbil.tagName = 'constitution')Then $oSubAbils = $oAbil.childNodes For $oSubAbil IN $oSubAbils If($oSubAbil.tagName = 'score')Then $arrCharAblCon[$iChars]=$oSubAbil.text EndIf Next ElseIf($oAbil.tagName = 'dexterity')Then $oSubAbils = $oAbil.childNodes For $oSubAbil IN $oSubAbils If($oSubAbil.tagName = 'score')Then $arrCharAblDex[$iChars]=$oSubAbil.text EndIf Next ElseIf($oAbil.tagName = 'intelligence')Then $oSubAbils = $oAbil.childNodes For $oSubAbil IN $oSubAbils If($oSubAbil.tagName = 'score')Then $arrCharAblInt[$iChars]=$oSubAbil.text EndIf Next ElseIf($oAbil.tagName = 'strength')Then $oSubAbils = $oAbil.childNodes For $oSubAbil IN $oSubAbils If($oSubAbil.tagName = 'score')Then $arrCharAblStr[$iChars]=$oSubAbil.text EndIf Next ElseIf($oAbil.tagName = 'wisdom')Then $oSubAbils = $oAbil.childNodes For $oSubAbil IN $oSubAbils If($oSubAbil.tagName = 'score')Then $arrCharAblWis[$iChars]=$oSubAbil.text EndIf Next EndIf Next ElseIf($oNode1.tagName = 'defenses')Then $oDefs = $oNode1.childNodes For $oDef IN $oDefs If($oDef.tagName = 'ac')Then $oSubDefs = $oDef.childNodes For $oSubDef IN $oSubDefs If($oSubDef.tagName = 'total')Then $arrCharAC[$iChars]=$oSubDef.text EndIf Next EndIf Next ElseIf($oNode1.tagName = 'name')Then $arrCharNam[$iChars] = $oNode1.text ElseIf($oNode1.tagName = 'hp')Then $oHPs = $oNode1.childNodes For $oHP IN $oHPs If($oHP.tagName = 'total')Then $arrCharHPMax[$iChars]=$oHP.text ElseIf($oHP.tagName = 'temporary')Then $arrCharHPTmp[$iChars] == $oHP.text ElseIf($oHP.tagName = 'wounds')Then $arrCharHPWnd[$iChars]=$oHP.text EndIf Next ElseIf($oNode1.tagName = 'classes')Then $oClasses = $oNode1.childNodes For $oClass IN $oClasses If($oClass.tagName <> 'holder')Then $arrClassNum[$iChars] = $arrClassNum[$iChars] + 1 $oSubClasses = $oClass.childNodes ; MsgBox($MB_SYSTEMMODAL, $iChars & ' ' & $arrClassNum[$iChars], $oClass.tagName) For $oSubClass IN $oSubClasses ; MsgBox($MB_SYSTEMMODAL, $iChars & ' ' & $arrClassNum[$iChars], $oSubClass.tagName) If($oSubClass.tagName = 'name')Then $arrCharClassNam[$iChars][$arrClassNum[$iChars]] = $oSubClass.text ElseIf($oSubClass.tagName = 'level')Then $arrCharClassLvl[$iChars][$arrClassNum[$iChars]] =$oSubClass.text EndIf Next EndIf Next EndIf Next Next For $i = 1 To $iChars Local $hFileOpenNC = FileOpen($sFilePath & $i & '_NamCls.txt' , 10 ) Local $hFileOpenACHP = FileOpen($sFilePath & $i & '_ACHP.txt' , 10 ) Local $hFileOpenAbil = FileOpen($sFilePath & $i & '_Abil.txt' , 10 ) $scharRanks = '' For $ij = 1 To $arrClassNum[$i] $scharRanks = $scharRanks & $arrCharClassNam[$i][$ij] & '(' & $arrCharClassLvl[$i][$ij] & ') ' Next FileWriteLine($hFileOpenNC, $arrCharNam[$i] & @CRLF & $scharRanks ) FileWriteLine($hFileOpenACHP, 'AC: ' & $arrCharAC[$i] & @CRLF & 'HP/Max: ' & ($arrCharHPMax[$i]+$arrCharHPTmp[$i]-$arrCharHPWnd[$i] )& '/' & $arrCharHPMax[$i] ) FileWriteLine($hFileOpenAbil, 'Str: ' & $arrCharAblStr[$i] & @CRLF & 'Dex: ' & $arrCharAblDex[$i] & @CRLF & 'Con: ' & $arrCharAblCon[$i] & @CRLF & 'Int: ' & $arrCharAblInt[$i] & @CRLF & 'Wis: ' & $arrCharAblWis[$i] & @CRLF & 'Cha: ' & $arrCharAblCha[$i] ) FileClose($hFileOpenNC) FileClose($hFileOpenACHP) FileClose($hFileOpenAbil) Next Sleep(60000) WEnd ;MsgBox($MB_SYSTEMMODAL, "", $output_Text)