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 01-18-2006, 11:57 PM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
savelines

Having trouble with savelines and the only thing I found from forum search is one thread that didnt quite explain it (Although i tried to user similar style).

Anyways I am trying to write to a file on the server, and when it creates the file it creates it as an empty file, and later nothing is added either.

I have tried it both clientside and serverside and the file created is 0kb

I have done it from the onCreated and onActionserverside.

Not so sure if this is a bug or If I am doing something wrong.

NPC Code:

function onActionServerside() {
if (params[0] == 0) {
write = params[1];
write.savelines("test.txt", 0);
}
}
//#CLIENTSIDE
function onplayerchats() {
test = player.chat;
triggeraction(playerx, playery, "serverside", "James/Test", 0, test);
}

Reply With Quote
  #2  
Old 01-19-2006, 12:20 AM
Yen Yen is offline
Banned
Yen's Avatar
Join Date: Oct 2005
Location: Nova Scotia, Canada
Posts: 1,085
Yen is an unknown quantity at this point
Send a message via AIM to Yen Send a message via MSN to Yen
That should work.
'write' may be predefined, that's the only reason I can think of for it not to work. You could also try sending player.chat directly, but I don't see why test would be predefined. :/
Reply With Quote
  #3  
Old 01-19-2006, 12:32 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Changed the variable names and have also sent player.chat directly as you suggested, I still am getting a 0 on the filesize, and nothing is being written.

This is not only on the serverside but clientside as well.

I also restarted my gserver and npcserver when i was testing this intially.
Reply With Quote
  #4  
Old 01-19-2006, 07:37 AM
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
It is possible that savelines only works with arrays.
__________________
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
  #5  
Old 01-19-2006, 04:45 PM
Sacred Shadow Sacred Shadow is offline
Developer
Join Date: Dec 2004
Posts: 129
Sacred Shadow is on a distinguished road
Try loading the lines before you save them.
Reply With Quote
  #6  
Old 01-19-2006, 06:49 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
May be you use savestring()
savelines() is saving an array, you would need to add() something before.
Reply With Quote
  #7  
Old 01-20-2006, 01:48 AM
Andy0687 Andy0687 is offline
Enigma
Join Date: Feb 2002
Posts: 1,072
Andy0687 is on a distinguished road
Quote:
Originally Posted by Stefan
May be you use savestring()
savelines() is saving an array, you would need to add() something before.
I didnt see this documented anywhere, guess now that its here this will help someone else, but yeah using an array did fix it.

Thanks
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 12:10 PM.


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