mIRC Home    About    Download    Register    News    Help

Print Thread
#148215 01/05/06 11:22 AM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
Code:
alias Find_Sock {
  var %x 1

  while (%x <= $Sock(SOCK.*, 0)) {
    var %Sock = $Sock(SOCK.*, %x)

    if (Gettok($Sock(Sock).mark, 1, 32) == $$1) {
      return %Sock

      break
    }

    inc %x
  }
}


e.g. socks might be lie this with their coressponding sockmarks

SOCK.3454 hello 1
SOCK.4545 hi 2
SOCK.45445 bye 3

//echo -a $Find_Sock(hello) shoild give me SOCK.3454

but gives me insufficient parameters instead

#148216 01/05/06 01:48 PM
Joined: Apr 2006
Posts: 14
O
Pikka bird
Offline
Pikka bird
O
Joined: Apr 2006
Posts: 14
On line 5 you have "Gettok" instead of "$gettok"

#148217 01/05/06 01:57 PM
Joined: Apr 2006
Posts: 14
O
Pikka bird
Offline
Pikka bird
O
Joined: Apr 2006
Posts: 14
Code:
alias Find_Sock {
  var %x = 1
  while (%x <= $Sock(SOCK.*, 0)) {
    var %Sock = $Sock(SOCK.*, %x)
    if ($Gettok($Sock(%Sock).mark, 1, 32) == $$1) {
      return %Sock
      break
    }
    inc %x
  }
} 

works fine

#148218 01/05/06 05:01 PM
Joined: Oct 2005
Posts: 827
P
pouncer Offline OP
Hoopy frood
OP Offline
Hoopy frood
P
Joined: Oct 2005
Posts: 827
oh yeah, silly me.

i also missed the % in the sockmark variable

#148219 02/05/06 04:11 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Just as a FYI, the break serves no purpose here, as the return exists the alias.


Link Copied to Clipboard