Page 1 of 2

[ [ Script ] ] Color Conversion + Light Manipulation

Posted: Tue Oct 28, 2014 7:47 pm
by NutJob
Out of Order

................

Posted: Wed Oct 29, 2014 5:28 pm
by NutJob
..................

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 5:39 pm
by Drakkan
errr... sory but what is this script for ? I can change light of color ? Do I need define object for it ? any examples ? How to do that ?

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 8:07 pm
by NutJob
Drakkan wrote:what is this script for ?
To dynamically change light colors, turn off particles, fade out lights with other scripts (that you make) using calculation instead of hard/hand-coding it into every script you want to manipulate lighting.
Drakkan wrote:I can change light of color ?
Yes, lighting color and pointLight color can be changed. Still trying to figure out particle colors. I think I've been looking in the wrong places to do this.
Drakkan wrote:Do I need define object for it ?
You don't.
Drakkan wrote:any examples ?
Sure

Code: Select all

library.script.GFX.light({"ceiling_light_20", "ceiling_light_21"}, "red") -- turn these two lights red
library.script.GFX.light({"ceiling_light_20", "ceiling_light_21"}, {"red","33ff21"}) -- turn the first light red, the second a light green
library.script.GFX.light("someLight_01", _, 0, 20000) -- fade out someLight_01 over 20 seconds
library.script.GFX.light("someLight_01", "purple", 0, 5000) -- turn  someLight_01 purple then fade it out over 5 seconds
library.script.GFX.light("someLight_01", _, 1, 2000) -- fade in someLight_01 over two second
library.script.GFX.light({"light01","light02","light03","light04","light05","light06","light07"}) -- toggle all 7 lights
library.script.GFX.light("someLight_01", "#3333ff", _, _, _, 0) -- shut off only the particle effects, the light stays AND was turned blue

-- too many permutations for examples but I hope you get the picture

Drakkan wrote:How to do that ?
Make a script_entity, rename the ID 'library'. That's it.

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 9:14 pm
by Drakkan
aaaah, I tried some of these examples and it is really wonderfull. I do not think I am able to use whole potencial of this, however still thanks a lot, I can use it for some riddles and will definitey credit you !

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 9:18 pm
by NutJob
Drakkan wrote:aaaah, I tried some of these examples and it is really wonderfull. I do not think I am able to use whole potencial of this, however still thanks a lot, I can use it for some riddles and will definitey credit you !
Groovy! And no worries about the credit. A reply of [gratitude|feedback|criticism{constructive|inflammatory}] in the thread you find any of my scripts works well enough. ~cheers~

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 9:28 pm
by Drakkan
NutJob wrote:
Drakkan wrote:aaaah, I tried some of these examples and it is really wonderfull. I do not think I am able to use whole potencial of this, however still thanks a lot, I can use it for some riddles and will definitey credit you !
Groovy! And no worries about the credit. A reply of [gratitude|feedback|criticism{constructive|inflammatory}] in the thread you find any of my scripts works well enough. ~cheers~
crediting you is the smallest thanks I can do right now. I will probably need some specific color changes / effect, will send you PM eventaully. Thanks once again.

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 9:52 pm
by NutJob
Drakkan wrote:will send you PM eventaully.
Anytime, but it has limitations and bugs currently until I get documentation. I'm sort of winging-it right now and hope to make it a lot more robust, feature rich, and applicable to other objects. Not just light. I was working on a strobe effect that can be applied to any light but removed it before copying it here. It [strobe] "sort of" worked but requires making a timer/script dynamically and was having some problems with it's destruction, too many timers populating, and some logic errors (mostly programmer error heh).

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 10:07 pm
by kelly11
what am i doing wrong. i made a script entity library and put your code into it. Then I made a ceiling light and named it someLight_01.. coupled a floor trigger to another lua script entity with the following code:

function somelight()
library.script.GFX.light({"someLight_01"}, "red") -- turn these two lights red

end

When I step on it I get the following message: attempt do index field pointlight a nil value ... behind this part of line in the script below ------------------------------> obj.pointlight:setColor(GFX.vec(xC))

any help would be apriciated: I am very new to this and trying to learn ..what does what .. etc

if forceFade ~= nil then
if forceFade == 1 then
obj.light:fadeIn(fadeOvertime)
obj.pointlight:fadeIn(fadeOvertime)
obj.particle:fadeIn(fadeOvertime)
else
obj.light:fadeOut(fadeOvertime)
obj.pointlight:fadeOut(fadeOvertime)
obj.particle:fadeOut(fadeOvertime)
end
end
if _colors ~= nil then
if _colors ~= nil then xC = _colors else xC = lastColor end
if xC ~= nil then
obj.pointlight:setColor(GFX.vec(xC))
obj.light:setColor(GFX.vec(xC))
lastColor = xC
end
end
end
end



end

Re: [ [ Script ] ] Color Conversion + Light Manipulation

Posted: Wed Oct 29, 2014 10:23 pm
by NutJob
kelly11 wrote:what am i doing wrong. i made a script entity library and put your code into it. Then I made a ceiling light
Which ceiling light? I suppose I never checked them all and perhaps(?) not all have 'pointlight' ... let me know. I assumed they all had it and it was the "glare" effect for realism. When I get back to my computer at home I'll do more testing. (at office atm)