Code: Select all
java.lang.NullPointerException error executing expression abort(eval(inputStr)).
Moderators: dorpond, trevor, Azhrei
Code: Select all
java.lang.NullPointerException error executing expression abort(eval(inputStr)).
None of the above.
Code: Select all
inputStr
Code: Select all
[H: '<!-- summonToken -->']
[H: '<!-- based on Orpheus WoD campaign macro -->']
[h:me = getSelected()]
[h:assert(listCount(me) <= 1, "Make sure only one token is selected",0)]
[h, if(listCount(me) == 1), CODE:{
[switchToken(me)]
[h: X = getTokenX(0)]
[h: Y = getTokenY(0)]
[H: PrimePC = getName() ]
}; {
[h: X = 0]
[h: Y = 0]
[H: PrimePC = ""]
}]
[h, if(argCount() > 0): useCurrentMap = arg(0); useCurrentMap = 0]
[h, if(argCount() > 1): conditions = arg(1); conditions = "{}"]
[H: '<!-- no new scope!! -->']
[h: bot_getValidTokens(useCurrentMap, conditions)]
[H: '<!-- User choice of what to use, at which level, on who -->']
[h:inputStr = "junk|<html><b>Summon Token</b> - More token types can be added from the Settings macro</html>|-|LABEL|SPAN=TRUE"]
[h,if(listCount(fancyPCList) > 1): inputStr = listAppend(inputStr, "pcNumber | " + fancyPCList + " | PC | LIST | ICON=TRUE ICONSIZE=30", '@') ; pcNumber = 0]
[h,if(listCount(fancyNPCList) > 1): inputStr = listAppend(inputStr, "npcNumber | " + fancyNPCList + " | NPC | LIST | ICON=TRUE ICONSIZE=30", '@') ; npcNumber = 0]
[h,if(0 && listCount(fancyCharList) > 1): inputStr = listAppend(inputStr, "charNumber | " + fancyCharList + " | (N)PC | LIST | ICON=TRUE ICONSIZE=30", '@') ; charNumber = 0]
[h,if(0 && listCount(fancyAllList) > 1): inputStr = listAppend(inputStr, "allNumber | " + fancyAllList + " | ALL | LIST | ICON=TRUE ICONSIZE=30", '@') ; allNumber = 0]
[h, foreach(propType, propTypesList), CODE:{
[fancyList = eval("fancy"+propType+"List")]
[if(listCount(fancyList) > 1): inputStr = listAppend(inputStr, propType + "Number | " + fancyList + " | "+propType+" | LIST | ICON=TRUE ICONSIZE=30", '@') ; set(propType + "Number", 0)]
}]
[h, if(listCount(fancySpecialList) > 1):inputStr = listAppend(inputStr, "specialNumber | " + fancySpecialList + " | Special | LIST | ICON=TRUE ICONSIZE=30", '@')]
[h:'<!-- ask for number -->']
[h:inputStr = listAppend(inputStr,"junk|<html><b>Number of each selected token to summon:</b></html>|-|LABEL|SPAN=TRUE", '@')]
[h:inputStr = listAppend(inputStr, "bot_amount|1|give amount", '@')]
[h:inputStr = listAppend(inputStr, "bot_spread|0|Spread summoned tokens|CHECK", '@')]
[h:'<!-- ask for coords -->']
[h:inputStr = listAppend(inputStr,"junk|<html><b>Summon Token(s) to:</b></html>|-|LABEL|SPAN=TRUE", '@')]
[h:inputStr = listAppend(inputStr,"junk|<html>If you select a token before you run this macro then its<br>coords will be used here</html>|-|LABEL|SPAN=TRUE", '@')]
[h:inputStr = listAppend(inputStr, "X|"+X+"|X-coordinate to place token", '@')]
[h:inputStr = listAppend(inputStr, "Y|"+Y+"|Y-coordinate to place token", '@')]
[h:'<!-- show coords of selected token-->']
[h, if(PrimePC != ""):inputStr = listAppend(inputStr,"junk|"+X+","+Y+"|<html><b>Location of "+PrimePC+"</b>|LABEL", '@')]
[h:'<!-- create the dialog string -->']
[h:inputStr = listFormat(inputStr, "input( %list )", " ' %item ' ", ",", "@")]
[h:'<!-- ask for input-->']
[h:abort(eval(inputStr))]
[h: updates = json.set("{}", "useDistance", 0)]
[h: updates = json.set(updates, "x", X+1)]
[h: updates = json.set(updates, "y", Y)]
[h:summonedList = json.append("",me)]
[r,if(pcNumber): summonedList = json.merge(summonedList, copyToken(listGet(pcList, pcNumber), bot_amount, baseMapName, updates))]
[r,if(npcNumber): summonedList = json.merge(summonedList, copyToken(listGet(npcList, npcNumber), bot_amount, baseMapName, updates))]
[r,if(charNumber): summonedList = json.merge(summonedList, copyToken(listGet(charList, charNumber), bot_amount, baseMapName, updates))]
[r,if(allNumber): summonedList = json.merge(summonedList, copyToken(listGet(allList, allNumber), bot_amount, baseMapName, updates))]
[r, foreach(propType, propTypesList, ""), CODE:{
[r,if(eval(propType+"Number")): summonedList = json.merge(summonedList, copyToken(listGet(eval(propType+"List"), eval(propType+"Number")), bot_amount, baseMapName, updates))]
}]
[r,if(specialNumber): summonedList = json.merge(summonedList, copyToken(listGet(specialList, specialNumber), bot_amount, baseMapName, updates))]
[h, if(bot_spread), CODE:{
[selectTokens(summonedList, 1, "json")]
[msg = "This message is needed to spread the tokens"]
[pause("msg")]
[bot_formationSquare()]
}; {}]
Code: Select all
[H: '<!-- -------------------------------- getValidTokens(useCurrentMap) ------------------------------------ -->']
[H: '<!-- based on Orpheus WoD campaign macro -->']
[h,if(argCount() > 0): useCurrentMap = arg(0); useCurrentMap = 0]
[h,if(argCount() > 1): conditions = arg(1); conditions = "{}"]
[h,if(argCount() > 2): use_None = arg(2); use_None = 1]
[h,if(argCount() > 3): startsWithTxt = lower(arg(3)); startsWithTxt = ""]
[h:baseMapName = getLibProperty("baseMapName", "lib:EventMacros")]
[h:oldMap = getCurrentMapName()]
[h:assert(listContains(getAllMapNames(),baseMapName), "Uknown map: '"+baseMapName+"' Set the correct BASE map value in the settings macro of the Bag of Tricks macro panel",0)]
[h,if(use_None): noneImageId = getImage('image:none')]
[h, if(!useCurrentMap):setCurrentMap(baseMapName)]
[h:pcPropType = getLibProperty("summonPcPropType","lib:EventMacros")]
[h:npcPropType = getLibProperty("summonNpcPropType","lib:EventMacros")]
[h:propTypesList = getLibProperty("summonPropTypesList","lib:EventMacros")]
[h:specialList = getLibProperty("summonSpecialList","lib:EventMacros")]
[h:tokenList = listSort(getTokenNames(",",conditions),"N")]
[h,if(startsWithTxt != ""), CODE:{
<!-- if startswith string is used, narrow the list to those only -->
[newTokenList = ""]
[foreach(tok, tokenList): newTokenList = if(startsWith(lower(tok), startsWithTxt), listAppend(newTokenList, tok), newTokenList)]
[tokenList = newTokenList]
}; {}]
[h:'<!-- remove non existing tokens from specialList -->']
[h:tmpList = ""]
[h, foreach(item, specialList), CODE:{
[if(findToken(item) != ""), CODE:{
[if(getLayer(item) == 'TOKEN'): tmpList = listAppend(tmpList, item)]
}; {}]
}]
[h: specialList = tmpList]
[h:pcList = ""]
[h:npcList = ""]
[h:charList = ""]
[h:allList = ""]
[h,foreach(propType, propTypesList): set(propType+"List","")]
[h:fancyPcList = ""]
[h:fancyNpcList = ""]
[h:fancyCharList = ""]
[h:fancyAllList = ""]
[h,foreach(propType, propTypesList): set("fancy"+propType+"List","")]
[h:fancySpecialList = ""]
[h:specialNumber =0]
[H,FOREACH(tok, tokenList), CODE:{
[pc = if(getPropertyType(tok) == pcPropType && isPC(tok),1 ,0)]
[npc = if(getPropertyType(tok) == npcPropType && isNPC(tok),1 ,0)]
[foreach(propType, propTypesList):set(propType, if(getPropertyType(tok) == propType, 1, 0))]
[special = listContains(specialList, tok)]
[if(pc), CODE:{
[pcList = listAppend(pcList, tok)]
[token(tok): fancyPcList = listAppend(fancyPcList, tok + getTokenImage(60))]
[charList = listAppend(charList, tok)]
[token(tok): fancyCharList = listAppend(fancyCharList, tok + getTokenImage(60))]
}; {}]
[if(npc), CODE:{
[npcList = listAppend(npcList, tok)]
[token(tok): fancyNpcList = listAppend(fancyNpcList, tok + getTokenImage(60))]
[charList = listAppend(charList, tok)]
[token(tok): fancyCharList = listAppend(fancyCharList, tok + getTokenImage(60))]
}; {}]
[foreach(propType, propTypesList), CODE:{
[tmpEval = eval(propType)]
[if(tmpEval): set(propType+"List", listAppend(eval(propType+"List"), tok))]
[if(tmpEval), token(tok): set("fancy"+propType+"List", listAppend(eval("fancy"+propType+"List"), tok + getTokenImage(60)))]
}]
[if(special), CODE:{
[token(tok): fancySpecialList = listAppend(fancySpecialList, tok + getTokenImage(60))]
}; {}]
[allList = listAppend(allList, tok)]
[token(tok): fancyAllList = listAppend(fancyAllList, tok + getTokenImage(60))]
}]
[h,if(use_None), CODE:{
[pcList = if(pcList != "", listAppend("none", pcList), "none")]
[npcList = if(npcList != "", listAppend("none", npcList), "none")]
[charList = if(charList != "", listAppend("none", charList), "none")]
[allList = if(allList != "", listAppend("none", allList), "none")]
[if(fancyPcList == ""): fancyPcList = "none" + noneImageId ; fancyPcList = listAppend("none" + noneImageId, fancyPcList)]
[if(fancyNpcList == ""): fancyNpcList = "none" + noneImageId ; fancyNpcList = listAppend("none" + noneImageId, fancyNpcList)]
[if(fancyCharList == ""): fancyCharList = "none" + noneImageId ; fancyCharList = listAppend("none" + noneImageId, fancyCharList)]
[if(fancyAllList == ""): fancyAllList = "none" + noneImageId ; fancyAllList = listAppend("none" + noneImageId, fancyAllList)]
[foreach(propType, propTypesList), CODE:{
[set(propType+"List", listAppend("none", eval(propType+"List")))]
[set("fancy"+propType+"List", if(eval("fancy"+propType+"List") == "", "none" + noneImageId , listAppend("none" + noneImageId, eval("fancy"+propType+"List"))))]
}]
[specialList = listAppend("none", specialList)]
[if(fancySpecialList == ""): fancySpecialList = "none" + noneImageId ; fancySpecialList = listAppend("none" + noneImageId, fancySpecialList)]
}; {
[h,foreach(propType, propTypesList), CODE:{
[set(propType+"List", eval(propType+"List"))]
[set("fancy"+propType+"List", eval("fancy"+propType+"List")]
}]
}]
[h, if(!useCurrentMap):setCurrentMap(oldMap)]