mIRC Home    About    Download    Register    News    Help

Print Thread
Mode Parsing #188989 02/11/07 05:13 PM
Joined: Oct 2007
Posts: 51
T
Trashlord_ Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2007
Posts: 51
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?

Re: Mode Parsing [Re: Trashlord_] #188995 02/11/07 06:40 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
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)

Re: Mode Parsing [Re: hixxy] #189017 02/11/07 11:00 PM
Joined: Oct 2007
Posts: 51
T
Trashlord_ Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Oct 2007
Posts: 51
Yeah I just looked at it now, I didn't notice I haven't added that in.

Thanks.