Jump to content

Recommended Posts

Hello,

I am currently creating a simple Script with a button and some lights. And i was wondering what was the command or function to use if i want to put a delay between the lights activation. I tried using wait or sleep but the script would not compile. And i don't know if i should create a function or use on already existing

 

Scriptname LightDelay extends ObjectReference

ObjectReference Property Light01 Auto

ObjectReference Property Light02 Auto

ObjectReference Property Light03 Auto

ObjectReference Property Light04 Auto

Event OnActivate(ObjectReference akActionRef)
If(Light01.IsDisabled())
Light01.enable()

Wait 1 second
Light02.enable()

Wait 1 second
Light03.enable()

Wait 1 second
Light04.enable()

Wait 1 second
Else
Light01.disable()
Light02.disable()
Light03.disable()
Light04.disable()
EndIf
EndEvent

 

Also is there a way to add the same script multiple times to the same buttons ?

Thanks you for the time.

Link to comment
Share on other sites

It might also be a good idea to disable activation while the script is running then re-enable it when done. that way the user can't screw things up spamming the activation. you might be able to use some default activation scripts. I'd have to look through the code to recheck. Edited by BigAndFlabby
Link to comment
Share on other sites

I tried to spam the button and of course it went bad. But i think it is not a really big issue because when you press just once after, the problem is fixed. Also i don't know how you can disable activation.

As you can tell i am new to scripting.

Edited by Blacksteur83
Link to comment
Share on other sites

Thereâs a function called BlockActivate(bool abBlocked, bool abHideActivateText). AbBlocked defaults to true and abHideActivateText defaults to false.

 

yourButton.BlockActivate() will disable the button from doing anything, but the activate text will still be there.

 

To reactivate, call the function and pass the argument false

yourButton.BlockActivate(false)

 

The function is part of ObjectReference

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...