Blacksteur83 Posted January 1, 2018 Share Posted January 1, 2018 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 ObjectReferenceObjectReference Property Light01 AutoObjectReference Property Light02 AutoObjectReference Property Light03 AutoObjectReference Property Light04 AutoEvent 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() EndIfEndEvent 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 More sharing options...
wim95 Posted January 1, 2018 Share Posted January 1, 2018 Utility.Wait(1.0) Link to comment Share on other sites More sharing options...
Blacksteur83 Posted January 1, 2018 Author Share Posted January 1, 2018 Thank you !! Link to comment Share on other sites More sharing options...
Carreau Posted January 1, 2018 Share Posted January 1, 2018 Event timer would also work. When the start timer function is called, you can set the time to pass before itâs Event OnTimer() is called. This event is Skyrimâs OnUpdate() Link to comment Share on other sites More sharing options...
Blacksteur83 Posted January 2, 2018 Author Share Posted January 2, 2018 Thank you. And do you know how i can add the same script multiple times on a button ? Because every time i try and add the script, it disappear from the list so i can't put it twice or more. Link to comment Share on other sites More sharing options...
Carreau Posted January 2, 2018 Share Posted January 2, 2018 You can only add a script to an object once. Youâll want to use an OnActivate event since this is a repeatable action. Every time the button is pressed, the event will run. It would be best to use utility.wait as well. Link to comment Share on other sites More sharing options...
Blacksteur83 Posted January 2, 2018 Author Share Posted January 2, 2018 ok thank you. Link to comment Share on other sites More sharing options...
BigAndFlabby Posted January 2, 2018 Share Posted January 2, 2018 (edited) 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 January 2, 2018 by BigAndFlabby Link to comment Share on other sites More sharing options...
Blacksteur83 Posted January 2, 2018 Author Share Posted January 2, 2018 (edited) 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 January 2, 2018 by Blacksteur83 Link to comment Share on other sites More sharing options...
Carreau Posted January 2, 2018 Share Posted January 2, 2018 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 falseyourButton.BlockActivate(false) The function is part of ObjectReference Link to comment Share on other sites More sharing options...
Recommended Posts