Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Help With Savelines (https://forums.graalonline.com/forums/showthread.php?t=77884)

Switch 12-11-2007 02:27 AM

Help With Savelines
 
How do i get savelines() to save in a specified folder.
PHP Code:

savelines("levels/folder/stuffs/stuff.ini",0); 

I want it to save in the folder "levels/folder/stuffs/" as "stuff.ini", but instead it goes to "stuff.ini" and saves it into scriptfiles/ folder. How do I get itinto that "levels/folder/stuffs/" folder?

Current code:
PHP Code:

function onCreated(){
  
temp.array = new[2];
  
temp.array[0] = "hi";
  
temp.array[1]= "stuffs";
  
temp.array.savelines("levels/sunnyville/mud/mystuff.ini",0);



oo_jazz_oo 12-11-2007 04:07 AM

You need to make sure the npc server has folder rights to w/e your saving to.
rw levels/folder/stuffs/*
rw levels/sunnyville/mud/*

Switch 12-11-2007 04:38 AM

I did

Twinny 12-11-2007 04:40 AM

If it is saving the files to the scriptfiles folder, I'd say you didn't. Post your NPC-Server folder rights here.

Switch 12-11-2007 10:35 PM

NPC Code:
rw levels/esteria/mud/*
rw levels/mud/*
rw levels/sunnyville/mud/*


cbk1994 12-11-2007 11:07 PM

Quote:

Originally Posted by Switch (Post 1363351)
NPC Code:
rw levels/esteria/mud/*
rw levels/mud/*
rw levels/sunnyville/mud/*


I commonly have this problem. It's really annoying.

Go in this order, and if it doesn't work, go down the line. If it works, stop.

1) Restart the npc-server
/npcshutdown and /npcstart ... never use /npckill

2) Change the rights to rw levels/sunnyville/mud/*.ini ... sometimes this will fix it. (ALSO: There are some file types you can't save as, but I'm pretty sure .ini is okay ... did you try .txt or .arc?)

3) Try saving in a different folder to see if that works.

4) Get a global to restart the gserver ... this is a last resort, but usually fixes it.

5) Go cry a river. (just kidding)


Also, this once fixed this for me ... change the 0 to false, so you have something like
arr.saveLines( "dir/dir2/dir3/file.ini", false );

Switch 12-11-2007 11:12 PM

Well I don't really know that after the , does, can you tell me?

Edit: None of them worked, not even the "False", anyway. Haven't tried getting a global to restart gserver yet. But still can you tell me what after the , does?

cbk1994 12-11-2007 11:16 PM

Quote:

Originally Posted by Switch (Post 1363356)
Well I don't really know that after the , does, can you tell me?

Whether to overwrite the file.

true appends, false replaces.

PHP Code:

temp.arr = { "foo" };
temp.arr.saveLines"control/foo.txt"false ); 

Would replace whatever is in control/foo.txt with "foo".

PHP Code:

temp.arr = { "foo" };
temp.arr.saveLines"control/foo.txt"true ); 

would simply add "foo" to the end of whatever was already in that file, or replace it if nothing.

Generally you want to replace, but for logs, append.

Switch 12-12-2007 12:11 AM

Yeah this is a mud so it's gonna replace.
But still, it won't work. And after I realised I've been changing the rights on npcserver instead of (npcserver) [lol :p] I tried again, now it's not working AT ALL, not even to scriptfiles/

Kyranki 12-12-2007 12:46 AM

Silly duck, you need an object to actually parse the information to an ini file. I.E. An inifile object maybe and inikeys? o_O

Switch 12-12-2007 01:12 AM

Ah nevermind guys. After I found out and told you guys that I used npcserver instead of (npcserver) and it wasn't working, when I tried deleting it (in prep for changing it all to sunnyville instead of the combined) i noticed they were hidden. Thanks for the halp :D (Yes, I mean to say halp, DO NOT QUESTION ME!)

Edit: New error
The files always get hidden after being created in the folder it's supposed to go to. I always have to do /refreshfilelist to view them. Any suggestions?

cbk1994 12-12-2007 05:23 AM

Quote:

Originally Posted by Switch (Post 1363378)
Ah nevermind guys. After I found out and told you guys that I used npcserver instead of (npcserver) and it wasn't working, when I tried deleting it (in prep for changing it all to sunnyville instead of the combined) i noticed they were hidden. Thanks for the halp :D (Yes, I mean to say halp, DO NOT QUESTION ME!)

Edit: New error
The files always get hidden after being created in the folder it's supposed to go to. I always have to do /refreshfilelist to view them. Any suggestions?

This only tends to happen to me in levels/ subdirectories. If they're mud objects, get them out of levels/ anyway ...

I tend to get varying luck with this problem; sometimes it won't show them, but then the next few times after I refresh it may ...

Switch 12-13-2007 03:30 AM

Ah ok, thanks Chris :D

Also, how would I create it's own folder (main folder, like levels/ is a main folder)? I gace the NPC Server rights to it, put it in folderconfig as "file mud/*.txt" etc.... but it won't show as a main folder...

cbk1994 12-13-2007 03:42 AM

Quote:

Originally Posted by Switch (Post 1363523)
Ah ok, thanks Chris :D

Also, how would I create it's own folder (main folder, like levels/ is a main folder)? I gace the NPC Server rights to it, put it in folderconfig as "file mud/*.txt" etc.... but it won't show as a main folder...

First, get it out of folder config. That's only for things in levels/

Next, add it to yourself and place a file in it. Make sure it's added to the NPC-Server, and it should be working fine.

Switch 12-13-2007 04:09 AM

Thanks :D


All times are GMT +2. The time now is 12:17 PM.

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