Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   How do you make "something" go into a folder (logs)?? (https://forums.graalonline.com/forums/showthread.php?t=75748)

Switch 07-21-2007 07:27 PM

How do you make "something" go into a folder (logs)??
 
Ok I have this script I'm working on and I need some help.
I'm trying to log who does what and I know how, but I don't know how to put it in a text file.
If someone could tell me how I'd be really appreciative.

Chompy 07-21-2007 07:49 PM

PHP Code:

temp.log "Bob used a tool around 9 o'clock";
temp.file2 0;

temp.file.loadstring("path/to/file/name_here.txt");
if (
file.length() > 0) {
  
file2 filefile2 @= "," log;
  
file2.savestring("path/to/file/name_here.txt"0);
}else 
log.savestring("path/to/file/name_here.txt"0); 

didn't test it, but I think it should work

I think there are some in-built ones, will edit post when I find them
E:

PHP Code:

savelog(str)
savelog2(strstr


Switch 07-21-2007 08:05 PM

what's the str for?

DustyPorViva 07-21-2007 08:07 PM

Don't mean to hijack your thread or anything... but is there a way to save a log locally to the player's computer?

Chompy 07-21-2007 08:12 PM

Quote:

Originally Posted by DustyPorViva (Post 1333170)
Don't mean to hijack your thread or anything... but is there a way to save a log locally to the player's computer?

you can use loadstring and savestring on clientside and it will save inside graal/scriptfiles/SERVERNAME/

Switch 07-21-2007 08:17 PM

Quote:

Originally Posted by Chompy (Post 1333166)
PHP Code:

savelog(str)
savelog2(strstr


Now answer my question:
What's the str's for?

Inverness 07-21-2007 08:21 PM

Quote:

Originally Posted by Switch (Post 1333173)
Now answer my question:
What's the str's for?

filename (relative to the logs/ directory), and the text to save to log. Text is automatically timestamped.
ex: savelog2("stafftool.txt", "zomg h4x");

Chompy 07-21-2007 08:24 PM

Quote:

Originally Posted by Switch (Post 1333173)
Now answer my question:
What's the str's for?

PHP Code:

savelog("omg, someone hacked");
// serverside -> logs/ folder
// clientside -> F2 (Dunno if that has changed with V5)

savelog2("banklog.txt""Someone stole all the gralats from the nation bank of Graal.");
// Something like that, serverside only  will save to logs/gralats.txt 

and

not levels/logs/*
but logs/*

Switch 07-21-2007 08:24 PM

Quote:

Originally Posted by Inverness (Post 1333175)
filename (relative to the logs/ directory), and the text to save to log. Text is automatically timestamped.
ex: savelog2("stafftool.txt", "zomg h4x");

ty! you just made my day :D

Switch 07-21-2007 08:29 PM

Quote:

Originally Posted by Chompy (Post 1333178)
PHP Code:

savelog("omg, someone hacked");
// serverside -> logs/ folder
// clientside -> F2 (Dunno if that has changed with V5) 

and

not levels/logs/*
but logs/*

Ok but for the serverside, what file in the logs/ would it save as?
Also, it's the same with v5, just maybe in the Scripts section.

I know it's logs/* silly :p

Chompy 07-21-2007 08:31 PM

Quote:

Originally Posted by Switch (Post 1333184)
Ok but for the serverside, what file in the logs/ would it save as?
Also, it's the same with v5, just maybe in the Scripts section.

I know it's logs/* silly :p

savelog() serverside, hmm, not sure, try it? It saves it into 1 file all the time, logs.txt or something like that

Switch 07-21-2007 08:49 PM

Quote:

Originally Posted by Chompy (Post 1333185)
savelog() serverside, hmm, not sure, try it? It saves it into 1 file all the time, logs.txt or something like that

yeah prolly xD
hmm... im getting much better at scripting :D

Chompy 07-21-2007 08:52 PM

Quote:

Originally Posted by Switch (Post 1333192)
yeah prolly xD
hmm... im getting much better at scripting :D

Good to hear ^^


All times are GMT +2. The time now is 09:23 AM.

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