RPTools.net

Discussion and Support

Skip to content

It is currently Thu Feb 22, 2018 5:56 am 






Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

Previous topic | Next topic 

  Print view

Author Message
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Wolph42's drop in Light Source Editor
PostPosted: Tue Jul 06, 2010 9:35 am 
Inspired by Roadan's dirty token manager and Veggies light source editor, I thought of creating a drop in light source editor.
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"

Code:
<!--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()]


If you want to exclude certain 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.


Any suggestions are welcome.

Screenshot:
Attachment:
Wolph42 Light Editor.jpg
Wolph42 Light Editor.jpg [ 95.05 KiB | Viewed 3591 times ]


Wolph42 Light Editor.rptok [81.48 KiB]
Downloaded 225 times

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Last edited by wolph42 on Wed Jul 07, 2010 5:11 am, edited 3 times in total.
Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Dec 18, 2009 2:33 am
Posts: 382
Location: San Diego
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Tue Jul 06, 2010 11:44 am 
I get an error when I try to drag-and-drop your token into MapTool from my MapTool Library (b63):

Code:
java.lang.InstantiationError: java.util.Map$Entry
   at sun.reflect.GeneratedSerializationConstructorAccessor356.newInstance(Unknown Source)
   at java.lang.reflect.Constructor.newInstance(Unknown Source)
   at com.thoughtworks.xstream.converters.reflection.Sun14ReflectionProvider.newInstance(Sun14ReflectionProvider.java:62)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.instantiateNewInstance(AbstractReflectionConverter.java:257)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:124)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
   at com.thoughtworks.xstream.converters.collections.AbstractCollectionConverter.readItem(AbstractCollectionConverter.java:66)
   at com.thoughtworks.xstream.converters.collections.MapConverter.populateMap(MapConverter.java:63)
   at com.thoughtworks.xstream.converters.collections.MapConverter.unmarshal(MapConverter.java:54)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
   at com.thoughtworks.xstream.annotations.AnnotationReflectionConverter.unmarshallField(AnnotationReflectionConverter.java:66)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.doUnmarshal(AbstractReflectionConverter.java:188)
   at com.thoughtworks.xstream.converters.reflection.AbstractReflectionConverter.unmarshal(AbstractReflectionConverter.java:125)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convert(TreeUnmarshaller.java:56)
   at com.thoughtworks.xstream.core.AbstractReferenceUnmarshaller.convert(AbstractReferenceUnmarshaller.java:45)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:46)
   at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:117)
   at com.thoughtworks.xstream.core.ReferenceByXPathMarshallingStrategy.unmarshal(ReferenceByXPathMarshallingStrategy.java:29)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:846)
   at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:833)
   at com.thoughtworks.xstream.XStream.fromXML(XStream.java:789)
   at net.rptools.lib.io.PackedFile.getContent(PackedFile.java:138)
   at net.rptools.lib.io.PackedFile.getContent(PackedFile.java:123)
   at net.rptools.maptool.util.PersistenceUtil.loadToken(PersistenceUtil.java:400)
   at net.rptools.maptool.client.ui.assetpanel.ImageFileImagePanelModel.getTransferable(ImageFileImagePanelModel.java:98)
   at net.rptools.maptool.client.ui.assetpanel.AssetPanel$3.getTransferable(AssetPanel.java:261)
   at net.rptools.lib.swing.ImagePanel.dragGestureRecognized(ImagePanel.java:395)
   at java.awt.dnd.DragGestureRecognizer.fireDragGestureRecognized(Unknown Source)
   at sun.awt.windows.WMouseDragGestureRecognizer.mouseDragged(Unknown Source)
   at java.awt.AWTEventMulticaster.mouseDragged(Unknown Source)
   at java.awt.Component.processMouseMotionEvent(Unknown Source)
   at javax.swing.JComponent.processMouseMotionEvent(Unknown Source)
   at java.awt.Component.processEvent(Unknown Source)
   at java.awt.Container.processEvent(Unknown Source)
   at java.awt.Component.dispatchEventImpl(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
   at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
   at java.awt.Container.dispatchEventImpl(Unknown Source)
   at java.awt.Window.dispatchEventImpl(Unknown Source)
   at java.awt.Component.dispatchEvent(Unknown Source)
   at java.awt.EventQueue.dispatchEvent(Unknown Source)
   at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:24)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
   at java.awt.EventDispatchThread.run(Unknown Source)

_________________
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12111
Location: Tampa, FL
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Tue Jul 06, 2010 12:32 pm 
Yep, that's a common problem due to a format change on tokens added in b66 (I think). It's on my list to see if I can't add some backward compatibility but I'm not sure how likely that is. :(


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Tue Jul 06, 2010 12:47 pm 
Indeed. Forgot to mention it's created in build 70.

Just create a macro an a token and paste the posted code above in it. Same result (without errors I hope).

Ah wait I make use of getinfo(campaign) which is from a pretty late mt build, not sure but could be b69?

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Dragon
 
Joined: Fri Dec 18, 2009 2:33 am
Posts: 382
Location: San Diego
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Tue Jul 06, 2010 1:55 pm 
OK, no problem. Just good to know that it doesn't work in older builds.

I use b70 right now for my own games, just still using b63 for creating Drop-In Resources so that others can use them.

_________________
"Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed."
- G. K. Chesterton

Wonderful HTML/CSS reference * Color Manager * Token Manager 2.0


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1762
Location: Chicagoland
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Tue Jul 06, 2010 10:01 pm 
Awesome, finally my light sources in alphabetic order! woot!

Not to mention, much easier to set via one Campaign macro. (Not sure why you said it doesn't work there? If you check the "Apply to selected token" it works. Although if you have multiple selected tokens, you get a prompt for each one.

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Wed Jul 07, 2010 5:14 am 
JamzTheMan wrote:
Awesome, finally my light sources in alphabetic order! woot!

Not to mention, much easier to set via one Campaign macro. (Not sure why you said it doesn't work there? If you check the "Apply to selected token" it works. Although if you have multiple selected tokens, you get a prompt for each one.


indeed :oops: It's been quite a while since the last time ive set a macro on the campaign panel, so I just forgot that you have to set it to selected token....

Would it be nicer if in case of multiple select, all tokens are set at the same time? So the changes are applied to all selected tokens at once. I think thats relatively easy to make.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Great Wyrm
 
Joined: Mon May 10, 2010 11:59 am
Posts: 1762
Location: Chicagoland
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Wed Jul 07, 2010 7:26 pm 
wolph42 wrote:
JamzTheMan wrote:
Awesome, finally my light sources in alphabetic order! woot!

Not to mention, much easier to set via one Campaign macro. (Not sure why you said it doesn't work there? If you check the "Apply to selected token" it works. Although if you have multiple selected tokens, you get a prompt for each one.


indeed :oops: It's been quite a while since the last time ive set a macro on the campaign panel, so I just forgot that you have to set it to selected token....

Would it be nicer if in case of multiple select, all tokens are set at the same time? So the changes are applied to all selected tokens at once. I think thats relatively easy to make.


Yes, that would be great. For bonus points, maybe add a checkbox at the bottom that defaults to checked, "Apply to all Selected Tokens"? That is, if someone would like it to function as it does now?

Also, one that changes "Sight" to would be great. I constantly have to change the sight on my PC's when they activate powers/spells that grant enhanced vision.

_________________
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Thu Jul 08, 2010 12:39 am 
AFAIK there are no script functions available to set sight. So a no go there. I'll have a look at the rest.
edit:correction, there are functions to set it. I'll delve into it.

I've also thought about the checkbox set for all selected, but I think that should be the default, as it currently works is rather confusing (with multiple selection) so if I can change it I'll do it without the checkbox.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Thu Jul 08, 2010 5:17 am 
hmm I thought that would be easy, but it doesnt work and I don't see why, maybe someone can shed some light on this.

Code:
<!--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-->
[h:i=0]
<!----------------------------------------------NEW--------------------------------------------->
[h: ids = getSelected()]
<!----------------------------------------------NEW--------------------------------------------->
[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)]
        [lightSetting = eval("Lamp"+i+"S"+roll.count)]
<!----------------------------------------------NEW--------------------------------------------->     
        [h, foreach(id, ids, ""): setLight(lightSet,light,lightSetting)]
<!----------------------------------------------NEW--------------------------------------------->
    }]
    [h:i=i+1]
}]


<!-- if removeAll was checked, clear all lights -->
[H, if(removeAll): clearLights()]
I've marked the new spots

And here the the marked spots:
Code:
[h: ids = getSelected()]

and
Code:
[h,COUNT(nlightSetList),CODE:{
        [light = listGet(lightSetList,roll.count)]
        [lightSetting = eval("Lamp"+i+"S"+roll.count)]
        [h, foreach(id, ids, ""): setLight(lightSet,light,lightSetting)]
    }]

AFAIK this should work, but
1. it does not update every selected token
2. it keeps creating a new interface for every selected token
Anyone any suggestions?

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Fri Mar 18, 2011 7:25 am 
I just came accross this once again and noticed my last post. Seem I've learned a lot in a year still. Anyway I know why it doesn't work and the only way to get it to work is by adding another CODE layer, which can't because its already at two levels, or adding an exta UDF, but that would defeat the drop-in purpose.

alas.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Site Admin
 
Joined: Mon Jun 12, 2006 12:20 pm
Posts: 12111
Location: Tampa, FL
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Fri Mar 18, 2011 6:57 pm 
wolph42 wrote:
the only way to get it to work is by adding another CODE layer

Another option is to not do the work inside the loop, but merely keep track of what work needs to be done. Then when the existing loop is all done, loop around again in a separate one and do what you need to do.

The ugliest way to do that (!) would be to build a string that has the commands in it and execute it using eval later on. But that's an ugly hack. Another option would be to build a JSON object with one property per command to be executed and then use json.evaluate. This is still pretty ugly but much easier to actually implement (less hassle with quoting requirements).

Last, just keep a JSON array of objects/tokens that need to be processed later. Then a separate FOREACH that goes through the array can take care of it.


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Sat Mar 19, 2011 8:17 am 
Nice trick. Thnx az. When I'm not behind an iPhone il add it to the wiki

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9481
Location: Netherlands
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Sat Mar 19, 2011 11:25 am 
ok added basic page, will update later:

http://lmwcs.com/rptools/wiki/Working_W ... ODE_Levels

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS


Top
 Profile  
 
User avatar  Offline
Demigod
 
Joined: Mon Jun 29, 2009 9:37 am
Posts: 3108
Location: Germany
 Post subject: Re: Wolph42's drop in Light Source Editor
PostPosted: Sat Mar 19, 2011 12:33 pm 
Please emphase that its indeed not CODE what matters but {}.

So if people write {myVar} instead of [r:myVar] they might run into this problem as well.

_________________
HELP: GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC.

most complete list of my maptool stuff


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 1 guest





cron

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman