Seeing your code you need to do more than that...
What you've been requesting in this thread is for an array which doesn't change.
Your code shows that you also change the array completely (the
which variable and use).
But in doing so, you actually make it yourself very hard...
The use of the random variable
which is wrong. You check upon it inside the
personalMessage() function each time you want to change the PSM. Way easier and way more efficient is that you check on it outside of the
personalMessage().
And according to what
which is, you create your
arrLyrics[] array.
So, instead, just make an array of only the lyrics (the old case where
which is 1) or make an array of only all the external files (the old case where
which is 0), or make an array of everything (not currently implemented in your existing script, but extremely easy to do if you follow my advise
).... You don't need to have different arrays for everything, it is all the same array which you simply (re)create according to what you want... This is done in the
GetAllLyrics() function in my example code.
That is why it is there; it initializes the array you're going to use. And you call that function (
GetAllLyrics()) each time the user changes the script preferences (which I assume is what
which eventually will reflect).
So, since the array is created outside the
personalMessage() function, you don't need to bother to see from which array you draw a random line from. AND(!) the stuff you want (don't draw the same line for x times) will work.
Hence why I suggested to just rename your stuff instead. Because if you're going to change your code over time and make your code more efficient as you go, you would end up renaming your arrays and variables the same anyways...