local datasrv = lgs.DataSrv
local linksrv = lgs.LinkSrv
local propsrv = lgs.PropertySrv

local selectedStory = 0
local MaxInt = 1

function Sim(msg)
  if msg.fStarting then
	if propsrv.Possessed(script.objid,'ScriptTiming') then
		MaxInt = propsrv.Get(script.objid,'ScriptTiming')
    selectedStory = datasrv.RandInt(0,MaxInt)
	linksrv.BroadcastOnAllLinks(script.objid,"TurnOn","ScriptParams",tostring(selectedStory))
	end
  end
  return true
end

