#spellBook ! Make a table of Spells to Cast from a given list. the list is in the form of the lists as done in the spellList file. ! ! $ARGS[0] = Type of List: cast, learn, list ! This determines the info to be displayed as wel las the HTML formatting ! $ARGS[1] = the name of the array to use for the spell list. ! $ARGS[2] = (optional) return Action Code - a dynamic piece of code to run instead of generic return. ! $ARGS[3] = (optional) Additional code to put in spell link (all spells) ! $spellBookVar['Type'] = $ARGS[0] $spellBookVar['Array'] = $ARGS[1] $spellBookVar['ActionCode'] = $ARGS[2] $spellBookVar['CodeAfterSpell'] = $ARGS[3] ! Make sure opptional variables have defaults if $spellBookVar['ActionCode'] = '': $spellBookVar['ActionCode'] = 'gt $loc, $loc_arg' end if $spellBookVar['CodeAfterSpell'] = '': $spellBookVar['CodeAfterSpell'] = 'gt $loc, $loc_arg' end ! lets the user back out if they don''t want ot cast. dynamic "act 'Never mind': <<$spellBookVar['ActionCode']>>" ! This just makes sure the current spellLists are loaded gs 'spellList' !----------------------------------------------------------------------------------------------- ! Choose the type of spell list to determine what info will be displayed and the HTML formatting ! 1) 'TableText' = The header for the table. The header row ! 2) 'RowCode' = The code used inside the loop to build the HTML text for that Row. !! 'learn' type is for displaying which seplls the user is currently learning. if $spellBookVar['Type'] = 'learn': $spellBookVar['TableText'] = "
" $spellBookVar['RowCode'] = { if spellLearn[$ThisSpellName] > 0 and spellKnown[$ThisSpellName] ! 1: $result = " " spellBookVar['Counter'] += 1 else $result = '' end } !! 'list' type is list of castable spells. This makes a table of spells for the user to cast. elseif $spellBookVar['Type'] = 'cast': $spellBookVar['TableText'] = "
Spell Percent Learned
<<$spellName[$ThisSpellName]>> <>
" $spellBookVar['RowCode'] = { if spellKnown[$ThisSpellName] = 1: if $spellOptDesc[$ThisSpellName] = '': ! If the spell has no Options, we jsut list it out for casting $tmpHTMLCode = " " else ! If the spell does have options, we make a row for spell info, and loop through additional rows ! with options for the user to pick $tmpHTMLCode = " " n=0 :RowCodeLoop98 if n < arrsize('<<$spellOptDesc[$ThisSpellName]>>'): $spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[<>]') $spellBookVar['tmpName']= dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[<>]') $tmpHTMLCode += " " n += 1 jump 'RowCodeLoop98' end end $result = $tmpHTMLCode spellBookVar['Counter'] += 1 killvar '$tmpHTMLCode' killvar 'n' else $result = '' end } !! 'list' type is list of castable targetable spells. This makes a table of spells for the user to cast in combat. elseif $spellBookVar['Type'] = 'targetable': $spellBookVar['TableText'] = "
Spell Mana Description
>'& <<$spellBookVar['CodeAfterSpell']>>""><<$spellName[$ThisSpellName]>> <> <<$spellDesc[$ThisSpellName]>>
<<$spellName[$ThisSpellName]>> <> <<$spellDesc[$ThisSpellName]>>
>', '<<$spellBookVar['tmpVal']>>' & <<$spellBookVar['CodeAfterSpell']>>""><<$spellBookVar['tmpName']>>
" $spellBookVar['RowCode'] = { if spellKnown[$ThisSpellName] = 1: $tmpHTMLCode = " " $result = $tmpHTMLCode spellBookVar['Counter'] += 1 killvar '$tmpHTMLCode' killvar 'n' else $result = '' end } !! Default is a list of spells with descriptio nand mana cost listed. else $spellBookVar['TableText'] = "
Spell Mana Targets Description
<<$spellName[$ThisSpellName]>> <> " if $spellTarget[$ThisSpellName] = 'self': $tmpHTMLCode += " >', 'pcs', 0, 0 & <<$spellBookVar['CodeAfterSpell']>>"">You" elseif $spellTarget[$ThisSpellName] = 'team': n=0 :RowCodeLoop96 if n < arrsize('pcs_health'): $spellBookVar['tmpName']= dyneval('$result = $pcs_name[<>]') $tmpHTMLCode += " >', 'pcs', <>, 0 & <<$spellBookVar['CodeAfterSpell']>>""><<$spellBookVar['tmpName']>>
" n += 1 jump 'RowCodeLoop96' end else n=0 :RowCodeLoop97 if n < arrsize('opp_health'): $spellBookVar['tmpName']= dyneval('$result = $opp_name[<>]') $tmpHTMLCode += " >', 'opp', <>, 0 & <<$spellBookVar['CodeAfterSpell']>>""><<$spellBookVar['tmpName']>>
" n += 1 jump 'RowCodeLoop97' end end $tmpHTMLCode += "
<<$spellDesc[$ThisSpellName]>>
" $spellBookVar['RowCode'] = { if spellKnown[$ThisSpellName] = 1: if $spellOptDesc[$ThisSpellName] = '': ! If the spell has no Options, we jsut list it out for casting $tmpHTMLCode = " " else ! If the spell does have options, we make a row for spell info, and loop through additional rows ! with options for the user to pick $tmpHTMLCode = " " n=0 :RowCodeLoop99 if n < arrsize('<<$spellOptDesc[$ThisSpellName]>>'): $spellBookVar['tmpVal'] = dyneval('$result = <<$spellOptVal[$ThisSpellName]>>[<>]') $spellBookVar['tmpName']= dyneval('$result = <<$spellOptDesc[$ThisSpellName]>>[<>]') $tmpHTMLCode += " " n += 1 jump 'RowCodeLoop99' end end $result = $tmpHTMLCode spellBookVar['Counter'] += 1 killvar '$tmpHTMLCode' killvar 'n' else $result = '' end } end i = 0 spellBookVar['ArraySize'] = dyneval("result = arrsize('<<$spellBookVar['Array']>>')") spellBookVar['Counter'] = 0 :SpellListLoop $ThisSpellName = dyneval("$result = <<$spellBookVar['Array']>>[<>]") if i < spellBookVar['ArraySize']: !$spellBookVar['RowCode'] $spellBookVar['TableText'] += dyneval($spellBookVar['RowCode']) i += 1 jump 'SpellListLoop' end $spellBookVar['TableText'] += "
Spell Mana Description
<<$spellName[$ThisSpellName]>> <> <<$spellDesc[$ThisSpellName]>>
<<$spellName[$ThisSpellName]>> <> <<$spellDesc[$ThisSpellName]>>
<<$spellBookVar['tmpName']>>
" if spellBookVar['Counter'] = 0: $spellBookVar['TableText'] = "
You have no spells in this list.
" end !*pl $spellBookVar['TableText'] $result = func('cleanHTML',$spellBookVar['TableText']) killvar 'i' killvar '$ThisSpellName' killvar '$spellBookVar' killvar 'spellBookVar' --- spellBook ---------------------------------