mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2014
Posts: 10
I
iFort Offline OP
Pikka bird
OP Offline
Pikka bird
I
Joined: Feb 2014
Posts: 10
Hello and thanks in advance smile

I'm not a complete new guy in scripting, I'm also following a programming study, so you don't have to explain it in 'newb' language just saying :P

What I'm trying to do is:

I have a variable %command.SOMETHING

there are about 10/20 there, but more can be created by OP's.
what I want to do is when someone types !commands, is display a list of all commands (thus a list of all variables starting with %command)

what it needs to display, is SOMETHING, so the second part of the variable, not the text the variable contains.

so if I have the following commands:
%command.!woop msg $chan WOOPWOOP
%command.!test msg $chan THIS IS A TEST
%command.!slap msg $chan /me slaps $nick
%command.!123 msg $chan random command

it should display
the commands are: !woop, !test, !slap, !123

Thanks smile

edit: all I need is the code for getting the variables, not whole "on *:text" stuff

Last edited by iFort; 14/02/14 07:44 PM.
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
$command.list(command)

Code:
alias command.list {
  var %i = 1, %n = $var($1 $+ *,0), %list, %var
  while (%i <= %n) {
    %var = $gettok($var($1 $+ *,%i),2-,46)
    if (%var) %list = $iif(%list,%list $+ $chr(44)) %var
    inc %i
  }
  return %list
}

Last edited by Loki12583; 14/02/14 10:06 PM.

Link Copied to Clipboard