How can I toggle an Anim Light set to “slide smoothly” at set intervals? - by MisakaMikoto
MisakaMikoto on 6/3/2018 at 06:32
I have an Anim Light set to “slide smoothly”, with fade-in and fade-out times of 1000.
But I would like the light to turn entirely off for 6000 milliseconds in between these fade-ins and -outs.
I've searched the forum at some length, so I'm sorry if I've missed it (perhaps I didn't know what to search for)—how can I accomplish this?
If anyone could point me in the right direction, I'd appreciate it. Thanks!
Actually, now I think about it, I will need to have a couple of these staggered. In principle I would do so by starting the timer for one, then starting the timer for the next X seconds later, but having both on a (thus staggered) 8000-millisecond loop.
In fact I wonder whether a better way of doing this would be to have a guard patrolling my blue room among sixteen (I need sixteen staggered lights) TrolPts, each of which turns a light on and the previous light off. But that gets me quickly out of my depth. :(
Time to do some more research!
Okay, found an old copy I had saved of Komag's tutorial on traps. Together with (
http://www.ttlg.com/forums/showthread.php?t=90380) Tutorial for creating random events in DromEd, I think I can work this out.
Sorry for asking prematurely!
Yandros on 6/3/2018 at 16:23
This should be trivial to do with an NVRelayTrap from NVScript. Send a TurnOn every 8 seconds, and send TurnOff every 8 seconds on a 1 second delay.
MisakaMikoto on 6/3/2018 at 16:30
Ahaha, and I just got my Keeper-Walking-In-A-Perpetual-Circle room proof of concept working.
But your approach will save me objects and a lot of work linking the real thing, so thank you, thank you!
(And this way I got to learn how to use traps, too.)
MisakaMikoto on 6/3/2018 at 17:49
I'm sorry, this is going to seem stupid, but I'm not sure what I'm doing wrong.
0. I enter
Code:
script_load nvscript
1. I create an
2. I add to it
Code:
S >
ScriptsScript 0: AnimLight
Script 1: NVRelayTrap
3. I add to it
Code:
Renderer >
Anim Lightmode: maximum brightness
millisecs to brighten: 0
millisecs to dim: 0
max brightness: 128
min brightness: 0
inactive: no
4. I add to it
Code:
Renderer >
Lightbrightness: 0
5. I add to it
Code:
Editor >
Design NoteNVRelayTrapOnDelay=1000; NVRelayTrapOffDelay=2000
But all I get is an OmniLightPoint that shines steadily at 128 brightness.
Have I left out a required parameter in the Design Note?
Or am I not understanding how Anim Lights work?
I'm sorry; this must seem so ridiculously simple, but I've been at this solid since being pointed in this earlier direction, and I just can't grok how this works.
Thanks for any help anyone can provide. :(
Oh, also—yes, I know I was angling for a “slide smoothly” cycling on different timings, but I figured I'd start by just turning a light on and off to be sure I've got that right before I get all complicated and stuff.
When I do get more complex, I didn't get what option I would use to launch the script, say, 5000 milliseconds after mission start, but then have it cycle at 7000 off and 1000 on timings thereafter?
(Maybe I misread; I took the NVRelayTrapOnDelay and NVRelayTrapOffDelay to be the time elapsed before sending that signal, not the time elapsed before the script kicks in. Would I need a separate run-once script to start this script somehow?)
LarryG on 6/3/2018 at 18:44
What did you use in your design note for NVRelayTrapOn and for NVRelayTrapOff, and what is NVRelayTrapTDest set equal to? Is NVRelayTrapRepeat set equal to -1?
MisakaMikoto on 6/3/2018 at 18:52
The parameters above are the only ones I used. Should I use all four of those? I assumed that the default values of NVRelayTrapOn and NVRelayTrapOff were what I already wanted and so didn't specify them.
I didn't even realize about NVRelayTrapTDest; I read the “NVRelayTrap” section of the documentation and didn't see that; but now that I search for “dest” in the documentation I see the “NVTrigger scripts” section.
So I'll need to point that at "[me]", correct?
Also, I thought I just wanted to send the on message once, then the off message once, and so forth; but do I need to set NVRelayTrapRepeat=-1 instead?
Yandros on 6/3/2018 at 21:16
Either put all the relay stuff on a marker and link it to the light via ControlDevice, or set TDest to "[me]" as you noted. You have to tell it where to send the messages, in this case the light itself.
MisakaMikoto on 6/3/2018 at 21:22
Thanks for pointing me in the right direction—and thank you for your patience. I do well with examples, pretty awfully with documentation.
LarryG on 6/3/2018 at 21:44
1st. What message is to trigger the start of things for the "On" actions? Is this something that is supposed to be ongoing at the start of the game? Or is this something that is triggered by some event? You need an NVRelayTrapOn=some_message_string to get things started.
2nd. Similarly for the "Off" actions. You need an NVRelayTrapOff=some_message_string for those actions to start happening.
3rd. You need to tell the script what object to send the relayed messages to. That's NVRelayTrapTDest="[Me]" if you want the script hosting object to get them.
4th. You need to specify what message to send to the designated target object when an "On" message is received.
5th. Similarly for the "Off" message.
6th. Then there's all the foofrah of delays and repeats, and so on.
You may end up needing two NVRelayTrap scripts (NVRelayTrap and NVRelayTrap2) on your object in order to get things working as you want.
MisakaMikoto on 6/3/2018 at 22:01
1. Yes, supposed to be ongoing from the beginning of the game, for the duration.
2. Okay, so I need to explicitly say “NVRelayTrapOn="TurnOn"” and likewise for -Off? I thought that because those were the default values I didn't have to include them. Whoops . . .
3. Yeah, I messed that up, too. I thought that specifying no target would default to self.
4/5. And then this will also be a “TurnOn” message (and -Off)? Or am I going off track here?
7. Eww. I was afraid of that.