Skip to content

Commit

Permalink
Added dependency check to sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scrivener07 committed Sep 17, 2017
1 parent 6f41a2f commit d047710
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions Data/Scripts/Source/FO4_Scopes/Fallout/ScopesTest/SampleScope.psc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ Scopes:Menu ScopeMenu

Event OnInit()
Player = Game.GetPlayer()
ScopeMenu = GetMenu()
RegisterForMenuOpenCloseEvent(ScopeMenu.Name)
TryFramework()
EndEvent


Event Actor.OnPlayerLoadGame(Actor akSender)
TryFramework()
EndEvent


Expand All @@ -40,6 +44,24 @@ Event OnKeyUp(int keyCode, float time)
EndEvent


; Properties
;---------------------------------------------

bool Function TryFramework()
ScopeMenu = GetMenu()
If (ScopeMenu)
UnregisterForRemoteEvent(Player, "OnPlayerLoadGame")
RegisterForMenuOpenCloseEvent(ScopeMenu.Name)
WriteLine(self, "Initialized")
return true
Else
RegisterForRemoteEvent(Player, "OnPlayerLoadGame")
WriteLine(self, "Scope framework is not installed.")
return false
EndIf
EndFunction


; Properties
;---------------------------------------------

Expand Down

0 comments on commit d047710

Please sign in to comment.