PDA

View Full Version : [Utility] Line Logger



Sirhiro
02-27-2012, 08:06 AM
Hello everyone,

This is a utility that will allow you to log all debug text and view it from a webpage at any time so you can always keep up with what's going on with your Simba activity.

It's a simple setup,

1.
In your directory where Simba.exe is create a batch file with the following contents:


@echo off
Title Simba - LineLogger
color 0f

echo LineLogger - Sirhiro
if exist {%~dp0\log.txt} (
del "%~dp0\log.txt"
) else (
echo Running...
simba >> log.txt


You will run Simba using this Batch file whenever you want to Log.

2.
In any script, paste this function anywhere that's not inside a procedure.


function LineLog(Filename, Usr, Scrpt : string) : TStringArray;
var
FileNum, h, i : integer;
s : string;
begin
WriteLn('[LL]: Starting!');
FileNum := OpenFile(Filename + 'log.txt', true);
ReadFileString(FileNum, s, FileSize(FileNum));
CloseFile(FileNum);
result := Explode(chr(10), s);
WriteLn('[LL]: Uploading...');
h := high(result);
i := InitializeHTTPClient(false, false);
posthttppage(i, 'nferno.org/log/upload.php?', 'lbl=' + s + '&usr=' + Usr + '&script=' + Scrpt);
freehttpclient(i);
s := '';
cleardebug;
WriteLn('[LL]: All Done!');
end;


And finally...

3.
Wherever you feel it should save and upload the log put the following call:


LineLog('Simba Directory', 'nickname', 'scriptname');

eg;


LineLog('C:\Program Files (x86)\Simba\', 'sirhiro', 'advgnomerunner');


For the sake of bandwidth put the call somewhere where it won't be called frequently. Like after a lap during agility or after banking from a full inventory.

4.
That's it! Now at anytime you can access your log file using
nferno.org/log/<nickname>-<scriptname>.css
EG: Here is a Sample (nferno.org/log/sample-test.css)
And yes, I did use *.CSS for the filetype because *.TXT is not allowed on my host and *.CSS keeps the line breaks for formatting.

Let me know what you think!
Also I wasn't sure what section to put this in? It applies specifically to Runescape related scripts and the output so I stuck it here in utilities instead of in Other Scripts.

Some Tips:

The only data uploaded is whatever is output into your debug console, nothing more.
It is not publicly displayed.
There is a filesize limit that if your log exceeds it will not upload
Uploading too rapidly will restrict access from this feature

Shatterhand
02-27-2012, 03:28 PM
Sounds interesting, will try it out. Thanks! :)