TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 20 of 20

Thread: How can I toggle an Anim Light set to “slide smoothly” at set intervals?

  1. #1
    Member
    Registered: May 2002
    Location: Academy City

    How can I toggle an Anim Light set to “slide smoothly” at set intervals?

    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 Tutorial for creating random events in DromEd, I think I can work this out.

    Sorry for asking prematurely!
    Last edited by MisakaMikoto; 6th Mar 2018 at 01:56.

  2. #2
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    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.

  3. #3
    Member
    Registered: May 2002
    Location: Academy City
    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.)

  4. #4
    Member
    Registered: May 2002
    Location: Academy City
    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
    Code:
    OmniLightPoint
    2. I add to it
    Code:
    S > Scripts
    
    Script 0: AnimLight
    Script 1: NVRelayTrap
    3. I add to it
    Code:
    Renderer > Anim Light
    
    mode: 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 > Light
    
    brightness: 0
    5. I add to it
    Code:
    Editor > Design Note
    
    NVRelayTrapOnDelay=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?)
    Last edited by MisakaMikoto; 6th Mar 2018 at 13:02.

  5. #5
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    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?

  6. #6
    Member
    Registered: May 2002
    Location: Academy City
    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?

  7. #7
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    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.

  8. #8
    Member
    Registered: May 2002
    Location: Academy City
    Thanks for pointing me in the right direction—and thank you for your patience. I do well with examples, pretty awfully with documentation.

  9. #9
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    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.

  10. #10
    Member
    Registered: May 2002
    Location: Academy City
    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.
    Last edited by MisakaMikoto; 6th Mar 2018 at 17:15.

  11. #11
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    Actually, I believe you will have to have two separate traps here. Your design note above of OnDelay=1000 and OffDelay=2000 won't work if you set it to repeat indefinitely, as the On will be firing every second and will trample the Off firing every 2 seconds. Give me a bit and I'll figure out a solution. I assume you still want it to stay off for 6 seconds before coming back on?

  12. #12
    Member
    Registered: May 2002
    Location: Academy City
    Yeah, what I’m actually aiming for is this:

    • 16 lights.

    • Starting as soon as the mission begins and continuing in perpetuity, all lights will be lit in the following pattern: on for 2000 (fade in 1000, fade out 1000), then off for 6000.

    • However, light 2 will not initially turn on until 500 after light 1, and so forth (light 3 initially turns on 500 after light 2, etc.).

    If you have any insight, I appreciate it—but don’t feel as if you have to put yourself out over this! I finally worked out how to get the same effect in my blue room using 16 room brushes, a deaf/blind Keeper, and a TeleportTrap.

  13. #13
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    Here's a demo with the initial setup working: http://www.wearytaffer.com/storage/demo/LightDemo.mis

    It requires three script markers per light source. The reason for that is, the infinite repeating capability of NVRelayTrap requires a common delay between On and Off, so they have to be split into two traps. Then a third marker which is the initial 1000 delay for the TurnOff. You should be able to link the two main traps to multiple lights which would then have the same timing, or duplicate all three traps to have different timings on other lights. The single lever which fires it all on sim start need not be duplicated, it can just be linked to multiple instances of the setup as needed. Also, I got the fade in/out using smoothly dim for the anim light setting, and 1000 for the times to come on and off.

  14. #14
    Member
    Registered: May 2002
    Location: Academy City
    Dang. Wow.

    Thank you! This will be a tutorial all in itself.

    I’m very grateful for your having gone to all this trouble for me. Really—thank you very much.

  15. #15
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    No problem. I love figuring out how to do stuff like this for people, just ask Random_Taffer.

    Seriously though, there's probably a better, more elegant and concise way to do it that eludes me. Chances are NV or R Soul or Firemage or LarryG will come along with it.

  16. #16
    Member
    Registered: May 2006
    Location: Russia
    Why so complex?
    Just link to your light another object with TrigFlicker script on it and set its timing to 6000. It will turn on and off your light with desired interval.
    You just need to initiate this object first turning it on somehow.

  17. #17
    Desperately Dodgy Moderator
    Registered: Nov 2001
    Location: Fields of bluegrass
    Won't that turn it on for 3000 and then off for 3000? That's not what is wanted here.

  18. #18
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Yeah. I'm thinking that a setup like this might work:

    1. Marker with NVRelayTrap.
    NVRelayTrapOn="Sim"; NVRelayTrapOff="Null"; NVRelayTrapTOn="LightOn"; NVRelayTrapCount=1
    CD to the 1st light in the chain.

    2. 1st Light with Animlight, NVRelayTrap, NVRelayTrap2, and NVRelayTrap3.
    NVRelayTrapOn="LightOn"; NVRelayTrapTOff="TurnOn"; NVRelayTDest="[Me]"; NVRelayTrapDelay=7000;
    NVRelayTrap2Off="Null"; NVRelayTrap2TOn=TurnOff"; NVRelayTrap2TDest="[Me]"; NVRelayTrap2Delay=1000;
    NVRelayTrap3TDest=second_light_in_the_string; NVRelayTrap3Off=""Null"; NVRelayTrap3Delay=500; NVRelayTrap3TOn="LightOn"
    3. Each subsequent light is set up like 1st light, except for the last which doesn't need NVRelayTrap3, since it doesn't trigger any more lights.

    4. Your lights need to have the millisecs to brighten / dim set to 1000, and mode to minimum brightness.


    What this accomplishes:

    1. All lights are off at sim start.
    2. At sim start a "LightOn"message is sent to the 1st light.
    3. After 7 seconds the 1st light sends a "TurnOn" to itself, turning on the light via animlight.
    4. One second later, it sends a "TurnOff" to itself via the 2nd NVRelayTrap, i.e. just after a completed fade-in.
    5. This turns off the light and triggers the 1st NVRelayTrap to repeat in 7 seconds (1 second for the fade-out and then 6 seconds for darkness)
    6. Meanwhile, the "TurnOn" from step 3 triggers the third NVRelayTrap to send a "LightOn" message to the next light in the chain after half a second.

    I think this meets your requirements as I understand them with only one extra object and mostly copy pasted design notes for each light.
    Last edited by LarryG; 8th Mar 2018 at 01:52. Reason: MANY typos in design note

  19. #19
    Dóttirin klęšist oft móšur möttli
    Registered: Apr 2015
    Some Flicker Triggers should also work for intervals. You might check the setup of the lights in front of the mall in
    The Stupid Grimrock Quote Reloaded.

  20. #20
    Member
    Registered: May 2002
    Location: Academy City
    Wow, have I got a lot to learn. Thank you both (thank you all) for the programming tutorial.

    I actually have a bit of a programming background, but I couldn’t get a handle on the syntax here. This gives me a lot to go on—so, again, thank you very very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •