mIRC Home    About    Download    Register    News    Help

Print Thread
#251662 26/02/15 09:05 PM
B
BullD0G
BullD0G
B
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!
}

#251680 27/02/15 05:46 AM
S
Sjoepele
Sjoepele
S
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.
#251688 27/02/15 04:01 PM
B
BullD0G
BullD0G
B
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.

Link Copied to Clipboard