pndr Posted November 14, 2016 Share Posted November 14, 2016 (edited) I'm can read papyrus okay, but writing it is another story. I'm sure I have made a bunch of errors , so any help would be greatly appreciated. This script is based of the WorkshopLightboxScript that controls the build able light boxes. Scriptname AdamTimer extends WorkshopLightboxScript Event OnTimer(int aiTimerID) If aiTimerID == cyclingTimerID int cyclingType = GetValue(WorkshopLightboxCyclingType) as int if cyclingType == 1 iNewColor = Utility.RandomInt(0, LightColors.Length - 1) debug.trace(self + " pick random color " + iNewColor) iNewBrightness = Utility.RandomInt(0, LightBrightness.Length - 1) StartTimer(5) EndIf EndIfEndEventfunction SetColor(int iColor = -1, int iBrightness = -1, bool bStopCycling = true) if iColor == -1 iColor = GetValue(WorkshopTerminalLightColor) as int endif if iBrightness == -1 iBrightness = GetValue(WorkshopTerminalLightBrightness) as int endif ; set cycling type to 0 - no cycling if bStopCycling SetCyclingType(0) endif String animString = GetAnimString(iColor, iBrightness) if animString ; save color SetValue(WorkshopTerminalLightColor, iColor) SetValue(WorkshopTerminalLightBrightness, iBrightness) debug.trace(self + " setting color to " + animString) PlayAnimation(animString) endifendFunctionfunction SetCyclingTime(float cyclingTime) if cyclingTime <= 0 ; turn off SetValue(WorkshopLightboxCycling, 0) StartCycling(false) else SetValue(WorkshopLightboxCycling, cyclingTime) StartCycling(true) endifendFunctionfunction SetCyclingType(int cyclingType) SetValue(WorkshopLightboxCyclingType, cyclingType) if cyclingType == 0 StartCycling() endifendFunctionfunction StartCycling(bool bStart = true) ;/ float cyclingTime = GetValue(WorkshopLightboxCycling) if cyclingTime == 0 ; get and set default value cyclingTime = cylingTimeDefault endif if bStart && cyclingTime > 0 StartTimer(cyclingTime, cyclingTimerID) else ; cancel timer CancelTimer(cyclingTimerID) endif /;endFunctionfunction CycleToNextColor() int iCurrentColor = (GetValue(WorkshopTerminalLightColor) as int) int iCurrentBrightness = (GetValue(WorkshopTerminalLightBrightness) as int) iCurrentBrightness += 1 if iCurrentBrightness >= LightBrightness.Length iCurrentBrightness = 0 iCurrentColor += 1 if iCurrentColor >= LightColors.Length iCurrentColor = 0 endif endif SetColor(iCurrentColor, iCurrentBrightness, false)endFunction Edited November 14, 2016 by pndr Link to comment Share on other sites More sharing options...
Recommended Posts