Question about closing doors with script

Post » Sat May 28, 2011 4:00 pm

I decided to try one of emmesharra's scripts but have found upon entering the cell i was getting excess lag here's the script

Begin CT_Closedoor_scriptShort ContVarfloat timer ;original script by Enmesharra ;if the door should happen to get messed up or if the player leaves the cell while a door is not finished ;closing itself this resets everything whenever the player enters the cellIf ( cellchanged > 0 )  	SetAtStart	Set ContVar to 0endifIf ( ContVar == 0 )	If ( OnActivate )		Activate		set ContVar to 1		set timer to 0	EndifElseif ( ContVar == 1 )	If ( OnActivate )	  ;if the player closes the door by hand		set timer to 6	Endif	set timer to timer + GetSecondsPassed	If timer > 5		Activate		set ContVar to 0	EndifEndifEnd


I'm not sure if the Setatstart command applies only to the door or to everything in the cell - if everything in the cell I'll need to comment out that section

The door shut nicely behind me btw but I suspect something is causing me a slowdown in the cell
User avatar
leni
 
Posts: 3461
Joined: Tue Jul 17, 2007 3:58 pm

Post » Sat May 28, 2011 2:25 pm

Although this particular script ought to run fine by the looks of it, it's still a good policy to have only one OnActivate command in a script.

I'm not sure if the Setatstart command applies only to the door or to everything in the cell - if everything in the cell I'll need to comment out that section
Both UESP and MSFD claim that it works by item. Then again, you always can try to comment it and find out for yourself.

The door shut nicely behind me btw but I suspect something is causing me a slowdown in the cell
One of popular debugging tricks is to stuff the script with commands like MessageBox "Debug point #1" (#2,#3,#4...) and see in game where it hiccups :D.
User avatar
GEo LIme
 
Posts: 3304
Joined: Wed Oct 03, 2007 7:18 pm


Return to III - Morrowind