mIRC Home    About    Download    Register    News    Help

Print Thread
Please help, I am confused #252579 27/04/15 07:22 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
So I am trying to make a command activate if a specific username types in a command is this possible? Here is what I have so far.

Code:
on *TEXT:hello:#: {
  if ($nick == coolkid661 #) 
  msg $chan Hello how are you
}


Re: Please help, I am confused [Re: powerade661] #252580 27/04/15 07:42 PM
Joined: Jan 2014
Posts: 101
M
Majeye Offline
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Originally Posted By: powerade661
So I am trying to make a command activate if a specific username types in a command is this possible? Here is what I have so far.

Code:
on *TEXT:hello:#: {
  if ($nick == coolkid661 #) 
  msg $chan Hello how are you
}



You have an extraneous # in there that isn't needed.

You also have this set up so that it only responds when 'Coolkid661' says "hello".

Re: Please help, I am confused [Re: Majeye] #252581 27/04/15 07:48 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Ok so it should work if I take out the #. It's not really working with the # in place. Also another thing, I keep getting this script control error, do I need a faster computer to run the bot? Is this normal or anything to worry about.

Re: Please help, I am confused [Re: Majeye] #252584 27/04/15 08:50 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
It's not working at all, I am not sure if it is having issues identifying the username or what. I took out the # to no avail

Last edited by powerade661; 27/04/15 08:51 PM.
Re: Please help, I am confused [Re: powerade661] #252585 27/04/15 09:34 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
You're missing brackets { }

Code:
on *TEXT:hello:#: {
  if ($nick == coolkid661) { 
  msg $chan Hello how are you
 }
}


Though you can also do without them sometimes when your code block is on one line

Code:
on *TEXT:hello:#: if ($nick == coolkid661) msg $chan Hello how are you

Re: Please help, I am confused [Re: Sakana] #252586 27/04/15 10:00 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
It's still not working, I don't understand what is going on... Is it possible that it's not recognizing that the user is coolkid661?

Re: Please help, I am confused [Re: powerade661] #252587 27/04/15 10:03 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Also another question, why isn't this working? I have been trying for hours, I am not exactly sure as to why it's not.

Code:
on *:text:!editcom & *:#: {
  if ($read(commands.ini, ns, $2)) {
    writeini -l $+ $readini commands.ini $2-
    msg # $nick command has been updated.
  }
}

Re: Please help, I am confused [Re: powerade661] #252588 27/04/15 10:03 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Also a colon missing, didn't notice it ;(
Code:
on *:text:hello:#:{

Re: Please help, I am confused [Re: Sakana] #252589 27/04/15 10:10 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
That fixed my issue, thank you so much! Any idea what is wrong with my editcom code?

Re: Please help, I am confused [Re: powerade661] #252590 27/04/15 10:23 PM
Joined: Jan 2014
Posts: 101
M
Majeye Offline
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Originally Posted By: powerade661
That fixed my issue, thank you so much! Any idea what is wrong with my editcom code?


where did you grab that code from? do you have the entire thing? or just the edit part?

Re: Please help, I am confused [Re: powerade661] #252591 27/04/15 10:25 PM
Joined: Sep 2014
Posts: 259
S
Sakana Offline
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Seems like there are a number of things wrong with that, but I can't really tell what you're trying to do

Look here for how to use writeini and $readini

http://en.wikichip.org/wiki/mirc/ini_files

Re: Please help, I am confused [Re: Majeye] #252592 27/04/15 10:26 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I have the entire thing, here it is.

Code:

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

on $*:text:/^!delcom !?(\S+)/iS:#:{
  if ($nick !isop #) return
  remini commands.ini commands $regml(1)
  msg # $nick command has been removed.
}
on *:text:!editcom & *:#: {
  if ($read(commands.ini, ns, $2)) {
    writeini -l $+ $readini commands.ini $2-
    msg # $nick command has been updated.
  }
}
on $*:text:/^!(\S+)/:#:{
  if ($nick !isop #) return
  if ($readini(commands.ini,n,commands,$regml(1))) msg # $v1
}




Everything works except the editcom.

Re: Please help, I am confused [Re: Sakana] #252593 27/04/15 10:34 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I am trying to use custom commands. The addcom and delcom work perfectly but the editcom doesn't write the updated command to commands.ini

Re: Please help, I am confused [Re: powerade661] #252594 27/04/15 10:44 PM
Joined: Jan 2014
Posts: 101
M
Majeye Offline
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Try this one instead.

Code:
on *:text:!addcom *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) is already exist into the database! | return }
    write # $+ commands.txt $2-
    msg $chan /me + Command $2 has been added to the database!
  }
}
on *:text:!delcom *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -dl $+ $readn # $+ commands.txt
    msg $chan /me - Command $2- has been deleted from the database!
  }
}
on *:text:!editcom & *:#: {
  if ($nick isop #) {
    var %r = $read(# $+ commands.txt,ns,$2)
    if (!%r) { .msg $chan [ $+ $nick $+ ]: Error, This command $qt($2) does NOT exist into the database! | return }
    write -l $+ $readn # $+ commands.txt $2-
    msg $chan /me -> Command $2 has been updated!
  }
}
ON *:TEXT:*:#: {
  var %owner $right(#,-1)
  tokenize 32 $strip($1-,burci)
  if ($read(# $+ commands.txt, nts, $1)) {
    var %com = $v1
    var %com = $replace(%com,@user@,$iif($2,$2,?),@nick@,$nick,@target@,$target)
    if (-ul=mod == $gettok(%com,1,32)) && (!$mod($nick)) { msg $chan Sorry $nick $+ , you cannot use this command. | return }
    if (-ul=reg == $gettok(%com,1,32)) && (!$mod($nick)) && (!$regular($nick)) { msg $chan Sorry $nick $+ , you cannot use this command. | return }
    if (-ul=own == $gettok(%com,1,32)) && ($nick != %owner) { msg $chan Sorry $nick $+ , you cannot use this command. | return }
    msg $chan $iif(-ul=mod == $gettok(%com,1,32) || -ul=reg == $gettok(%com,1,32) || -ul=own == $gettok(%com,1,32),$gettok(%com,2-,32),$gettok(%com,1-,32))
  }
}

Re: Please help, I am confused [Re: Majeye] #252596 27/04/15 10:57 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Is it possible to make it to where they have to type something before the command for example !command rather than just typing the specific text? This works great! If not, that is fine.

Re: Please help, I am confused [Re: powerade661] #252601 28/04/15 12:36 AM
Joined: Jan 2014
Posts: 101
M
Majeye Offline
Vogon poet
Offline
Vogon poet
M
Joined: Jan 2014
Posts: 101
Originally Posted By: powerade661
Is it possible to make it to where they have to type something before the command for example !command rather than just typing the specific text? This works great! If not, that is fine.


I'm not sure I fully understand this question.

Re: Please help, I am confused [Re: Majeye] #252606 28/04/15 04:23 AM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
For example if the command is potato they have to type !potato instead of just "potato". Is this possible?

Re: Please help, I am confused [Re: powerade661] #252619 29/04/15 09:43 AM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
on *:text:!addcom *:#: <- this part telling mirc what to look for, remove the ! sign will make mirc look for addcom, and that without the ! sign, i dont know if that is what you looking for?


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Re: Please help, I am confused [Re: sparta] #252637 30/04/15 06:01 AM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
This did it for me, thank you smile