|
|
|
powerade661
|
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.
on *TEXT:hello:#: {
if ($nick == coolkid661 #)
msg $chan Hello how are you
}
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jan 2014
Posts: 107 |
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.
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".
|
|
|
|
powerade661
|
powerade661
|
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.
|
|
|
|
powerade661
|
powerade661
|
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.
|
|
|
|
Sakana
|
Sakana
|
You're missing brackets { }
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
on *TEXT:hello:#: if ($nick == coolkid661) msg $chan Hello how are you
|
|
|
|
powerade661
|
powerade661
|
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?
|
|
|
|
powerade661
|
powerade661
|
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.
on *:text:!editcom & *:#: {
if ($read(commands.ini, ns, $2)) {
writeini -l $+ $readini commands.ini $2-
msg # $nick command has been updated.
}
}
|
|
|
|
Sakana
|
Sakana
|
Also a colon missing, didn't notice it ;(
|
|
|
|
powerade661
|
powerade661
|
That fixed my issue, thank you so much! Any idea what is wrong with my editcom code?
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jan 2014
Posts: 107 |
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?
|
|
|
|
powerade661
|
powerade661
|
I have the entire thing, here it is.
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.
|
|
|
|
powerade661
|
powerade661
|
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
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jan 2014
Posts: 107 |
Try this one instead. 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))
}
}
|
|
|
|
powerade661
|
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.
|
|
|
|
Joined: Jan 2014
Posts: 107
Vogon poet
|
Vogon poet
Joined: Jan 2014
Posts: 107 |
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.
|
|
|
|
powerade661
|
powerade661
|
For example if the command is potato they have to type !potato instead of just "potato". Is this possible?
|
|
|
|
Joined: Feb 2003
Posts: 3,412
Hoopy frood
|
Hoopy frood
Joined: Feb 2003
Posts: 3,412 |
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?
|
|
|
|
powerade661
|
powerade661
|
This did it for me, thank you 
|
|
|
|
|
|
|
|