Ok, so if I was to do it as you suggest, outside my personalMessage function I would check to see what which is.. But thats not how I want the script to work though. The reason the which statement is there, is for when the script calls the personalMessage function to get a new personal message, the function can choose, by using which, if its going to be a lyric, or using my example in the script, a joke. so instead of creating 3 functions, i just have the one. the 3 functions being one that gets called on when a new personal message is displayed that chooses either joke or lyric(which would be the which statement), and one for each, the lyric and joke. I want it to choose between a lyric and a joke each time that the script requests a new psm, and doing it outside of my function would not allow me to do so..
Anyways, I am only using the lyric method for now, I only have the which variable included for the future, if I decide to use that as well.
You keep on updating your post, lol..
quote:
And you call that function (GetAllLyrics()) each time the user changes the script preferences (which I assume is what which eventually will reflect).
No, I didnt plan on having the which variable user defined.. thats why it is set up like it is..
Anyways, I had a question. Where you have
quote:
// EXAMPLE START (get 20 lyrics)
arrLyrics = GetAllLyrics();
for (var i=0; i<20; i++) {
Debug.Trace('New lyric: ' + GetRandomLyric());
}
// EXAMPLE END
Does that go inside my personalMessage function, or outside it like everything else?
This is what the script debugging shows
code:
New lyric: A
New lyric: B
New lyric: E
New lyric: J
New lyric: D
New lyric: K
New lyric: Q
New lyric: R
New lyric: N
New lyric: O
New lyric: G
New lyric: I
New lyric: M
New lyric: S
New lyric: P
New lyric: H
New lyric: U
New lyric: X
New lyric: W
New lyric: C
arrLyrics - F,L,T,V,Y,Z,A,B,E,J,D,K,Q,R,N,O,G
arrPrevios: I,M,S,P,H,U,X,W,C
I added two more trace routines to show the arrays also.