"This invocation calls a function that has the 'decides' effect, which is not allowed by its context."

You need to use set to assign a value to SongDuration. Try this: set SongDuration = GetRandomInt(MinDuration, MaxDuration)