The problem is that script once in one or two hours is stopping and I can't do anything. Clicking any button causes to appear msgbox with message: "Out of memory".
I wondering if it might be anywhere in this newly added code - bestiary:
Code: Select all
getCorpseType_bestiary(monster){
monster := Trim(monster)
corpseID := getData_bestiary(monster, "monster/look", "corpse")
needleStr = `<item id`=`"%corpseID%
itemsListfile := A_scriptDir . "/Data/monsters/items.xml"
if fileexist(itemsListfile){
FileRead, itemsList, %itemsListfile%
Loop, parse, itemsList, `n, `r
{
If (instr(A_LoopField,needleStr)){
StringGetPos, start, A_LoopField, name`=`"
StringGetPos, end, A_LoopField, `"`>
path := SubStr(A_LoopField, start+7, end - start -6)
if InStr(path, "dead")
return "dead"
else if InStr(path, "remains")
return "remains"
else if InStr(path, "slain")
return "slain"
else if InStr(path, "split")
return "split"
}
}
}
Console("Function error: getCorpseType_bestiary() - monster " . monster . " not recognized. Please report error to the support team.")
return "dead"
}
monsterExist_bestiary(monster){
monster := Trim(monster)
monName = `"%monster%`"
monstersListFile := A_scriptDir . "/Data/monsters/monsters.xml"
if fileexist(monstersListFile){
FileRead, monstersList, %monstersListFile%
Loop, parse, monstersList, `n, `r
{
If (instr(A_LoopField,monName)){
return 1
}
}
}
return 0
}
getFile_bestiary(monster){
monster := Trim(monster)
monName = `"%monster%`"
monstersListFile := A_scriptDir . "/Data/monsters/monsters.xml"
if fileexist(monstersListFile){
FileRead, monstersList, %monstersListFile%
Loop, parse, monstersList, `n, `r
{
If (instr(A_LoopField,monName)){
StringGetPos, start, A_LoopField, file`=`"
StringGetPos, end, A_LoopField, `" `/`>
path := SubStr(A_LoopField, start+7, end - start -6)
return path
}
}
}
return 0
}
getData_bestiary(monster, xml_path, attribute){
; edited attribute xml reader by Joedf @ahk forum
monster := Trim(monster)
if !(monsterExist_bestiary(monster))
return 0
FileRead, xmldata, % A_ScriptDir . "\" . getFile_bestiary(monster)
doc := ComObjCreate("MSXML2.DOMDocument.6.0")
doc.async := false
doc.loadXML(xmldata)
DocNode := doc.selectSingleNode("//" . xml_path)
return DocNode.getAttribute(attribute)
}
getLoot_bestiary(monster, type:=0){ ;specify 0 for all, 1 for nonstackable and 2 for stackable; not work that good, if caount max =1 item is not considered as stackable
monster := Trim(monster)
FileRead, xmldata, % A_ScriptDir . "\" . getFile_bestiary(monster)
lootlist :=""
needleStr=`<item name`=`"
Loop, parse, xmldata, `n, `r
{
If (instr(A_LoopField,needleStr)){
if (type = 0){
if (InStr(A_LoopField, "countmax")){
StringSplit, lootItem, A_LoopField, `"
if lootItem2 != gold coin
lootlist .= lootItem2 . ","
}
}
else if (type = 1){
if !(InStr(A_LoopField, "countmax")){
StringSplit, lootItem, A_LoopField, `"
if lootItem2 != gold coin
lootlist .= lootItem2 . ","
}
}
else{
StringSplit, lootItem, A_LoopField, `"
if lootItem2 != gold coin
lootlist .= lootItem2 . ","
}
}
}
xmldata :=""
return lootlist
}