Scriv07

JasperSwitchStatic

Apr 16th, 2016
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. ScriptName JasperSwitchStatic Extends ObjectReference
  2. ; v0.2 https://www.reddit.com/r/skyrimmods/comments/4eto2z/better_papyrusscripting_can_you_help/
  3.  
  4. ObjectReference[] Property References Auto
  5.  
  6. int Property Position
  7. int Function Get()
  8. return Current + 1
  9. EndFunction
  10. EndProperty
  11. int Current = -1
  12.  
  13.  
  14. Event OnActivate(ObjectReference akActionRef)
  15. If(References != none)
  16. int len = References.Length
  17. If(Position >= len)
  18. Current = -1
  19. EndIf
  20. Current += 1
  21. EnableSingle(References, Current)
  22. EndIf
  23. Endevent
  24.  
  25.  
  26. Function EnableSingle(ObjectReference[] akReferences, int aiElement) Global
  27. If(akReferences != none && aiElement >= 0)
  28. int len = akReferences.Length
  29. int idx = -1
  30. While((idx + 1) < len)
  31. idx += 1
  32. If(idx == aiElement)
  33. akReferences[idx].Enable()
  34. Else
  35. akReferences[idx].Disable()
  36. EndIf
  37. EndWhile
  38. EndIf
  39. EndFunction
Add Comment
Please, Sign In to add comment