Light vision Illumination Generator Tool (Excel)

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Light vision Illumination Generator Tool (Excel)

Post by wolph42 »

so what you're saying is that:

Code: Select all

[h:status=input("Wpn|Assault Rifle, SMG, Machine Pistol|Choose Weapon to Display|LIST|SELECT=0")]
[h:abort(status)]
works (as it should be) and

Code: Select all

[h:status=input("Wpn|"+WeaponList +"|Choose Weapon to Display|LIST|SELECT=0")]
[h:abort(status)]

Doesn't...
you have a space before the + that might the problem, otherwise "WeaponList" is empty and that will generate "0". If it is empty, then its not properly assigned. Can you attach you latest campaign file?

User avatar
bmcoomes
Kobold
Posts: 23
Joined: Wed Jan 27, 2010 9:27 pm
Location: Ephrata, WA

Re: Light vision Illumination Generator Tool (Excel)

Post by bmcoomes »

nope not even that works, If I go to just:

Code: Select all

[h, if(hasLightSource("Automatics", "SMG"+" Medium")), CODE:{
   [h: setLight("Automatics", "SMG"+" Medium", 0)]
   };{
   [h: setLight("Automatics", "SMG"+" Medium", 1)]
}]
it'll give me the range aura of the SMG medium range. Then if I add the status and make the wpn+ change I'll get the pull down for those weapons but won't get the aura to turn on:

Code: Select all

[h:status=input("Wpn|Assault Rifle, SMG, Machine Pistol|Choose Weapon to Display|LIST|SELECT=0")]
[h:abort(status)]
Here is the latest campaign file.
Attachments
Testing.cmpgn
(23.69 KiB) Downloaded 89 times


User avatar
bmcoomes
Kobold
Posts: 23
Joined: Wed Jan 27, 2010 9:27 pm
Location: Ephrata, WA

Re: Light vision Illumination Generator Tool (Excel)

Post by bmcoomes »

OK making some ground, I can get the second half to work. If I list the weapons in the input macro. But I can get the getLibProperty to work.

the drop pop's up but it only shows "0" to be listed.
Attachments
Testing.cmpgn
(23.62 KiB) Downloaded 116 times

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Light vision Illumination Generator Tool (Excel)

Post by wolph42 »

Ok got it!
This is highly annoying and it actually feels like a bug, but I understand where it comes from. I've encountered this problem as well and it took me ages to figure it out: the property must be empty by default. And then you need to fill it in the libtoken. If the value of the property == default value, getlibprop returns nothing!!


User avatar
bmcoomes
Kobold
Posts: 23
Joined: Wed Jan 27, 2010 9:27 pm
Location: Ephrata, WA

Re: Light vision Illumination Generator Tool (Excel)

Post by bmcoomes »

OK, but what does that mean? I added the extra = now it asks for the value to be input-ed if I say "SMG" it gives me the error "java.lang.NullPointerException error executing expression WeaponList == getLibProperty("WeaponLibrary", "Lib:SR4")."

Nevermind, after a cup of coffee and rereading the post it made sense.
Thanks, now on to filling the rest of it out.
I'd like to say thank you again for having to hold my hand through this.

User avatar
bmcoomes
Kobold
Posts: 23
Joined: Wed Jan 27, 2010 9:27 pm
Location: Ephrata, WA

Re: Light vision Illumination Generator Tool (Excel)

Post by bmcoomes »

OK it's up and running Great! as a token macro (I think I'm using that right) but I'm now trying to work it so it'll run as a campaign macro which I used the

Code: Select all

/self [MACRO("RangeCheck@Lib:SR4"):""]
And it works in that I can choos from the drop down the weaons then it breaks when hits the If().
This is what it gives me:
"Invalid condition in IF(hasLightSource("Automatics", Wpn+" Short")) roll option.
Statement options (if any): h, if(hasLightSource("Automatics", Wpn+" Short")), CODE
Statement Body (first 200 characters): { [h: setLight("Automatics", Wpn+" Short", 0)] [h: setLight("Automatics", Wpn+" Medium", 0)] [h: setLight("Automatics", Wpn+" Long", 0)] [h: setLight("Automatics", Wpn+" Extreme", 0)]"


User avatar
bmcoomes
Kobold
Posts: 23
Joined: Wed Jan 27, 2010 9:27 pm
Location: Ephrata, WA

Re: Light vision Illumination Generator Tool (Excel)

Post by bmcoomes »

Nope, that was the issue. now it running smoothly.

Thanks again,


User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Light vision Illumination Generator Tool (Excel)

Post by aliasmask »

I'm just now starting to play with lighting. What formula to you do go from one color to the next? I was thinking of putting the conversion tool in MT where it creates the light configuration text for you there. I discovered making a light source that give the whole room shadow then working from there I add other light sources for effect.. lit fire, candle.. stuff like that. With the room shadow, the whole room is visible, just darkened from original background. I want to standardize the lighting effect colors because certain overlapping colors effect other light sources in certain ways.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Light vision Illumination Generator Tool (Excel)

Post by wolph42 »

What formula to you do go from one color to the next?
im not quite sure I understand the question. The formula I use to make the gradient in the above attached excel sheet contains a significant error, but nobody has complaint so far so I left it :D

What I do is pick a color (you can use any tool for that) and then use excel to calculate if downto 0 (black) like the campfire: 1#ffc400 2#f2ba00 3#e4af00 4#d7a500 5#c99b00 6#bc9000 7#ae8600 8#a17c00 9#947100 10#866700 11#795d00 12#6b5300 13#5e4800 14#513e00 15#433400 16#362900 17#281f00 18#1b1500 19#0d0a00 20#000000

What I did in the attached excel is take the WHOLE hex number and 'blackened' it step by step. What I should have done is do every channel seperately. Some colors will go bad with my tool. Unfortunately its quite a hassle to build a hex2dec function from scratch so I left it as is.

To break it down, in the above example you start out with ffc400 in channels this is ff c4 and 00. You decide the amount of steps you want, lets say 10, then calculate the amount you deduct of every channel per step:
ff = 255, one step down is 25 (255/10)--> 230 = E6
C4 = 196, one step down is 20 (196/10)--> 176 = B0
00 = 0 remains 0
The next color is E6B000
etc. way down to 000000

hope this helps

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Light vision Illumination Generator Tool (Excel)

Post by aliasmask »

Yeah, I did some research on this and see how the RGB is split in to channels. I wasn't completely sure what you were doing with your excel sheet, but I thought is was changing from 1 color to another color rather than just darkening it.

In my research if found this page: http://www.fiu.edu/~morriss/html/colorforms.html which explained the relations between some of the colors where the ratio of one hex set is important to maintain color but reduce the shade.
Unfortunately its quite a hassle to build a hex2dec function from scratch so I left it as is.
I know you mean for Excel, but this is what I do in MT.

But here is something related to Excel:

Code: Select all

HEX2DEC
See Also

Converts a hexadecimal number to decimal.

If this function is not available, and returns the #NAME? error, install and load the Analysis ToolPak add-in.

How?

On the Tools menu, click Add-Ins. 
In the Add-Ins available list, select the Analysis ToolPak box, and then click OK. 
If necessary, follow the instructions in the setup program. 
Syntax

HEX2DEC(number)

Number   is the hexadecimal number you want to convert. Number cannot contain more than 10 characters (40 bits). The most significant bit of number is the sign bit. The remaining 39 bits are magnitude bits. Negative numbers are represented using two's-complement notation.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Light vision Illumination Generator Tool (Excel)

Post by wolph42 »

lol. after nearly 20 years working in excel I am aware of the analysis tool pack. But the gesture is appreciated non the less. The problem is is that it doesn't exist for open office and certainly not for google docs. So I had to build the function from scratch to be of any help to this multi OS community. That is not to say that I could have done it any smarter, for once I only needed to build a function for a 2 digit number in stead of a 6 digit number which looks like this:
hex2dec

Code: Select all

=IF(ISERROR(INT((MID($D4,1,1)))),INT(CODE(MID($D4,1,1))-87),MID($D4,1,1))*16^5+IF(ISERROR(INT((MID($D4,2,1)))),INT(CODE(MID($D4,2,1))-87),MID($D4,2,1))*16^4+IF(ISERROR(INT((MID($D4,3,1)))),INT(CODE(MID($D4,3,1))-87),MID($D4,3,1))*16^3+IF(ISERROR(INT((MID($D4,4,1)))),INT(CODE(MID($D4,4,1))-87),MID($D4,4,1))*16^2+IF(ISERROR(INT((MID($D4,5,1)))),INT(CODE(MID($D4,5,1))-87),MID($D4,5,1))*16^1+IF(ISERROR(INT((MID($D4,6,1)))),INT(CODE(MID($D4,6,1))-87),MID($D4,6,1))
The other one is slightly more complicated (dec2hex) (and thats quite an understatement).

Building this straight into MT is another matter, i'm still rather n00bish on that front.

Interesting function you linked, that would mean that this excel thing of mine could be recreated in MT!

Post Reply

Return to “MapTool”