Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-03-2006, 10:33 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
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?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #2  
Old 05-03-2006, 01:35 PM
Angel_Light Angel_Light is offline
Varia Developer
Angel_Light's Avatar
Join Date: Nov 2005
Location: Knoxville, TN
Posts: 1,684
Angel_Light is on a distinguished road
Send a message via AIM to Angel_Light Send a message via MSN to Angel_Light
This might help you if your trying to stream radio's in graal

Also, you can open it with wordpad
__________________
Deep into the Darkness peering...
Reply With Quote
  #3  
Old 05-03-2006, 07:52 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #4  
Old 05-03-2006, 08:59 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 05-03-2006, 09:00 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
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.
__________________
Skyld
Reply With Quote
  #6  
Old 05-03-2006, 11:53 PM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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.
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
Reply With Quote
  #7  
Old 05-03-2006, 11:57 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
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"

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.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #8  
Old 05-04-2006, 04:35 AM
Maniaman Maniaman is offline
Registered User
Join Date: Aug 2005
Posts: 326
Maniaman is on a distinguished road
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.
__________________

Current Maloria Event: (click to go to it)
Reply With Quote
  #9  
Old 05-04-2006, 09:08 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
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.
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #10  
Old 06-30-2006, 08:46 AM
Raeiphon Raeiphon is offline
I never asked for this.
Join Date: Jun 2005
Posts: 855
Raeiphon is on a distinguished road
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?
__________________

I hope for nothing. I fear nothing. I am free.
Reply With Quote
  #11  
Old 06-30-2006, 10:42 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
Rephrase your question. It's... Confusing.
Reply With Quote
  #12  
Old 06-30-2006, 01:14 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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).
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:47 AM.


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