Use existing array to generate random quote in personal message? - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: Use existing array to generate random quote in personal message? (/showthread.php?tid=75156) Use existing array to generate random quote in personal message? by stu on 06-07-2007 at 08:37 PM
I have some javascript code that I use for my website to generate and display a random song lyric. Im wondering if it would be possible to use my existing code, shown below, with a script to show a random lyric as my personal message. I know there are other scripts out there that can do this, but seeing as I already have this set up and update it frequently, it would be great if I could use this code. Does anybody have any suggestions on how to do this or could write something up quick? Thanks for any help code: RE: Use existing array to generate random quote in personal message? by albert on 06-07-2007 at 10:10 PM
What you could do easily is to put your quotes in a text file, then read a certain amount of line generated by the random number, and set the personal message to display that line. It shouldn't be hard to do, I'll give it a try once I get my home computer started (I'm at work now.) RE: Use existing array to generate random quote in personal message? by albert on 06-08-2007 at 01:24 AM
Bump : code: Report any problems. RE: Use existing array to generate random quote in personal message? by stu on 06-08-2007 at 01:55 AM
Hey thanks for the reply. Yeah, I know that you can read quotes straight out of a text file like that, but thats not exactly what I am looking for. I have probably a couple hundred quotes using the code that I have posted above, and what I want to do, is have a script that will read the array out my already created .js script file. I would just rather have only one file with my quotes, and as I already have this one set up, would prefer to use it. RE: Use existing array to generate random quote in personal message? by albert on 06-08-2007 at 02:19 AM
You mind sending me that file? RE: Use existing array to generate random quote in personal message? by stu on 06-08-2007 at 02:33 AM Sure thing, I'll attach it here. Had to change to a .txt extension, wouldnt let me upload as .js. Its the exact same as what I had my first post though, only longer. Thanks for taking a look. RE: Use existing array to generate random quote in personal message? by albert on 06-08-2007 at 03:47 AM
Well Stu, the best I can do is attached with this post, what I did is simply copy/paste the array that you have created and then did a random search and then loaded the personal message with the random found string. RE: Use existing array to generate random quote in personal message? by stu on 06-08-2007 at 12:26 PM Ok, thanks a lot alby, its appreciated. I will use that for now anyways, if anyone else has any other ideas that would be great as well. Thanks RE: Use existing array to generate random quote in personal message? by stu on 06-09-2007 at 12:25 AM
Is there a way to read the entire file once its opened instead of just one line? code:If theres a way around that, I believe I could get a script to work with my own code Sorry for double post lol |