mIRC Homepage
Posted By: Trashlord_ Mode Parsing - 02/11/07 05:13 PM
Hi, I'm writing an IRCd in mIRC, and I've reached to MODE.

I need to parse the parameters, given for status modes (ov).

Here's my code.

Code:
alias ModeParams {
  ;$ModeParams(modes,parameters).
  var %i = 0, %len = $len($1), %modes, %paramodes = ov, %mode_param = 0
  while (%i < %len) {
    inc %i
    var %mid = $mid($1,%i,1)
    if (%mid isincs %paramodes) {
      inc %mode_param
      var %modes = MODE %i - PARAM: $gettok($2-,%mode_param,32)
    }
  }
  return %modes
}


I can't figure out why it doesn't work, mIRC returns "MODE 2 - PARAM: <the second parameter here>."

It completely ignores the first mode and parameter.
I'm trying //echo -a $ModeParams(ov,Trashlord Test).

Any ideas?
Posted By: hixxy Re: Mode Parsing - 02/11/07 06:40 PM
You're resetting the %modes var each time in this line:

Code:
var %modes = MODE %i - PARAM: $gettok($2-,%mode_param,32)


Change it to read:

Code:
var %modes = %modes MODE %i - PARAM: $gettok($2-,%mode_param,32)
Posted By: Trashlord_ Re: Mode Parsing - 02/11/07 11:00 PM
Yeah I just looked at it now, I didn't notice I haven't added that in.

Thanks.
© mIRC Discussion Forums