mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2003
Posts: 3,641
A
argv0 Offline OP
Hoopy frood
OP Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
Is it possible to add a switch into SendMessage to allow a DLL to send commands to mIRC as if it was run from the same script that was calling it? This would greatly simplify the passing of data to dlls and back to mirc

Example:

This is currently how you have to pass all (most) TEXT event parameters into a dll:

Code:
on *:TEXT:*:#:/dll mydll.dll process_text $&
  $event $ulevel $target # $nick $fulladdress $&
  $wildsite $maddress $scriptdir $scriptline $script $rawmsg 

/* mydll.cpp:

MIRCDLLFUNCTION(process_text) {
  // split data god knows how many times 
  // to read out parameters
  char *parsed_data = parse_arguments(data);
  char *nick = parsed_data[4];
  char *rawmsg = parsed_data[11];

  // Build message
  sprintf(data, "/echo -at <%s> %s", nick, rawmsg);
  SendToMirc(data);

  // continue processing other things...

  strcpy(data, "some_return_status_code");
  return 3;
}
*/


* Keep in mind that for simplicity I didn't bother using half of the parameters that I passed in-- the code would have been far more ugly if I did; not to mention, I didn't even include the (probably hideous) code to parse those parameters out of the single string.

This is how it should be:

Code:
on *:TEXT:*:#:dll mydll.dll process_text

/* mydll.cpp:

MIRCDLLFUNCTION(process_text) {
  SendToMirc("//echo -at < $+ $nick $+ > $rawmsg");

  // continue processing other stuff...

  strcpy(data, "some_return_status_code");
  return 3;
}

*/



The second looks way easier to me, also far less error prone.

The ability to parse as if it were in the event could be added as a flag to the existing cMethod parameter as 8 or something.

I do see a difficulty in mIRC verifying which event the sendmessage is calling from, or if it's even coming from an event at all. Perhaps someone has an idea on how to solve that; I think it would be worth looking into.

S
symphony
symphony
S
Yay you!

I never thought that was easy. I am impressed grin

J
Janno
Janno
J
Correct me if I am wrong:
As far as I know, mIRC does not allow 2 scripts to be executed synchronously. So there's always one, and only one, current event.
It shouldn't be hard to maintain a list of event specific identifiers to be saved (in a global array?) which is then added to the context of incoming SendMessages.
The same might work for local variables, too.

Joined: Oct 2003
Posts: 3,641
A
argv0 Offline OP
Hoopy frood
OP Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,641
That's true, I never thought about it like that.


Link Copied to Clipboard