Making a Custom Lamp (on/off)

Post » Tue Nov 30, 2010 6:44 am

Hi, I have made a lamp but need to know if I can activate it so it turns on and off whenever I click it. I have searched the forums for 'turning on lamps in the construction set' yet can't find this answer. Please help :)
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Tue Nov 30, 2010 3:23 pm

Try the http://cs.elderscrolls.com/constwiki/index.php/Light_switch_tutorial tutorial on the CS Wiki. It should be just what you need.
User avatar
Alkira rose Nankivell
 
Posts: 3417
Joined: Tue Feb 27, 2007 10:56 pm

Post » Tue Nov 30, 2010 1:13 am

With the below attached to the lamp, a switch could be made with a single activator rather than necessitating a pair as the tutorial suggests.

scn LampActivatorSCPTInt bLightsOnRef rLightBegin OnActivate	Set bLightsOn to (bLightsOn == 0)	If bLightsOn		If rLight			rLight.Enable		Else			Set rLight to PlaceAtMe TestLight		EndIf	Else		rLight.Disable	EndIfEnd

User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Tue Nov 30, 2010 7:28 am

Thank you guys for the replies :)

Vyper I will look at the link cheers!

Justin:

With the below attached to the lamp, a switch could be made with a single activator rather than necessitating a pair as the tutorial suggests.

scn LampActivatorSCPTInt bLightsOnRef rLightBegin OnActivate	Set bLightsOn to (bLightsOn == 0)	If bLightsOn		If rLight			rLight.Enable		Else			Set rLight to PlaceAtMe TestLight		EndIf	Else		rLight.Disable	EndIfEnd



Thanks for the script Justin.

My light is called aaCustomLampRef (that's the ref ID when I placed it in my home). Where should I put this name in the script??

EDIT: I replaced rlight with my custom name.

Also Justin, there was an error message with the 'blights on line 6', why is this happening?
User avatar
Gaelle Courant
 
Posts: 3465
Joined: Fri Apr 06, 2007 11:06 pm

Post » Tue Nov 30, 2010 2:20 am

scn LampActivatorSCPTshort bLightsOn


User avatar
John N
 
Posts: 3458
Joined: Sun Aug 26, 2007 5:11 pm

Post » Tue Nov 30, 2010 12:25 pm

Justin:



Thanks for the script Justin.

My light is called aaCustomLampRef (that's the ref ID when I placed it in my home). Where should I put this name in the script??

EDIT: I replaced rlight with my custom name.

Also Justin, there was an error message with the 'blights on line 6', why is this happening?


aaCustomLampRef: Neither the lamp nor light need to be persistent for the script to work. That will work without assigning editor ID's to the reference(s). If using a different light, just substitute TestLight with whatever base LIGH record want to use.

Error: Not sure. It compiles here as is and works in game. If you post what you've got together, I might be able to discern what went wrong. As utumno suggests, make sure the var name used matches the var name declared.
User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Tue Nov 30, 2010 5:58 am

Hi Justin, I just can't get the script to work. It always says 'error at line 6' which is frustrating. Thanks for trying though.
User avatar
Kelvin
 
Posts: 3405
Joined: Sat Nov 17, 2007 10:22 am

Post » Tue Nov 30, 2010 9:33 am

Hi Justin, I just can't get the script to work. It always says 'error at line 6' which is frustrating. Thanks for trying though.
Post it? Something went wrong with the implementation, evidently. A variation would work for the fireplace in your other thread.

scn FireplaceActivatorSCPTRef rFireInt bFireBegin OnActivate	Set bFire to (bFire == 0)	If bFire		If rFire			rFire.Enable		Else			Set rFire to PlaceAtMe ActivatorFlameNode6 ; might need positioning		EndIf	Else		rFire.Disable	EndIfEnd

User avatar
Suzy Santana
 
Posts: 3572
Joined: Fri Aug 10, 2007 12:02 am

Post » Tue Nov 30, 2010 8:03 am

Post it? Something went wrong with the implementation, evidently. A variation would work for the fireplace in your other thread.
Do post the script
@Justin:
scn FireplaceActivatorSCPTRef rFireInt bFire    ; shouldn't it be short ? does it compile with int ? news to me !			Set rFire to PlaceAtMe ActivatorFlameNode6 ; No PlaceAtMe with activators - use moveto with a persisten ref - Rowdy will be bloating our saves soon lol

User avatar
Melly Angelic
 
Posts: 3461
Joined: Wed Aug 15, 2007 7:58 am

Post » Tue Nov 30, 2010 11:17 am

Utumno, what do you mean 'rowdy will be bloating our saves?'

Justin, as for the script, I just used exactly what you posted here, why would I need to re-post it? Makes no sense.

Anyway, I went with the fireplace script that was provided in the other thread. It worked flawlessly :)
User avatar
Skrapp Stephens
 
Posts: 3350
Joined: Mon Aug 06, 2007 5:04 am

Post » Tue Nov 30, 2010 4:13 am

Utumno, what do you mean 'rowdy will be bloating our saves?'

Justin, as for the script, I just used exactly what you posted here, why would I need to re-post it? Makes no sense.

Anyway, I went with the fireplace script that was provided in the other thread. It worked flawlessly :)

actually it is quite serious : http://cs.elderscrolls.com/constwiki/index.php/PlaceAtMe - your case is exactly the activator one :nono:
User avatar
Hella Beast
 
Posts: 3434
Joined: Mon Jul 16, 2007 2:50 am

Post » Tue Nov 30, 2010 1:24 pm

actually it is quite serious : http://cs.elderscrolls.com/constwiki/index.php/PlaceAtMe - your case is exactly the activator one :nono:


How can turning a fireplace on/off (it doesn't use placeatme btw) cause game bloat?

I've been using this script for my fireplace instead of a light:

scn aaMyFireplaceScript

Short FireState

Begin onactivate
If ( FireState == 1 ) ; On
Set FireState to 0
[FireRef].Disable
ElseIf ( FireState == 0 ) ; Off
Set FireState to 1
[FireRef].Enable
EndIf
End
User avatar
Jason Wolf
 
Posts: 3390
Joined: Sun Jun 17, 2007 7:30 am

Post » Tue Nov 30, 2010 7:01 am

How can turning a fireplace on/off (it doesn't use placeatme btw) cause game bloat?

I've been using this script for my fireplace instead of a light:

scn aaMyFireplaceScript

Short FireState

Begin onactivate
If ( FireState == 1 ) ; On
Set FireState to 0
[FireRef].Disable
ElseIf ( FireState == 0 ) ; Off
Set FireState to 1
[FireRef].Enable
EndIf
End
ah ok - you said you were using justin's script which contained the line
Set rFire to PlaceAtMe ActivatorFlameNode6 ; might need positioning

:shrug:
User avatar
Jennifer May
 
Posts: 3376
Joined: Thu Aug 16, 2007 3:51 pm

Post » Tue Nov 30, 2010 11:42 am

Yes I should have been clearer, my bad.

I was originally using Justin's script but it was too problematic. I am grateful for the info though, it's just I couldn't get it to work. CDM's script (which I posted above) worked perfectly.
User avatar
Emerald Dreams
 
Posts: 3376
Joined: Sun Jan 07, 2007 2:52 pm

Post » Tue Nov 30, 2010 12:18 pm

Do post the script
@Justin:
scn FireplaceActivatorSCPTRef rFireInt bFire    ; shouldn't it be short ? does it compile with int ? news to me !			Set rFire to PlaceAtMe ActivatorFlameNode6 ; No PlaceAtMe with activators - use moveto with a persisten ref - Rowdy will be bloating our saves soon lol

It both compiles and works in game here. :shrug: Int/Long/Short vars behave identically (IsLongOrShort).

No PlaceAtMe with activators: If more than one fireplace activator were placed, there would need to be an additional persistent ACTI ref for each fireplace activator. I can't see too much bloat transpiring unless all fireplace static references were to be replaced with the activator versions or something. Too bad http://geck.gamesas.com/index.php/MarkForDelete didn't show up until Fallout 3 or...
Begin OnReset	If bFire	ElseIf rFire		rFire.MarkForDelete	EndIfEnd
...would wipe the slate clean. I wonder if OBSE could pull of an equivalent function? Maybe OBSE's DeleteReference is equivalent *tinkers*? If only a few fireplaces were placed, I wouldn't worry about it though as the script would only use PlaceAtMe once.

Edit: OBSE's DeleteReference seems to be working much like Fallout 3's MarkForDelete.

Utumno, what do you mean 'rowdy will be bloating our saves?'

Justin, as for the script, I just used exactly what you posted here, why would I need to re-post it? Makes no sense.

Anyway, I went with the fireplace script that was provided in the other thread. It worked flawlessly :)
Because it compiles and works here, so something must have changed or it would compile for you too. I'm just curious as to what. Glad to hear you've got things working though. :)
User avatar
Baylea Isaacs
 
Posts: 3436
Joined: Mon Dec 25, 2006 11:58 am

Post » Tue Nov 30, 2010 2:02 am

It both compiles and works in game here. :shrug: Int/Long/Short vars behave identically (IsLongOrShort).

No PlaceAtMe with activators: If more than one fireplace activator were placed, there would need to be an additional persistent ACTI ref for each fireplace activator.

Because it compiles and works here, so something must have changed or it would compile for you too. I'm just curious as to what. Glad to hear you've got things working though. :)

I had not noticed the placeatMe was only called once :whistling: - I will be looking into this Int thing - news to me :shrug:
nice script btw :)
User avatar
matt white
 
Posts: 3444
Joined: Fri Jul 27, 2007 2:43 pm

Post » Tue Nov 30, 2010 3:50 pm

Justin, even though the script didn't work for me and I found an alternative, I do want to thank you for your posts here. I do appreciate it :) that goes for the others who gave advice to, Vyper and Utunmo.
User avatar
Dewayne Quattlebaum
 
Posts: 3529
Joined: Thu Aug 30, 2007 12:29 pm


Return to IV - Oblivion