mIRC Home    About    Download    Register    News    Help

Print Thread
#185054 04/09/07 08:18 AM
Joined: Aug 2006
Posts: 60
S
Babel fish
OP Offline
Babel fish
S
Joined: Aug 2006
Posts: 60
Code:
alias helpmsg {
  ;msg + $+ $chan Message to Voices: ***HelpMsg sent to $1 $+ : $2-
  var %stuff = $replace($2-,$chr(32),$chr(44))
  echo %stuff
  var %crap = $helptext(%stuff)
  echo %crap
  !msg $1 %crap
}
alias helptext {
  if ($1 == NickServ) {
    if (!$2) return NickServ allows you to "register" a nickname and prevent others from using it.
    elseif ($2 == REGISTER) halt 
    elseif ($2 == CONFIRM) return To Confirm a nickserv auth code 
...
  }
}

When I do "/helpmsg mynickname nickserv confirm", %stuff echoes but %crap doesn't and I don't get a message from myself. What's gone wrong?

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
My suggestion:
Code:
alias helpmsg { msg $1 $helptext($2-) }
alias helptext { 
tokenize 32 $1-
  if ($1 == NickServ) {
    if (!$2) return NickServ allows you to "register" a nickname and prevent others from using it.
    elseif ($2 == REGISTER) halt 
    elseif ($2 == CONFIRM) return To Confirm a nickserv auth code 
; ...
  }
}

Tokenize did the trick smile

Edit: Thinking it over again, this would also work:
var %crap = $helptext( [ %stuff ] )
...But I suppose you did the replace thing only to get that "tokenize" effect, which looks cleaner.

Last edited by Horstl; 04/09/07 09:13 AM.
Horstl #185060 04/09/07 08:53 AM
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
eh? $1- is already a tokenized list with chr 32 (space) as a delimeter.

In his code though, the issue was he was using chr 44 (comma) as the delimeter, just not tokenizing it later..

So, the tokenize in Horstl's code shouldn't be needed.. so long as your using the rest of horstl's code..

Bekar #185061 04/09/07 09:04 AM
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
The parameters of returning aliases are $aliasname($1,$2,$3,...)
Thus "if ($1 == something)" compares the "whole string".

Code:
alias returning { echo -a $call($1-) }
alias -l call { return 1st token: $1 ...and 2nd token onwards: $2- }
/returning test it to see what i mean
smile

Horstl #185064 04/09/07 09:38 AM
Joined: Aug 2006
Posts: 60
S
Babel fish
OP Offline
Babel fish
S
Joined: Aug 2006
Posts: 60
Originally Posted By: Horstl
My suggestion:
Code:
alias helpmsg { msg $1 $helptext($2-) }
alias helptext { 
tokenize 32 $1-
  if ($1 == NickServ) {
    if (!$2) return NickServ allows you to "register" a nickname and prevent others from using it.
    elseif ($2 == REGISTER) halt 
    elseif ($2 == CONFIRM) return To Confirm a nickserv auth code 
; ...
  }
}

Tokenize did the trick smile

That works, thanks! smile

Horstl #185065 04/09/07 10:07 AM
Joined: Dec 2002
Posts: 503
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Dec 2002
Posts: 503
never had that issue before.. weird.. wink Ah well, learn something new every day.. wink


Link Copied to Clipboard