mIRC Home    About    Download    Register    News    Help

Topic Options
#252579 - 27/04/15 08:22 PM Please help, I am confused
powerade661 Offline
Vogon poet

Registered: 27/01/15
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
}


Top
#252580 - 27/04/15 08:42 PM Re: Please help, I am confused [Re: powerade661]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
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".

Top
#252581 - 27/04/15 08:48 PM Re: Please help, I am confused [Re: Majeye]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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.

Top
#252584 - 27/04/15 09:50 PM Re: Please help, I am confused [Re: Majeye]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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


Edited by powerade661 (27/04/15 09:51 PM)

Top
#252585 - 27/04/15 10:34 PM Re: Please help, I am confused [Re: powerade661]
Sakana Offline
Fjord artisan

Registered: 19/09/14
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

Top
#252586 - 27/04/15 11:00 PM Re: Please help, I am confused [Re: Sakana]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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?

Top
#252587 - 27/04/15 11:03 PM Re: Please help, I am confused [Re: powerade661]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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.
  }
}

Top
#252588 - 27/04/15 11:03 PM Re: Please help, I am confused [Re: powerade661]
Sakana Offline
Fjord artisan

Registered: 19/09/14
Posts: 259
Also a colon missing, didn't notice it ;(
Code:
on *:text:hello:#:{

Top
#252589 - 27/04/15 11:10 PM Re: Please help, I am confused [Re: Sakana]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
That fixed my issue, thank you so much! Any idea what is wrong with my editcom code?

Top
#252590 - 27/04/15 11:23 PM Re: Please help, I am confused [Re: powerade661]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
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?

Top
#252591 - 27/04/15 11:25 PM Re: Please help, I am confused [Re: powerade661]
Sakana Offline
Fjord artisan

Registered: 19/09/14
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

Top
#252592 - 27/04/15 11:26 PM Re: Please help, I am confused [Re: Majeye]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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.

Top
#252593 - 27/04/15 11:34 PM Re: Please help, I am confused [Re: Sakana]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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

Top
#252594 - 27/04/15 11:44 PM Re: Please help, I am confused [Re: powerade661]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
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))
  }
}

Top
#252596 - 27/04/15 11:57 PM Re: Please help, I am confused [Re: Majeye]
powerade661 Offline
Vogon poet

Registered: 27/01/15
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.

Top
#252601 - 28/04/15 01:36 AM Re: Please help, I am confused [Re: powerade661]
Majeye Offline
Vogon poet

Registered: 21/01/14
Posts: 101
Loc: MN, USA
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.

Top
#252606 - 28/04/15 05:23 AM Re: Please help, I am confused [Re: Majeye]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
For example if the command is potato they have to type !potato instead of just "potato". Is this possible?

Top
#252619 - 29/04/15 10:43 AM Re: Please help, I am confused [Re: powerade661]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
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,.) }

Top
#252637 - 30/04/15 07:01 AM Re: Please help, I am confused [Re: sparta]
powerade661 Offline
Vogon poet

Registered: 27/01/15
Posts: 168
This did it for me, thank you smile

Top