Need some help with scripting

Post » Tue Apr 05, 2011 1:13 pm

I worked an hour with this small object removing script but I can't make it working and the GECK says (Invalid variable name 'SwitchJD'.)
Here's the script:

scn WaterRemoveJDButton

short SwitchJD
ref jdwater

Begin OnActivate
set jdwater to GetActionRef
set SwitchJD to GetButtonPressed
if ( SwitchJD == 1 )
jdwater.Disable

endif
End
User avatar
maya papps
 
Posts: 3468
Joined: Mon Aug 07, 2006 3:44 pm

Post » Tue Apr 05, 2011 6:54 pm

I don't see why you should get that particular message. But GetActionRef returns the reference which is interacting with the button, presumably the player. I don't think you meant to disable the player. I suppose what you meant to do was disable some static object you placed in the render window. You need to give the name of that object. That object needs to be a persistent reference (check the checkbox when editing the object), and give it a name. Typically these names end in "Ref", such as JDWaterRef. Then in your script, use "JDWaterRef.disable".

Once you have that working, there is a more complicated approach you might consider using "linked references". In the editor, set the linked reference of the button, to the water. Then in the script, use "set jdwater to GetLinkedReference" and "jdwater.disable". This allows you to use the same script to have multiple linked sets of buttons and water objects.
User avatar
Javaun Thompson
 
Posts: 3397
Joined: Fri Sep 21, 2007 10:28 am

Post » Tue Apr 05, 2011 12:41 pm

I don't see why you should get that particular message. But GetActionRef returns the reference which is interacting with the button, presumably the player. I don't think you meant to disable the player. I suppose what you meant to do was disable some static object you placed in the render window. You need to give the name of that object. That object needs to be a persistent reference (check the checkbox when editing the object), and give it a name. Typically these names end in "Ref", such as JDWaterRef. Then in your script, use "JDWaterRef.disable".

Once you have that working, there is a more complicated approach you might consider using "linked references". In the editor, set the linked reference of the button, to the water. Then in the script, use "set jdwater to GetLinkedReference" and "jdwater.disable". This allows you to use the same script to have multiple linked sets of buttons and water objects.


thank you :D i'll try it :D
User avatar
Nicole Elocin
 
Posts: 3390
Joined: Sun Apr 15, 2007 9:12 am


Return to Fallout: New Vegas