PDA

View Full Version : Using the Log in scripts?


Omini
09-10-2006, 08:06 PM
Is it possible to get the text from the log and do something with it? If possible, I'm guessing it'd be a requesttext(,) but I'm not sure. Any help would be appreciated.

Skyld
09-10-2006, 08:13 PM
I don't understand what you're trying to do.

Omini
09-10-2006, 08:20 PM
I want a script to read the log (F2) and if it reads it starting off with...

"PM: received from"

...it triggers an action.

Skyld
09-10-2006, 08:26 PM
I want a script to read the log (F2) and if it reads it starting off with...

"PM: received from"

...it triggers an action.
It doesn't need to be a requesttext(); since requesttext() is for asking the server for things.

Stefan could probably incorporate functionality for reading from the log window though. If you're looking to detect PMs, there are actual script functions for doing so clientside:
function onPM(obj)
{
echo(format("PM received from %s", obj.account));
}

Omini
09-10-2006, 09:44 PM
Oooh, that's how it's done. =) Thanks. Although incorporating functionality for reading from the log window could be helpful in some cases.

ApothiX
09-11-2006, 07:04 PM
I don't think reading directly from the log window would be great, but maybe an event that is triggered every time a message is written to it, ie:

function onLogWrite(text) {
// ...
}

Admins
09-13-2006, 02:22 AM
There is:

function onLogMessage(msg,colred,colgreen,colblue) {
}

The F2 window is scripted on Linux/Mac, the same like for the playerlist.

KuJi
09-13-2006, 08:59 AM
There is:

function onLogMessage(msg,colred,colgreen,colblue) {
}

The F2 window is scripted on Linux/Mac, the same like for the playerlist.

Wouldnt the scripted version work for Windows and be possible to disable the older one? Scripted would allow more functionality to it =D?

Skyld
09-13-2006, 10:22 AM
Wouldnt the scripted version work for Windows and be possible to disable the older one? Scripted would allow more functionality to it =D?
The scripted version would work for Windows, yes, however you would not have it external to the main window. The only thing that is on the scripted playerlist that is not on the Windows one is a feature I added some time ago, called 'Search for Player', where you can search for a nickname by typing in the account name.

ApothiX
09-13-2006, 11:59 PM
There is:

function onLogMessage(msg,colred,colgreen,colblue) {
}

The F2 window is scripted on Linux/Mac, the same like for the playerlist.
Hmm, I thought you told me awhile ago on Debug that it was impossible to change the color of the text outputted to the Log Screen? o_O

The scripted version would work for Windows, yes, however you would not have it external to the main window. The only thing that is on the scripted playerlist that is not on the Windows one is a feature I added some time ago, called 'Search for Player', where you can search for a nickname by typing in the account name.
That never seemed to work for me on Linux :(

Skyld
09-14-2006, 12:00 AM
That never seemed to work for me on Linux :(
Then I guess you typed an account which was not online, then.