Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-19-2007, 10:20 PM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
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

Last edited by HolySheepy; 07-19-2007 at 10:38 PM.. Reason: unpunctation
Reply With Quote
  #2  
Old 07-19-2007, 10:29 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Hello are you doing that just be to irritating? It's working. -.-
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #3  
Old 07-19-2007, 10:30 PM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
it isnt
wait you mean the script or posting?

it hates echo lines
Reply With Quote
  #4  
Old 07-19-2007, 11:14 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
make sure it's serverside not clientside
__________________
Deep into the Darkness peering...
Reply With Quote
  #5  
Old 07-20-2007, 02:34 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
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.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #6  
Old 07-20-2007, 09:51 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by killerogue View Post
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.
__________________
Reply With Quote
  #7  
Old 07-20-2007, 10:15 AM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
Quote:
Originally Posted by Inverness View Post
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.
Reply With Quote
  #8  
Old 07-20-2007, 11:07 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by Twinny View Post
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.
__________________
Reply With Quote
  #9  
Old 07-20-2007, 04:21 AM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
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).
__________________
Follow my work on social media post-Graal:Updated august 2025.

Last edited by xXziroXx; 07-20-2007 at 09:25 AM..
Reply With Quote
  #10  
Old 07-20-2007, 09:21 AM
HolySheepy HolySheepy is offline
Registered User
Join Date: Apr 2007
Posts: 68
HolySheepy is on a distinguished road
oh yeah, works
thanks
i always forget that the npc-serv needs rights :x
Reply With Quote
Reply


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 04:15 PM.


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