Observant people will recognize the layout to be similar to that of Veggies FW (thank you for that ). However this works within any campaign with any light settings.
How to install (MT build 70)
1. download file attached to this post
2. drag the file into maptool
3. drag the 'verbose' button to a token (and rename it)
OR
3. drag the other button (SetLightSource) to any token where you want to use it and delete the lib:wolph42 token.
Note:
(Edit:)- that the button does work on the Campaign panel, after you have set 'apply to selected token' (right click and edit)
- if you get a message: "You do not have permission to call the getInfo('campaign') function", then do the following:
1. right click on the SetLightSource macro
2. click edit --> options (tab) --> deselect: "Allow players to edit macro"
Alternatively you can just paste the code straight into your framework
Code: Select all
<!--set light-->
<!--get lightsources from campaignproperties-->
[h:source = getInfo("campaign")]
[h:lightSource = json.get(source, "light sources")]
[h:lightTypeList = listSort(json.fields(lightSource),"A+")]
<!--remove light types not wanted-->
<!-- h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Type you want removed")) -->
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Ranges"))]
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Suppress"))]
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Flame"))]
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Special"))]
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Suppress"))]
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Grenade"))]
<!--construct lists of light-->
[h:i = 0]
[h:inputStr = ""]
[h, foreach(lightType, lightTypeList), CODE:{
[inputStr = listAppend(inputStr,"tab"+i+" | "+lightType+" || TAB")]
[H, if(!i): inputStr = listAppend(inputStr, "divider | | <html><b>The Wolph42 Light Editor</b></html>| LABEL | text=none")]
[lights = json.get(lightSource,lightType)]
[lightSet = lightType]
[lightList = ""]
[foreach(light, lights):lightList = listappend(lightList, json.get(light, "name"))]
[lightSetList = listSort(lightList,"N+")]
[nlightSetList = listCount(lightSetList)]
[h,COUNT(nlightSetList),CODE:{
[light = listGet(lightSetList,roll.count)]
[newStr = "Lamp"+i+"S"+roll.count+"|"+hasLightSource(lightSet, light)+"| "+light+" | CHECK"]
[inputStr = listAppend(inputStr, newStr)]
}]
[H, if(!i): inputStr = listAppend(inputStr, "divider2 | ------ | ------------------------------ | LABEL")]
[H, if(!i): inputStr = listAppend(inputStr, "removeAll | 0 | REMOVE ALL LIGHTS? | CHECK")]
[i=i+1]
}]
<!--ask for input-->
[H: inputStr = listFormat(inputStr, "input( %list )", " ' %item ' ", ",")]
<!-- create the dialog -->
[H: status = eval(inputStr)]
[H: abort(status)]
<!--set the the lights-->
[i=0]
[h, foreach(lightType, lightTypeList), CODE:{
[lights = json.get(lightSource,lightType)]
[lightSet = lightType]
[lightList = ""]
[foreach(light, lights):lightList = listappend(lightList, json.get(light, "name"))]
[lightSetList = listSort(lightList,"N+")]
[nlightSetList = listCount(lightSetList)]
[h,COUNT(nlightSetList),CODE:{
[light = listGet(lightSetList,roll.count)]
[setLight(lightSet,light,eval("Lamp"+i+"S"+roll.count))]
}]
[h:i=i+1]
}]
<!-- if removeAll was checked, clear all lights -->
[H, if(removeAll): clearLights()]
excluding light types
In the top of the code there is the comment:
<!-- h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Type you want removed")) -->
Change this into
[h:lightTypeList = listDelete(lightTypeList, listFind(lightTypeList, "Type you want removed"))]
And replace "Type you want removed" with the type you want removed.
Screenshot: