Ich bin bei meinem Programm mal wieder auf ein kleines Problem gestoßen.
Ich will meinen Arrays die Daten aus der xml zuordnen. Z.B. so das
s_unit(0) = Abonimation
s_unit(1) = Acolyte
...
Ich habe erstmal die Richtigkeit der Datenrückgabe mit dem Debuggergeprüft.
Hier die Debugger Ausgabe:
Code: Alles auswählen
0
Unit
Abomination
Minimal_Damage
33
Minimal_Damage_2
0
Maximal_Damage
39
Maximal_Damage_2
0
Hitpoints
1175
Attack_Type
Normal
Attack_Type_2
na
Cooldown
1.9
Cooldown_2
0
Armor_Type
Heavy
Armor
2
Regeneration
2
2
Unit
Acolyte
Minimal_Damage
9
Minimal_Damage_2
0
Maximal_Damage
10
Maximal_Damage_2
0
Hitpoints
220
Attack_Type
Normal
Attack_Type_2
na
Cooldown
2.5
Cooldown_2
0
Armor_Type
Medium
Armor
0
Regeneration
2
4
Unit
Archer
Minimal_Damage
16
Minimal_Damage_2
0
Maximal_Damage
18
Maximal_Damage_2
0
Hitpoints
245
Attack_Type
Pierce
Attack_Type_2
na
Cooldown
1.5
Cooldown_2
0
Armor_Type
Medium
Armor
0
Regeneration
0.5
[ * * * * * * * - - - C U T - - - * * * * * * * ]
168
Unit
Witch Doctor
Minimal_Damage
10
Minimal_Damage_2
0
Maximal_Damage
14
Maximal_Damage_2
0
Hitpoints
315
Attack_Type
Magic
Attack_Type_2
na
Cooldown
1.75
Cooldown_2
0
Armor_Type
Unarmored
Armor
0
Regeneration
0.25
Hier der Codeabschnitt:
Code: Alles auswählen
Procedure xmldata()
Shared s_unit()
Shared s_mindam()
Shared s_mindam2()
Shared s_maxdam()
Shared s_maxdam2()
Shared s_hitpoints()
Shared s_atttype()
Shared s_atttype2()
Shared s_cooldown()
Shared s_cooldown2()
Shared s_armtype()
Shared s_armor()
Shared s_regeneration()
Select language
Case "eng","english","englisch"
xmlpath.s = GetCurrentDirectory() + "progdata\units_eng.xml"
Case "ger","german","deu","deutsch"
xmlpath.s = GetCurrentDirectory() + "progdata\units_ger.xml"
Default
xmlpath.s = GetCurrentDirectory() + "progdata\units_eng.xml"
EndSelect
LoadXML(#XMLFILE, xmlpath)
*mainnode = MainXMLNode(#XMLFILE)
*unitdata = ChildXMLNode(*mainnode)
*subnode = ChildXMLNode(*mainnode)
*unitdata = ChildXMLNode(*subnode)
unitcount = (XMLChildCount(*mainnode) * 2) - 2
datacount = (XMLChildCount(*subnode) * 2) - 1
For i = 0 To unitcount
Debug i
Debug ""
For u = 0 To datacount
Debug GetXMLNodeName(*unitdata)
Debug GetXMLNodeText(*unitdata)
*unitdata = NextXMLNode(*unitdata)
u = u + 1
Next
If i <> unitcount
*subnode = NextXMLNode(*subnode)
*unitdata = ChildXMLNode(*subnode)
EndIf
Debug ""
i = i + 1
Next
EndProcedure
siehe hier:
Code: Alles auswählen
Dim s_unit.s (unitsintable)
Dim s_mindam.l (unitsintable)
Dim s_mindam2.l (unitsintable)
Dim s_maxdam.l (unitsintable)
Dim s_maxdam2.l (unitsintable)
Dim s_hitpoints.l (unitsintable)
Dim s_atttype.s (unitsintable)
Dim s_atttype2.s (unitsintable)
Dim s_cooldown.f (unitsintable)
Dim s_cooldown2.f (unitsintable)
Dim s_armtype.s (unitsintable)
Dim s_armor.f (unitsintable)
Dim s_regeneration.f (unitsintable)
Sagt bescheid, falls ihr das xml file braucht.
mfg Cabble