Author Topic: Adding a delay to Turn Lights Off mod  (Read 2159 times)

Offline ekbalam

  • If there's nothing wrong with me...maybe there's something wrong with the universe!
  • Posts: 45
  • Cookies: 0
  • Carbonated Beverage Specialist
Adding a delay to Turn Lights Off mod
« on: September 07, 2009, 02:34:21 PM »
What I want to accomplish:
I want to be able to trigger the script but not have it run for 10 seconds or 20 seconds. This will give me time to switch to cinematic mode to position the ship for a video capture using FRAPS.

I'm using Patch_R's turn lights off script and have tried adding a "time.wait(10)" which doesn't seem to be recognized, a "time.sleep(10)" which pauses the entire program until the scripts runs (thus making it useless because I cannot switch to cinematic mode until it does) and adding a "while" loop that counts to 10 but BC doesn't like that as the script disappears from Saffi's menu.

What other tricks might I try?  :wtf

Offline teleguy

  • Posts: 363
  • Cookies: 53
Re: Adding a delay to Turn Lights Off mod
« Reply #1 on: September 07, 2009, 04:01:45 PM »
Use this:

Code: [Select]
Timer1 = MissionLib.CreateTimer(Libs.LibEngineering.GetEngineeringNextEventType(), __name__ + ".function", App.g_kUtopiaModule.GetGameTime() + X, 0, 0)
Just replace X with the desired delay and "function" with the function that you want to call once the time is up, in this case it's "light".


Offline ekbalam

  • If there's nothing wrong with me...maybe there's something wrong with the universe!
  • Posts: 45
  • Cookies: 0
  • Carbonated Beverage Specialist
Re: Adding a delay to Turn Lights Off mod
« Reply #2 on: September 08, 2009, 09:51:46 PM »
You are the man! It's not exactly what I had intended. But it actually works out better.

Bitchin', thanks!  :dance

Offline MLeo

  • Retired Staff
  • Posts: 3636
  • Cookies: 833
  • Software Simian
    • the Programming Pantheon
Re: Adding a delay to Turn Lights Off mod
« Reply #3 on: September 20, 2009, 07:19:25 AM »
A light weight approach would be to use a TGScriptAction_Create("module", "function") combined with TGSequence_Create() and pSequence.AddAction(theTGScriptAction, delay in half seconds) and then pSequence.Play()
I still can't read peoples minds, nor can I read peoples computers, even worse, I can't combine the two to read what is going wrong with your BC install...

"It was filed under 'B' for blackmail." - Morse, Inspector Morse - The dead of Jericho.