Can anyone see what I am doing wrong in the follow. I have tried duplicating the logic from other scripts but i am getting it wrong. I am not sure if it is in loading of the sets, their iteration, or both. I have been going back and forth and not finding my problem on my own.
What is happening is that ${MobsIterator.Key(exists) never evaluates as true but I am not sure why. I am working on a script to monitor for a list of mobs and resources that you define in an xml file and play a wav when they are seen. I will post it once I get it working.
Below is my test script that I cannot get to work, below it is the xml is is reading.
Thank you for any help! I am sure it is dumb mistake that will be obvious once it is pointed out.
What is happening is that ${MobsIterator.Key(exists) never evaluates as true but I am not sure why. I am working on a script to monitor for a list of mobs and resources that you define in an xml file and play a wav when they are seen. I will post it once I get it working.
Below is my test script that I cannot get to work, below it is the xml is is reading.
Thank you for any help! I am sure it is dumb mistake that will be obvious once it is pointed out.
Code:
variable bool Verbose=TRUE
variable iterator MobsIterator
variable iterator ResourcesIterator
function Startup()
{
declare SaveDir filepath script "${Script.CurrentDirectory}/test/"
mkdir "${SaveDir}"
declare OutputFile string script "${Script.CurrentDirectory}/test/test_debug.log"
declare ConfigFile string script "${Script.CurrentDirectory}/test/test.xml"
call DebugIt "starting up"
LavishSettings:Clear
setMobs:Clear
setResources:Clear
LavishSettings:AddSet[Test]
LavishSettings[Test]:AddSet[Mobs]
LavishSettings[Test]:AddSet[Resources]
LavishSettings[Test]:Import[${ConfigFile}]
setMobs:Set[${LavishSettings[Test].FindSet[Mobs].GUID}]
setResources:Set[${LavishSettings[Test].FindSet[Resources].GUID}]
}
function Shutdown()
{
call DebugIt "shutting down"
}
function DebugIt(string aText)
{
if ${Verbose}
{
echo ${aText}
}
redirect -append "${OutputFile}" echo "${Time}:: ${aText}"
}
function ReadPrint()
{
;List Mobs
call DebugIt "Listing Mobs:"
setMobs:GetSettingIterator[MobsIterator]
MobsIterator:First
while (${MobsIterator.Key(exists)})
{
call DebugIt "passing through while loop"
call DebugIt "${MobsIterator.Key}"
MobsIterator:Next
}
}
function main()
{
call Startup
call ReadPrint
call Shutdown
}
Code:
<?xml version='1.0' encoding='UTF-8'?>
<!-- Generated by LavishSettings v2 -->
<InnerSpaceSettings>
<Set name="Mobs">
<Setting Name="Gruesome Grue">Gruesome Grue</Setting>
<Setting Name="Wandering Wombat">Wandering Wombat</Setting>
</Set>
<Set name="Resources">
<Setting Name="Festering Applesauce">Festering Applesauce</Setting>
</Set>
</InnerSpaceSettings>