Using SendMessage() to evaluate $mid($null,1) correctly gives $null.

If you try to evaluate $nick from a remote context event with the wrong eventid number, $nick doesn't evaluate to $null but to the plain text "$nick" (just like in the editboxes), rather than $null, which is wrong.
Code:
extern "C" int __stdcall getvaluefromeventid(HWND mWnd, HWND aWnd, CHAR *data, char *parms, BOOL show, BOOL nopause)
{
char pre[70];
strcpy(pre,data);
int eventid = atoi(data);
strcpy(str,"$nick");
SendMessage(mWnd, WM_MEVALUATE, MAKEWPARAM(0, 12), 0);
strcat(strcat(strcat(strcpy(data,"trying to evaluate $nick from eventid: "),pre)," -- value: "),str);
return 3;
}

//somewhere else, before calling the above:

file = CreateFileMapping(INVALID_HANDLE_VALUE,NULL,PAGE_READWRITE,0,5000, "mIRC");
str = (LPSTR) MapViewOfFile(file, FILE_MAP_ALL_ACCESS, 0, 0, 0);



Now about the implementation of this feature.

One could easily wonder why do we need an ID for this.
It was certainly possible to evaluate with SendMessage from an event before, but I guess local identifiers wouldn't be evaluated, either because it was overlooked, or on purpose.
One would then think a simple BOOL value or similar (or'ing the cIndex parameter with a new value for example), telling mIRC that SendMessage is allowed to evaluate local identifiers would work.

Why is the eventid required?

Playing with this, you quickly realize the current implementation allows one to evaluate local $identifier of previous events triggered in the same 'chain':
Code:
Script1.mrc: on *:text:!mytrigger:#mychan:set %oldeventid $eventid
Script2.mrc: on *:text:!mytrigger:#mychan:$dll(mydll.dll,myfunct,%oldeventid) | unset %oldeventid

Note that if the chain is broken it doesn't work.
While this requires an ID to work, it's not documented and practically speaking, I can't find a purpose for it, I could eventually see a purpose if you were able to get local identifiers's values from any event given its eventid..

Why is mIRC using this method instead of a simple bool value?

Last edited by Wims; 26/07/14 09:32 PM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel