Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Loadlines not working (https://forums.graalonline.com/forums/showthread.php?t=75697)

HolySheepy 07-19-2007 10:20 PM

Loadlines not working
 
Hi,

PHP Code:

function onCreated()
  {
  
this.myVar = new TStaticVar();
  
this.myVar.loadlines"levels/playerlist.txt" );
  
ec.ho(. th.i.s..myVar] );
  
findplayer"HolySheepy" ).sendpm"L" this.myVar );
  } 

it echoes nothing and only sends L as a pm
playerlist.txt is in levels/ Folder
/find playerlist.txt
playerlist.txt: downloadable, 213 byte, 2007-07-19 14:18:44

i also tried. "playerlist.txt" and without the tstaticvar thing
but it seems like it doesnt read the file

well for some reason it gave method not implented whn not pointing it lol

killerogue 07-19-2007 10:29 PM

Hello are you doing that just be to irritating? It's working. -.-

HolySheepy 07-19-2007 10:30 PM

it isnt
wait you mean the script or posting?

it hates echo lines :D

Angel_Light 07-19-2007 11:14 PM

make sure it's serverside not clientside

killerogue 07-20-2007 02:34 AM

You're declaring it an object when loadlines returns and array first off. You need to fix that! In short, remove the TStaticVar declaration because it COULD be causing problems.

Secondly, don't use this. static vars use temp. prefixes because they are temporary and are deleted when the function is over. Best for testing as that's seemingly what you're doing.

xXziroXx 07-20-2007 04:21 AM

You need to give rights to the (npcserver) for reading and writing of files.

1): /openrights (npcserver)
2): Set folder rights to:

PHP Code:

r levels/ *.txt 

If it doesn't work, try to disconnect the npcserver and then do /npcstart on RC (shouldn't be needed however).

HolySheepy 07-20-2007 09:21 AM

oh yeah, works
thanks
i always forget that the npc-serv needs rights :x

Inverness 07-20-2007 09:51 AM

Quote:

Originally Posted by killerogue (Post 1332695)
You're declaring it an object when loadlines returns and array first off. You need to fix that! In short, remove the TStaticVar declaration because it COULD be causing problems.

Secondly, don't use this. static vars use temp. prefixes because they are temporary and are deleted when the function is over. Best for testing as that's seemingly what you're doing.

TGraalVar.loadlines() does not return an array Mr. Smartass
PHP Code:

  file.loadlines(filename);
  if (
file.size() < 1) {
    return;
  } 

Line from my TIniFile and it works fine.

Second, TStaticVar would change nothing.

Third, dynamic variables are case-sensitive last time I checked, its usually best not to use capital letters in their names unless you're going to do the same for your whole server or you will get confused.

Twinny 07-20-2007 10:15 AM

Quote:

Originally Posted by Inverness (Post 1332801)
TGraalVar.loadlines() does not return an array Mr. Smartass

I always thought it line became a new array index...but eh: i don't use loadlines anyways.

Inverness 07-20-2007 11:07 AM

Quote:

Originally Posted by Twinny (Post 1332810)
I always thought it line became a new array index...but eh: i don't use loadlines anyways.

object.loadlines() does not return an array, it however converts the object its used on to an array, each index being a line.


All times are GMT +2. The time now is 01:26 PM.

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