mIRC Home    About    Download    Register    News    Help

Print Thread
~add <cmd> script #165867 02/12/06 12:45 AM
Joined: Dec 2006
Posts: 3
P
peterpowell Offline OP
Self-satisified door
OP Offline
Self-satisified door
P
Joined: Dec 2006
Posts: 3
hi,

can someone give me some pointers on how to write a script where users of level 100 can type ~add <cmdname> <cmd content> and it adds the cmd

ty

-pp

Re: ~add <cmd> script #165868 02/12/06 01:42 AM
Joined: Mar 2003
Posts: 612
B
billythekid Offline
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
well a very basic code might look like this:
Code:
on 100:text:*:?:{
  if (~add isin $strip($1)) {
    writeini -n commands.ini ul100commands $2 $3-
  }
}


it sees the level 100 user typing for example

~add kick kick #chan $2

in private message. it then writes to the ul100commands section of the commands.ini file

kick kick #chan $2

you would then use $readini to get this information from the .ini file for use later ( $readini(commands.ini,ul100comands, kick) )

so perhaps an expansion of the script would be something like:
Code:
on 100:text:*:?:{
  if (~add isin $strip($1)) {
    writeini -n commands.ini ul100commands $2 $3-
  }
  elseif ( $ini(commands.ini,ul100commands,$strip($1)) ) {
    $readini(commands.ini,ul100comands, $1) 
  }
}


(elseif the first word exists as an item under ul100commands perform the command)

hope that gets you started...

btk

(all above untested so no doubt wrong, but the idea is there, lol!)


billythekid
Re: ~add <cmd> script #165869 03/12/06 06:07 PM
Joined: Sep 2005
Posts: 2,878
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,878
Code:
on 100:text:~*:?:{
  if ($1 == ~add) &amp;&amp; (!$isalias($$2)) { .alias $2- }
  elseif ($isalias($mid($1,2))) { $mid($1,2) }
}