mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
an easy way to do it is make the command addcomMOD or something and make it add to a mod command list, then have 2 commands to find !* and one is ($nick !isop #) return
Code:
on $*:text:/^!addcommod !?(\S+)/iS:#:{
  if ($nick !isop #) return
    msg $chan added $2 to moderator commands!
    writeini modcommands.ini commands $regml(1) $3-
}

Code:
on $*:text:/^!(\S+)/:#:{
if ($nick !isop #) return
if ($readini(modcommands.ini,n,#,$regml(1))) msg # $v1
}

Last edited by judge2020; 12/05/14 03:01 PM. Reason: added missing bracket

#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: May 2014
Posts: 7
O
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
O
Joined: May 2014
Posts: 7
Ahh,

Simplest solution, looking me right in the face.

Thanks

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
is there a way to do this, so that the command will read a text file itself? For instance, say I have a recent donator's list and want the command !recent to be in my commands.ini file but read from that list (so it updates automatically, after a donation is made) I know I can do:

Code:
on *:text:!recent:#: {
  msg # $read(donatorList.txt)
}


And, if it helps this is my !repeat script:

Code:
on *:text:!repeat *:#:{
  if $nick !isop # { msg # $nick You are not allowed to do that | return }
  if !$3 { msg # Usage: !repeat !<command name> <time in minute/off> | return }
  if ($3 !isnum || $3 < 1) && $3 != off { msg # <time> must be number greater than 0 or off | return }
  var %t $+(#,.,$2), %text $readini(commands.ini,n,commands,$right($2,-1))
  if !%text { msg # $2 does not exists. | return }
  if $timer($+(repeat.,%t)) {
    if $3 == off { 
      $+(.timerrepeat.,%t) off 
      msg # $2 repetition is now off.
    }
    else { msg # $2 is already repeating. }   
  } 
  else { 
    if $3 == off { msg # $2 has not been started yet. }
    else { 
      $+(.timerrepeat.,%t) 0 $calc($3 * 60) msg # $replace(%text,|,-,$,-,%,-) 
      msg # $2 is now repeating every $3 min $+ $iif($3 > 1,s) $+ . 
    }
  } 
}


But I'd also like to incorporate that into my existing !repeat command so I don't have to do it manually... If it's not possible, no big deal. Just like keeping my remote's as clean as possible :P

Last edited by Bramzee; 21/05/14 06:33 PM.
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
make it as an alias.
Code:
alias recent return $read(donatorList.txt)

check if command is an alias or plain text.
Code:
on *:text:!repeat *:#:{
  ...
      ; check if command is an alias or just plain text

      if ($numtok(%text,32) == 1) && ($isalias(%text)) { var %cmd msg # $($+($,!,%text),2) }
      else { var %cmd msg # $replace(%text,|,-,$,-,%,-) }

      $+(.timerrepeat.,%t) 0 $calc($3 * 60) %cmd 
      msg # $2 is now repeating every $3 min $+ $iif($3 > 1,s) $+ .
  ...
}

Joined: May 2014
Posts: 5
D
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
D
Joined: May 2014
Posts: 5
So if anyone could also help out with here, I would like a ~editcom command but I tried and it hasn't worked for me, I figured it would work, but I'm really tired. Also, the easiest way, as someone mentioned, would be to just do a ~addcommod or have it check to see if the word mod is there possibly?

Code:
on $*:text:/^~addcom ~?(\S+)/iS:#:{
  writeini commands.ini commands $regml(1) $$3-
  { msg $chan $nick -> Command $2 has been created. }
}
on $*:text:/^~delcom ~?(\S+)/iS:#:{
  remini commands.ini commands $regml(1)
  { msg $chan $nick -> $2 has been removed from the command database. }
}

on $*:text:/^~(\S+)/:#:{
  if (!%comwait) {
    set -u6 %comwait 1
    if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
  }
  else { msg $chan $nick -> Command is on cool-down }
}
on $*:text:/^~editcom ~?(\S+)/iS:#:{
  writeini commands.ini commands $regml(1) $$3-
  { msg $chan $nick -> Command $2 has been updated. }
}

Last edited by Devin; 26/05/14 07:30 AM.
Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
Originally Posted By: Devin
So if anyone could also help out with here, I would like a ~editcom command but I tried and it hasn't worked for me, I figured it would work, but I'm really tired. Also, the easiest way, as someone mentioned, would be to just do a ~addcommod or have it check to see if the word mod is there possibly?

Code:
on $*:text:/^~addcom ~?(\S+)/iS:#:{
  writeini commands.ini commands $regml(1) $$3-
  { msg $chan $nick -> Command $2 has been created. }
}
on $*:text:/^~delcom ~?(\S+)/iS:#:{
  remini commands.ini commands $regml(1)
  { msg $chan $nick -> $2 has been removed from the command database. }
}

on $*:text:/^~(\S+)/:#:{
  if (!%comwait) {
    set -u6 %comwait 1
    if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
  }
  else { msg $chan $nick -> Command is on cool-down }
}
on $*:text:/^~editcom ~?(\S+)/iS:#:{
  writeini commands.ini commands $regml(1) $$3-
  { msg $chan $nick -> Command $2 has been updated. }
}

You already that in the !* script
Code:
if ($readini(commands.ini,n,commands,$regml(1)))
so
Code:
on $*:text:/^~editcom ~?(\S+)/iS:#:{
if ($readini(commands.ini,n,commands,$regml(1)))  {
  writeini commands.ini commands $regml(1) $$3-
  msg $chan $nick -> Command $2 has been updated.
}
Else msg # sorry! that command is not already there. Consider adding it!
}
}
also you might want to add in some operator checks so randoms don't change all your commands.

Same can be done for !delcom


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
You have to change the order of the code. mIRC will not process next event if it is already matched.
~editcom is matched to this event
Code:
on $*:text:/^~(\S+)/:#:{
  ...
}

thus next event will be ignored.
Try move the code quoted above to the bottom of the script.

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Is anyone else having a problem with adding commands that have links in them? For some reason the bot isn't liking it or something. I have a link protection script, but even after I remove that and try, I still have to add the command manually... Which wouldn't be a huge deal, but a few people are using my bot (and yes, this was not working even before they started using it). Any ideas on how to fix or what might be the problem?

Joined: May 2014
Posts: 10
Pikka bird
Offline
Pikka bird
Joined: May 2014
Posts: 10
Originally Posted By: Bramzee
Is anyone else having a problem with adding commands that have links in them? For some reason the bot isn't liking it or something. I have a link protection script, but even after I remove that and try, I still have to add the command manually... Which wouldn't be a huge deal, but a few people are using my bot (and yes, this was not working even before they started using it). Any ideas on how to fix or what might be the problem?


I don't have any issues, so it may be your code. Mine is custom, so it is a lot different than that of the sources here. Can you post the code that adds the commands you are typing in chat? It is quite difficult to tell what the issue is if I have nothing to go off of.

Last edited by startgame; 27/05/14 08:51 AM.
Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
Sorry, a little tired. Meant to add that in...


Code:
on $*:text:/^!addcom !?(\S+)/iS:#:{
  if ($nick !isop #) { msg # Sorry $nick - You don't have permission to do that. } return
  writeini commands.ini # $regml(1) $$3-
  msg # $nick - The command $$2 has been added.
}

on $*:text:/^!delcom !?(\S+)/iS:#:{
  if ($nick !isop #) { msg # Sorry $nick - You don't have permission to do that. } return
  remini commands.ini # $regml(1)
  msg # $nick - The command $$2 has been removed.
}

on $*:text:/^!(\S+)/:#:{
  if ((%floodcom) || ($($+(%,floodcom.,$2),2))) { return }
  set -u10 %floodcom On
  set -u30 %floodcom. $+ $nick On
  if ($readini(commands.ini,n,#,$regml(1))) msg # $v1

Joined: Apr 2014
Posts: 191
B
Vogon poet
Offline
Vogon poet
B
Joined: Apr 2014
Posts: 191
I notice this line is wrong
Code:
if ($nick !isop #) { msg # Sorry $nick - You don't have permission to do that. } return

should be
Code:
if ($nick !isop #) { msg # Sorry $nick - You don't have permission to do that. | return }

Joined: May 2014
Posts: 10
Pikka bird
Offline
Pikka bird
Joined: May 2014
Posts: 10
Adding links works for me using your code. What link are you trying to add if you don't mind me asking?

Joined: Apr 2014
Posts: 170
Vogon poet
Offline
Vogon poet
Joined: Apr 2014
Posts: 170
When I do anything with just text it works perfectly. But for a test, just to double check before asking for help, I tried "!addcom !test twitter is twitter.com" and got no response. I then checked my command.ini file to see if maybe it went in and just didn't repeat, but it wasn't there. I figured maybe it was a problem with the script.


EDIT: I fixed it. Sorry. I put it in it's own remote file. After thinking maybe it was one of my other scripts messing with it I decided I'd give that a shot. Thanks for trying to help anyway smile

Last edited by Bramzee; 27/05/14 09:12 AM.
Joined: May 2014
Posts: 7
O
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
O
Joined: May 2014
Posts: 7
Hey Everyone,

So been slowly plugging away at this and learning but this one maybe out of my league.

Is there a way to list what commands a channel has?
So like !ListCom

then msgs the channel with a list of the words.

I saw this Command List

Not sure if that would be the same logic

I tried the read command, but could not get it to format right. Then I got to thinking that will just post up the blob of text on the .ini. So then I was thinking that maybe with each !addcom I need to have it write something to a .txt that it could relay back.

I am not sure, has my head spinning any suggestions?

Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/245756/Searchpage/1/Main/46310/Words/Awesome%21/Search/true/Re:_adding_commands_and_showin#Post245750

searched that so it has the search items in there :P

That script basically creates a .txt file named commandresonse.txt and every time someone adds it the new command will be added to the end, here is an example (i said ok since it didnt go through)
also
Code:
http://i.gyazo.com/a17c0750b371b29915d2b08b72d9ecb4.png

just is my list of names that can add commands, you should be able to edit your commands file and all that.

EDIT: almost forgot, here is the command i used to run this :P
Code:
on *:TEXT:!commands:#: { 
  if ((%floodcommands) || ($($+(%,floodcommands.,$nick),5))) { return }
  set -u15 %floodcommands On
  msg # $read(commandsresonse.txt)
}

Last edited by judge2020; 29/06/14 10:28 PM. Reason: added edit section

#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: May 2014
Posts: 7
O
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
O
Joined: May 2014
Posts: 7
Thanks,

Like always right in my face


Have another question about this, this is just for one channel if you have a few people that use it is there a way to do it like the .ini where it breaks down each command into each channel?

Last edited by OneAngryDuck; 30/06/14 12:29 AM.
Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
change this
Code:
   writeini allcommands.ini commands $regml(1) $3-
to
Code:
   writeini allcommands.ini $chan $regml(1) $3-

changes [commands] to [#channel] in the .ini, so your !* command is
Code:
on $*:text:/^!(\S+)/:#:{ if ($readini(allcommands.ini,n,$chan,$regml(1))) msg # $v1 }


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Joined: May 2014
Posts: 7
O
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
O
Joined: May 2014
Posts: 7
*SOLVED*
So just in case anyone want to do this too...

Code:
var %text $read(commandlist.txt,s,#)
  if %text != $null {
    var %line $remove(%text,! $+ $regml(1))
  }

  write -s $chan commandlist.txt # %line 
}





Sorry for the confusion I mean for the showing of the command list.

Right now when I used it if one channel will overwrite the text file.

So when I did the show command it was just showing the list of who ever added a command last.

I was trying to get it to make a new text file for each channel cause I only have 3 people using it, but I am not having much luck. Or have it break it down like the commands.ini does like it has the channel name then the command written under it.

Last edited by OneAngryDuck; 30/06/14 03:31 AM.
Joined: Mar 2014
Posts: 215
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Mar 2014
Posts: 215
did you see my last post? it literally explained a way to break it into different channels


#imAbeginner
i made a chat bot for mark_paintball! http://twitch.tv/mark_paintball
Page 2 of 2 1 2

Link Copied to Clipboard