MQ2 Log

Status
Not open for further replies.
The short answer is that no, there is not a log of what passes through your MQ window.

/mqlog is a command that logs any string to a file in a folder called "Logs" in your MQ folder. A good example is found in this macro, which I used to generate translations on what speed from MQ2Speed translated to what ingame speed.

Code:
|speed.mac

sub main
/declare starty int local ${Me.Y}
/declare startx int local ${Me.X}
/declare startz int local ${Me.Z}
/declare i int local
/declare j int local
/for i 5 to 10
/for j 1 to 9
/delay 1s
/speed ${i}.${j}
/if (${Me.Speed}==150.00) /speed ${i}.${j}
/echo Speed: ${i}.${j} = ${Me.Speed}
/mqlog Speed: ${i}.${j} = ${Me.Speed}
/next j
/warp loc ${starty} ${startx} ${startz}
/next i
/return

That returned the following, a file called "speed.mac.log". If you call /mqlog from a macro, that is what results. If you just enter it from a chat wnd, it will spew to the Macroquest.log.

Code:
[05/16/2006 06:25:24] Speed: 1.1 = 150.00
[05/16/2006 06:25:25] Speed: 1.2 = 207.14
[05/16/2006 06:25:26] Speed: 1.3 = 221.43
[05/16/2006 06:25:27] Speed: 1.4 = 235.71
[05/16/2006 06:25:28] Speed: 1.5 = 250.00
[05/16/2006 06:25:29] Speed: 1.6 = 264.29
[05/16/2006 06:25:30] Speed: 1.7 = 278.57
[05/16/2006 06:25:31] Speed: 1.8 = 292.86
[05/16/2006 06:25:32] Speed: 1.9 = 307.14
[05/16/2006 06:25:33] Speed: 2.1 = 321.43
[05/16/2006 06:25:34] Speed: 2.2 = 350.00
[05/16/2006 06:25:35] Speed: 2.3 = 364.29
[05/16/2006 06:25:36] Speed: 2.4 = 378.57
[05/16/2006 06:25:37] Speed: 2.5 = 392.86
[05/16/2006 06:25:38] Speed: 2.6 = 407.14
[05/16/2006 06:25:39] Speed: 2.7 = 421.43
[05/16/2006 06:25:40] Speed: 2.8 = 150.00
[05/16/2006 06:25:41] Speed: 2.9 = 150.00
[05/16/2006 06:25:42] Speed: 3.1 = 150.00
[05/16/2006 06:25:43] Speed: 3.2 = 150.00
[05/16/2006 06:25:44] Speed: 3.3 = 150.00
[05/16/2006 06:25:45] Speed: 3.4 = 0.00
[05/16/2006 06:25:46] Speed: 3.5 = 0.00
[05/16/2006 06:25:47] Speed: 3.6 = 0.00
[05/16/2006 06:25:48] Speed: 3.7 = 150.00
[05/16/2006 06:25:49] Speed: 3.8 = 150.00
[05/16/2006 06:25:50] Speed: 3.9 = 150.00
[05/16/2006 06:25:51] Speed: 4.1 = 150.00
[05/16/2006 06:25:52] Speed: 4.2 = 150.00
[05/16/2006 06:25:53] Speed: 4.3 = 0.00
[05/16/2006 06:26:53] Speed: 3.1 = 192.86
[05/16/2006 06:26:54] Speed: 3.2 = 492.86
[05/16/2006 06:26:55] Speed: 3.3 = 507.14
[05/16/2006 06:26:56] Speed: 3.4 = 521.43
[05/16/2006 06:26:57] Speed: 3.5 = 535.71
[05/16/2006 06:26:58] Speed: 3.6 = 150.00
[05/16/2006 06:26:59] Speed: 3.7 = 150.00
[05/16/2006 06:27:00] Speed: 3.8 = 578.57
[05/16/2006 06:27:01] Speed: 3.9 = 592.86
[05/16/2006 06:27:02] Speed: 4.1 = 150.00
[05/16/2006 06:27:03] Speed: 4.2 = 150.00
[05/16/2006 06:27:04] Speed: 4.3 = 650.00
[05/16/2006 06:27:05] Speed: 4.4 = 664.29
[05/16/2006 06:27:06] Speed: 4.5 = 678.57
[05/16/2006 06:27:07] Speed: 4.6 = 692.86
[05/16/2006 06:27:08] Speed: 4.7 = 707.14
[05/16/2006 06:27:09] Speed: 4.8 = 721.43
[05/16/2006 06:27:10] Speed: 4.9 = 735.71
[05/16/2006 06:27:11] Speed: 5.1 = 150.00
[05/16/2006 06:27:12] Speed: 5.2 = 150.00
[05/16/2006 06:27:13] Speed: 5.3 = 792.86
[05/16/2006 06:27:14] Speed: 5.4 = 807.14
[05/16/2006 06:27:39] Speed: 5.1 = 150.00
[05/16/2006 06:27:40] Speed: 5.2 = 778.57
[05/16/2006 06:27:41] Speed: 5.3 = 792.86
[05/16/2006 06:27:42] Speed: 5.4 = 807.14
[05/16/2006 06:27:43] Speed: 5.5 = 821.43
[05/16/2006 06:27:44] Speed: 5.6 = 150.00
[05/16/2006 06:27:45] Speed: 5.7 = 850.00
[05/16/2006 06:27:46] Speed: 5.8 = 864.29
[05/16/2006 06:27:47] Speed: 5.9 = 150.00
[05/16/2006 06:27:48] Speed: 6.1 = 892.86
[05/16/2006 06:27:49] Speed: 6.2 = 921.43
[05/16/2006 06:27:50] Speed: 6.3 = 935.71
[05/16/2006 06:27:51] Speed: 6.4 = 950.00
[05/16/2006 06:27:52] Speed: 6.5 = 964.29
[05/16/2006 06:27:53] Speed: 6.6 = 150.00
[05/16/2006 06:27:54] Speed: 6.7 = 992.86
[05/16/2006 06:27:55] Speed: 6.8 = 1007.14
[05/16/2006 06:27:56] Speed: 6.9 = 1021.43
[05/16/2006 06:27:57] Speed: 7.1 = 150.00
[05/16/2006 06:27:58] Speed: 7.2 = 1064.29
[05/16/2006 06:27:59] Speed: 7.3 = 1078.57
[05/16/2006 06:28:00] Speed: 7.4 = 1092.86
[05/16/2006 06:28:01] Speed: 7.5 = 1107.14
[05/16/2006 06:28:02] Speed: 7.6 = 1121.43
[05/16/2006 06:28:03] Speed: 7.7 = 150.00
[05/16/2006 06:28:04] Speed: 7.8 = 1150.00
[05/16/2006 06:28:05] Speed: 7.9 = 1164.29
[05/16/2006 06:28:06] Speed: 8.1 = 150.00
[05/16/2006 06:28:07] Speed: 8.2 = 150.00
[05/16/2006 06:28:08] Speed: 8.3 = 1221.43
[05/16/2006 06:28:09] Speed: 8.4 = 1235.71
[05/16/2006 06:28:10] Speed: 8.5 = 1250.00
[05/16/2006 06:28:11] Speed: 8.6 = 1264.29
[05/16/2006 06:28:12] Speed: 8.7 = 150.00
[05/16/2006 06:28:13] Speed: 8.8 = 150.00
[05/16/2006 06:28:14] Speed: 8.9 = 1307.14
[05/16/2006 06:28:15] Speed: 9.1 = 1321.43
[05/16/2006 06:28:16] Speed: 9.2 = 1350.00
[05/16/2006 06:28:17] Speed: 9.3 = 1364.29
[05/16/2006 06:28:18] Speed: 9.4 = 150.00
[05/16/2006 06:28:19] Speed: 9.5 = 150.00
[05/16/2006 06:28:20] Speed: 9.6 = 1407.14
[05/16/2006 06:28:21] Speed: 9.7 = 1421.43
[05/16/2006 06:28:22] Speed: 9.8 = 150.00
[05/16/2006 06:28:23] Speed: 9.9 = 1450.00
[05/16/2006 06:28:24] Speed: 10.1 = 150.00
[05/16/2006 06:28:25] Speed: 10.2 = 150.00
[05/16/2006 06:28:26] Speed: 10.3 = 1507.14
[05/16/2006 06:28:27] Speed: 10.4 = 1521.43
[05/16/2006 06:28:28] Speed: 10.5 = 1535.71
[05/16/2006 06:28:29] Speed: 10.6 = 1550.00
[05/16/2006 06:28:30] Speed: 10.7 = 1564.29
[05/16/2006 06:28:31] Speed: 10.8 = 0.00
[05/16/2006 06:28:32] Speed: 10.9 = 0.00

The 150's and 0's in there are from where the plugin resets your speed every 2 pulses.


Hope this helped.
 
MQ2Log.cpp
Code:
#include "../MQ2Plugin.h"
#include <time.h>

PreSetup("MQ2Log");

PLUGIN_API VOID InitializePlugin(VOID)
{
    DebugSpewAlways("Initializing MQ2Log");
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
    DebugSpewAlways("Shutting down MQ2Log");
}

PLUGIN_API DWORD OnWriteChatColor(PCHAR Line, DWORD Color, DWORD Filter)
{
    FILE *fOut = NULL;
    CHAR Filename[MAX_STRING] = {0};
    CHAR szBuffer[MAX_STRING] = {0};
    DWORD i;

    sprintf(Filename,"%s\\MQ2ChatWnd.log",gszLogPath);

    for (i=0;i<strlen(Filename);i++) {
        if (Filename[i]=='\\') {
            strncpy(szBuffer,Filename,i);
        }
    }

    fOut = fopen(Filename,"at");
    if (!fOut) {
        sprintf(szBuffer,"Couldn't open log file: %s",Filename);
        WriteChatColor(szBuffer,CONCOLOR_RED);
        return 0;;
    }
    char tmpbuf[128];
    struct tm *today;
    time_t tm;
    tm = time(NULL);
    today = localtime(&tm);
    strftime( tmpbuf, 128, "%Y/%m/%d %H:%M:%S", today );
    sprintf(szBuffer, "[%s] %s",tmpbuf,Line);
    fprintf(fOut,"%s\r\n", szBuffer);
    fclose(fOut);
    return 0;
}

htw
 
Status
Not open for further replies.