Enabling and disabling via script

Post » Sat May 28, 2011 11:25 am

So I'm trying to set up a terminal to show a map on a wall. I have all the models needed but can't work out where I'm going wrong on the scripting side. My Map models are meant to be disabled or enabled depending on which one you click one in the terminal menu.

My script goes something like this:

If lhSatelitteDomeBlueprint01.getdisabled 0
lhSatelitteDomeBlueprint01.Disable
Endif
If lhSatelitteDomeEurope.getdisabled 0
lhSatelitteDomeEurope.Disable
Endif
If lhSatelitteDomeMoon.getdisabled 0
lhSatelitteDomeMoon.Disable
Endif
If lhSatelitteDomeWasteland.getdisabled 1
lhSatelitteDomeWasteland.Enable
Endif



Shouldn't this mean that all the others get disabled and lhSatelitteDomeWasteland gets enabled? I've placed this script in the terminal "Item result script" box. Was that right or do I need to link it to a quest or something?
Thanks in advance for the help =]
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am

Post » Sat May 28, 2011 6:58 pm

A few observations:

1. In forum posts with code, use the [ codebox ] and [ /codebox ] (without the spaces inside the brackets), and that will give you a nice window to work in.

2. When using IF commands, you either need to use an Operator; IF X == 0 for example, or in this case leave off the Operator and the value, which turns your IF conditional into a true/false boolean check; IF X

Example:

If lhSatelitteDomeBlueprint01.getdisabled == 0   lhSatelitteDomeBlueprint01.DisableEndifIf lhSatelitteDomeEurope.getdisabled == 0   lhSatelitteDomeEurope.DisableEndifIf lhSatelitteDomeMoon.getdisabled == 0   lhSatelitteDomeMoon.DisableEndifIf lhSatelitteDomeWasteland.getdisabled   lhSatelitteDomeWasteland.Enable 1Endif


3. I recommend putting your scripts into Cipscis' Script Validator, it will help you get cleaner looking and working code. Also browse his site, there are some great tutorials there.

Cheers,

Miax
User avatar
Your Mum
 
Posts: 3434
Joined: Sun Jun 25, 2006 6:23 pm

Post » Sat May 28, 2011 7:54 am

Cheers buddy :thumbsup:
User avatar
Hazel Sian ogden
 
Posts: 3425
Joined: Tue Jul 04, 2006 7:10 am

Post » Sat May 28, 2011 6:33 pm

Thanks for the mention, Miax! Just a small note I thought I'd add about your post:
1. In forum posts with code, use the [ codebox ] and [ /codebox ] (without the spaces inside the brackets), and that will give you a nice window to work in.

As you may have noticed in your own post, codebox not function exactly the same as code tags. This has been the case since the forum software was updated a while ago, along with a few other bugs like the fact that "OnActivate" and "OnLoad" are forced into lower case (I used CamelCase in the source for this post).

The solution that I use now when posting excessively long code is to wrap a code tag within a spoiler tag like this:
Spoiler
If lhSatelitteDomeBlueprint01.getdisabled == 0   lhSatelitteDomeBlueprint01.DisableEndifIf lhSatelitteDomeEurope.getdisabled == 0   lhSatelitteDomeEurope.DisableEndifIf lhSatelitteDomeMoon.getdisabled == 0   lhSatelitteDomeMoon.DisableEndifIf lhSatelitteDomeWasteland.getdisabled   lhSatelitteDomeWasteland.Enable 1Endif

Cipscis

EDIT:

Just in case you haven't found it on your own by now, my website can be found http://www.cipscis.com/, and my script validator is available http://www.cipscis.com/fallout/utilities/validator.aspx. I have links to specific scripting tutorials hosted there available in my signature (at the time I posted this, at least).

Cipscis
User avatar
Roddy
 
Posts: 3564
Joined: Fri Jun 15, 2007 11:50 pm


Return to Fallout 3