Jump to content

Toggle Enable/Disable Using Terminal Scripts


Recommended Posts

Hello all,

 

So, I'm starting to get back into modding and thought I'd give a bit of scripting another go, but it fails to be interesting for me and I just cannot get my head around it. Basically, I'm creating an interior workshop, but I want some lights and other objects to be toggled on or off via a terminal. Now I could just create a bunch of sub menus and use a simple enable script, but I'd rather have a list of options and the ability to just select one and toggle an item on or off.

 

I've tried compiling something like this together in the terminal's papyrus section:

 

Event OnMenuItemRun(int auiMenuItemID, ObjectReference akTarget)
If (WorkshopIntOilLanternsREF.IsEnable())
WorkshopIntOilLanternsREF.disable()
Else
WorkshopIntOilLanternsREF.enable()
EndIf
endEvent

 

but as some might be able to tell, it doesn't work. What I get is:

 

TERM_InteriorWorkshopTermin_02005C2A_1.psc(7,0): no viable alternative at input 'Event'
No output generated for Fragments:Terminals:TERM_InteriorWorkshopTermin_02005C2A_1, compilation failed.

 

And that's my issue. So any help with this would be appreciated, whether that be giving me a script o copy and paste or just some pointers.

 

Thanks.

Link to comment
Share on other sites

If this is to be activated from a terminal menu item, you don’t need to include the Event. Terminals work from script fragments, and using an full script as you have won’t compile.

 

Try using only the if/else portion of your script:

If (WorkshopIntOilLanternsREF.IsEnabled())
            WorkshopIntOilLanternsREF.disable()
Else
       WorkshopIntOilLanternsREF.enable()
       EndIf

EDIT: just noticed that you have "IsEnable" in the first line of your "if" statement...that needs to be IsEnabled.

Edited by RedRocketTV
Link to comment
Share on other sites

If this is to be activated from a terminal menu item, you don’t need to include the Event. Terminals work from script fragments, and using an full script as you have won’t compile.

 

Try using only the if/else portion of your script:

If (WorkshopIntOilLanternsREF.IsEnabled())
            WorkshopIntOilLanternsREF.disable()
Else
       WorkshopIntOilLanternsREF.enable()
       EndIf

EDIT: just noticed that you have "IsEnable" in the first line of your "if" statement...that needs to be IsEnabled.

 

Thanks a lot RedRocketTV, I'll give it a whirl later and see what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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