mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Dec 2002
Posts: 56
W
wshs Offline OP
Babel fish
OP Offline
Babel fish
W
Joined: Dec 2002
Posts: 56
$identifier(stuff,more stuff,yet more)
$1 gets set to stuff, $2 to more stuff, etc
How do I go about calling an identifier with SendMessage when one of the args to the alias could potentially contain a comma? With mirc scripting, I just set a %var to the text, and call $identifier(%blah,%blah2,etc).


Acquire. Analyze. Adapt.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
You could do the same with a dll technically:

Code:
strcpy(data,"set %param text,with,commas");
SendMessage([color:red]hwnd[/color],WM_USER + 200,0,0);
strcpy(data,"$identifier(param1,param2,param3,%param)");
char* result = SendMessage([color:red]hwnd[/color],WM_USER + 201,0,0);
strcpy(data,"unset %param");
SendMessage([color:red]hwnd[/color],WM_USER + 200,0,0);


This is assuming you've already set up your filemap.


New username: hixxy
Joined: Dec 2002
Posts: 56
W
wshs Offline OP
Babel fish
OP Offline
Babel fish
W
Joined: Dec 2002
Posts: 56
The problem with doing that is the potential for a variable collision. If a script written/used by the user makes use of a variable of the same name, the results could be nasty. ...and mIRC offers no way to safely generate variable names.


Acquire. Analyze. Adapt.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Quote:
...and mIRC offers no way to safely generate variable names.


Since the variable is unloaded as soon as you call the identifier, just give the variable a messy name, eg:

Code:
strcpy(data,"set %__dllname__functionname_1032842 x,y,z");


It's unlikely a name like that will be in use, you could also make a mIRC identifier to return a free variable name:

Code:
alias freevar {
  var %r = $rand(9999,9999999999)
  while ($var($eval(%r,2),1)) { %r = $rand(9999,9999999999) }
  return %r
}


New username: hixxy
Joined: Dec 2002
Posts: 56
W
wshs Offline OP
Babel fish
OP Offline
Babel fish
W
Joined: Dec 2002
Posts: 56
That could actually work. Got me a nice random string function, which should make for a pseudo unique var name. Thanks.


Acquire. Analyze. Adapt.
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Yw smile


New username: hixxy
Joined: Jun 2003
Posts: 195
N
Vogon poet
Offline
Vogon poet
N
Joined: Jun 2003
Posts: 195
instead of setting a variable etc.. just pass in $chr(44) in the original SendMessage?

it wont be evaluated in the C code but mirc should evaluate it after its passed

Last edited by Narusegawa_Naru; 26/01/05 01:14 AM.

Have Fun smile

Link Copied to Clipboard