mIRC Home    About    Download    Register    News    Help

Print Thread
add command #251662 26/02/15 09:05 PM
Joined: Feb 2015
Posts: 7
B
BullD0G Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Feb 2015
Posts: 7
Currently trying to make it so my mods or my self can add text commands via my bot so i dont have to add code. So like
!addcommand !test This is a test
and then someone types !test and the bot replys with This is a test.

This is what I have but it but when go to have to bot reply it doesn't

Quote:
on $*:text:/^!addcommand !?(\S+)/iS:#:{
if ($nick !isop #) return
writeini commands.ini commands $regml(1) $$3-
.msg $chan Command has been added!
}

Re: add command [Re: BullD0G] #251680 27/02/15 05:46 AM
Joined: Mar 2014
Posts: 42
S
Sjoepele Offline
Ameglian cow
Offline
Ameglian cow
S
Joined: Mar 2014
Posts: 42
Im not sure about regex but i always just used something like

Code:
on *:text:!addcom *:#:{
if ($nick isop #) {
if ($readini(commands.ini,commands,$2) >= 1) { msg # this command already exists | return }
writeini commands.ini commands $2 $3-
msg # command $2 added!
 }
}


And to check for commands something like
Code:
on *:text:!*:#:{
  if ($readini(commands.ini,commands,$1) != $null) {
    msg # $readini(commands.ini,commands,$1)
  }
}

Last edited by Sjoepele; 27/02/15 06:13 AM.
Re: add command [Re: Sjoepele] #251688 27/02/15 04:01 PM
Joined: Feb 2015
Posts: 7
B
BullD0G Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
B
Joined: Feb 2015
Posts: 7
Yeah after a few dabbles i figured it out with this code

Quote:
on $*:text:/^!addcommand !?(\S+)/iS:#: {
if ($nick !isop #) return
writeini commands.ini commands $regml(1) $$3-
msg $chan /me The command $2 has been added.
}


for some reason it isnt showing the spaces but on the if command and remini there should be a space

Last edited by BullD0G; 27/02/15 04:02 PM.