Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Problem with loading string? (https://forums.graalonline.com/forums/showthread.php?t=134265551)

iBeatz 01-09-2012 09:39 PM

Problem with loading string?
 
For my script, I'm reading the contents of a text file and displaying it in a GUI.
However, for some bizzare reason, I can only load the contents of the text file using loadlines(). If I try loadstring(), it will not work. It won't even echo the second time at all.

PHP Code:

function onActionGetNews(){
  
  
temp.l.loadlines("levels/server_news.txt");
  echo(
"Lines: "@temp.l);
  
temp.s.loadstring("levels/server_news.txt");
  echo(
"String: "@temp.s);


Before you ask, the npcserver already has rw levels/*

fowlplay4 01-09-2012 11:04 PM

It's probably not displaying due to a line break: echo(temp.s.length()); to verify that.

iBeatz 01-09-2012 11:07 PM

Quote:

Originally Posted by fowlplay4 (Post 1681408)
It's probably not displaying due to a line break: echo(temp.s.length()); to verify that.

That echoes 20.
You're saying you can't load it as a string if it contains a line break?

fowlplay4 01-09-2012 11:13 PM

Quote:

Originally Posted by iBeatz (Post 1681409)
That echoes 20.
You're saying you can't load it as a string if it contains a line break?

I'm saying RC won't echo it. Consider sending it via PM to your RC.

Tolnaftate2004 01-09-2012 11:59 PM

Quote:

Originally Posted by fowlplay4 (Post 1681410)
I'm saying RC won't echo it. Consider sending it via PM to your RC.

You can also replace "\n" with "\r" if you REALLY want to echo.


All times are GMT +2. The time now is 07:48 AM.

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