Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Splitting a .txt file into lines (https://forums.graalonline.com/forums/showthread.php?t=65814)

Raeiphon 05-03-2006 10:33 AM

Splitting a .txt file into lines
 
Basically, what I want to do, is to open a file (it's a .pls file but can be read by notepad) and split each line of it into an array, so I can use that array. I'm totally stumped on where to with this, what should I do? Could somebody help me?

Angel_Light 05-03-2006 01:35 PM

This might help you if your trying to stream radio's in graal

Also, you can open it with wordpad

napo_p2p 05-03-2006 07:52 PM

Quote:

Originally Posted by Angel_Light

Yes, check that if you are wondering about radio streams (because it seems like you are).

But, there is a way to load the lines of a file into an array (I am not sure if it works with .pls, but if it opens in notepad it probably will).

Try something like:
PHP Code:

this.foo.loadlines("path/to/file.pls"); 

And tada! 'this.foo' will be an array where every member represents one line of the file.

ApothiX 05-03-2006 08:59 PM

file extension doesn't matter, you can .loadlines() a .exe file, and it would still work, just wouldn't get the data you'd think you would.

Skyld 05-03-2006 09:00 PM

Quote:

Originally Posted by ApothiX
file extension doesn't matter, you can .loadlines() a .exe file, and it would still work, just wouldn't get the data you'd think you would.

I don't think Graal's reading functions are binary-safe! You may explode Graal.

napo_p2p 05-03-2006 11:53 PM

Quote:

Originally Posted by ApothiX
file extension doesn't matter, you can .loadlines() a .exe file, and it would still work, just wouldn't get the data you'd think you would.

I don't think loadlines() works on .graal files and graphics.

ApothiX 05-03-2006 11:57 PM

Quote:

Originally Posted by Skyld
I don't think Graal's reading functions are binary-safe! You may explode Graal.

That's what I meant by "just wouldn't get the data you'd think you would" :p

Quote:

Originally Posted by napo_p2p
I don't think loadlines() works on .graal files and graphics.

File extension doesn't matter on them. It may have something to do with the folder config if it can't load those files for some reason, but all .graal files are anyway, are text files with certain things on certain lines.

Maniaman 05-04-2006 04:35 AM

You can load pretty much any file with loadlines. I have used it many time to aod the contents of .nw files to add level links and stuff.

Raeiphon 05-04-2006 09:08 AM

Yeah, it works. I'm scripting a play class that'll open .aac files, as 24k is much more friendly for the people on 126k who lag when 96k .pls starts playing. Thanks for the help.

Raeiphon 06-30-2006 08:46 AM

One last thing, does loadlines load from a url if I specify that as the file, or do I need to have it saved as a var through requestURL for it to work?

Novo 06-30-2006 10:42 AM

Rephrase your question. It's... Confusing.

Admins 06-30-2006 01:14 PM

There was an example here: http://forums.graalonline.com/forums...ad.php?t=64166
It is loading a playlist, but you can also load other files, just modify the onData function (and remove onTimeout and onMusicDataReceived).


All times are GMT +2. The time now is 10:45 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.