mIRC Home    About    Download    Register    News    Help

Print Thread
#239298 11/10/12 06:33 AM
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
Code:
on *:TEXT:*:*: {
  if ($1 == !addcmd) { 
    if (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    elseif (!$2 = !$read(scripts/cc.txt,ntw,* $+ $2 $+ *)) { msg $chan $2 already taken. | halt }
    write -il1 scripts/cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write scripts/cc.txt $2 $3- | write scripts/cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 scripts/cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il8 scripts/cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: scripts/ccftpbatch.bat
    .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
  }
  elseif ($1 == !delcmd) {
    set %istriggerdel $2
    set %delhtml <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ %istriggerdel $+ $chr(32) $+
    set %delmrc on *:TEXT: $+ %istriggerdel $+ : $+
    if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif (! $+ %istriggerdel == !$read(scripts/cc.txt,ntw,* $+ %istriggerdel $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    write -dw" %delmrc $+ *" scripts/cc.mrc 
    write -ds" %delhtml " scripts/cc.html
    write -ds" $+ %istriggerdel $+ " scripts/cc.txt
    run -ns: scripts/ccftpbatch.bat
    msg $chan The trigger %istriggerdel has been removed...hopefuly? 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
    unset %istriggerdel
    unset %delhtml
    unset %delmrc
  }
  elseif ($1 == !editcmd) {
    set %istriggeredit $2
    set %istriggert $3 $4-
    if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$3) { msg $chan $nick More parameters needed. | halt }
    elseif (!$read(scripts/cc.txt,ntw,* $+ %istriggeredit $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    write -ds" $+ %istriggeredit $+ " scripts/cc.txt | write scripts/cc.txt %istriggert 
    msg $chan The trigger %istriggeredit has been edited...hopefuly? | run -ns: scripts/ccftpbatch.bat
    unset %istriggeredit
    unset %istriggert 
  }
  elseif ($1 == !search) {
    set %istriggersearch $2
    elseif (!$3) { msg $chan not the correct parameters | halt }
    elseif (!$read(scripts/cc.txt,nts,* $+ %istriggersearch $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    msg $chan searching %istriggersearch
    filter -ff scripts/cc.txt scripts/temp.txt * $+ %istriggersearch $+ * 
    .play -pq3f1m1 $chan scripts/temp.txt 2000
    remove scripts/temp.txt
    unset %istriggersearch
  }
}


I am sorry if i am using anybody's code, but i needed something to start from. the problem i am having is getting the !delcmd <trigger to delete> to delete from the html file scripts/cc.html. i am not having any issues getting the command to delete from the .mrc file or the .txt file. for some reason, i cant get it to find and delete from the .html file. if someone can help me, i would really really appreciate it. i love this website, and have been learning alot from it. the purpose of this scripts is for a custom bot i created in a jtv channel. so i get alot of custom commands added. i would like the mods in my chat to be able to delete any they feel are unnecessary.

ps....the !editcmd doesnt work yet either, but i can play with that after i get the !delcmd to work right. !addcmd and !search already work properly

Last edited by bandbonjtv; 11/10/12 06:35 AM. Reason: added more text to body
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I just took a fast look at it, need to go in a minute, but i noticed this. write -ds" $+ %istriggeredit $+ " <- you need to use a space there. write -ds " $+ %istriggeredit $+ " , or you can use $qt() instead of " . write -ds $qt(%istriggeredit)


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
thank you, ill try it today when i return from work. but the section i really want to get to work the most is !delcmd

Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
You have the same problem everywhere it says "write -dw", the " missing a space.


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
No, he is not missing a space, both syntax work.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
First of all, this code has a lot of exploits, you shouldn't use it as it is because it is very unsafe, see the post of qwerty for an explanation: https://forums.mirc.com/ubbthreads.php/topics/198734/1

About the deleting part, you should debug the code to find out at which point it's not behaving like you're expecting it to.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
Originally Posted By: Wims
First of all, this code has a lot of exploits, you shouldn't use it as it is because it is very unsafe, see the post of qwerty for an explanation: https://forums.mirc.com/ubbthreads.php/topics/198734/1

About the deleting part, you should debug the code to find out at which point it's not behaving like you're expecting it to.


thats good n all, but i dont know that much about security yet. the error im having is:
1. everything executes properly (!addcmd & !delcmd) those are the only commands im concerned with at the moment.
2. all 3 files must delete the matching texts whole line. (.mrc, .txt, .html)
3. everything deletes properly except the .html file
4. use of !addcmd adds all 3 lines of text properly to each file

!addcmd <!trigger>
!delcmd <!trigger>

and i need the code to check to see if the <!trigger> exists or doesnt prior to adding or deleting and display a message if it doesnt exist. that works for the !addcmd currently, but not the !delcmd

thank you for your input.

Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
any other ideas besides adding a space? ...which i dont need acording to mirc's website help guide on the /write syntax.

this should be pretty easy for you guys. everything works except its not recognizing the matched text in the .html document to delet the whole line.... thats all i need help with.

please help me delete the matched text (whole line) inside the .html document. it already finds and deletes the matched text in the .mrc document, and also inside the .txt document. the string of html code im looking for is included inside the !addcmd section. please help me.

ps... sorry wims if i sounded rude, but i am not currently worried about security, untill i get the code working properly. (order of debugging priorities) i need to get the code working before i can prevent abuse.

Last edited by bandbonjtv; 13/10/12 09:03 PM. Reason: added apology to wims
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
i finally got the delete to work properly with this as the final edit. ( i removed the !editcmd and !search for posting on this thread, but its still included in the script) ...Now i want it to check for the prefix ! as $2, and if $2 does not have ! inside of it, then it should return "$nick More parameters needed." please help me figure out how to get it to check if the matched text includes a ! prefix. thank you in advance. as you can see, i can figure some things out, im just not good at securing it simplifying the code. if i can get help with that too, id be super appreciative. all this is for a justintv channel bot i have created using snippets found, and snippets modified by myself as a learning process.

example:
wrong syntax
!delcmd test
response: $nick More parameters needed.
correct syntax
!delcmd !test
response: The trigger !test has been removed

Code:
on *:TEXT:*:*: {
  if ($1 == !addcmd) { 
    if (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    elseif (!$2 = !$read(scripts/cc.txt,ntw,* $+ $2 $+ *)) { msg $chan $2 already taken. | halt }
    write -il1 scripts/cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write scripts/cc.txt $2 $3- | write scripts/cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 scripts/cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il8 scripts/cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: scripts/ccftpbatch.bat
    .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
  }
  elseif ($1 == !delcmd) {
    set %delmrc on *:TEXT: $+ $2 $+ : $+
    if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif (!$2 != !$read(scripts/cc.mrc,ntw,* $+ $2 $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    write -dw" %delmrc $+ *" scripts/cc.mrc
    write -dw"* $+ > $2 < $+ *" scripts/cc.html
    write -ds" $+ $2 $+ " scripts/cc.txt
    run -ns: scripts/ccftpbatch.bat
    msg $chan The trigger $2 has been removed...hopefuly? 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
    unset %delmrc
  }
}

Joined: Jul 2006
Posts: 4,144
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,144
Quote:
im just not good at securing it simplifying the code
Secutiry is just part of the job, you have to take care for that the same way you have to make the code working as you want.
I understand that for you it's just something you don't want to deal with and that you would prefer to have the fully working code, but security isn't something you can be lazy with, in case you didn't read the link I gave you, it means that people can execute code on your machine, ie. they can delete files etc, you don't want that to happen so please see the thread and fix the code before doing anything else.

In the meantime, you can check if $2 starts with a '!' by using for example if (!* iswm $2) or if ($left($2,1) == !)

Last edited by Wims; 14/10/12 12:38 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
thank you wims, i understand what you are saying about the security. i am just not familiar with those scripts yet, so its something id have to play around with to get it to work right. thats why i want to fix this error, before moving on to create new ones for me to debug smile . its been hard enough trying to figure out how to get the code working properly. but thru trial and error, i managed to figure out how to get it to recognize the matched text in all 3 files. i will add the mentioned security scripts into place right after i check if my script looks for the proper prefix. thank you again wims.

Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
Originally Posted By: Wims
[quote]
In the meantime, you can check if $2 starts with a '!' by using for example if (!* iswm $2) or if ($left($2,1) == !)


thank you wims, but im not sure where to put that? i played around with it for a while yesterday, but couldnt get it to work right...

i am hoping to get a proofread and some help with simplfying the code if necesarry and adding security to it at this point.

this is my current code:
Code:
   elseif ($1 == !delcmd) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ $2 $+ *)) {
    set %delmrc on *:TEXT: $+ $2 $+ : $+
    elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    write -dw" %delmrc $+ *" scripts/cc.mrc
    write -dw"* $+ > $2 < $+ *" scripts/cc.html
    write -ds" $+ $2 $+ " scripts/cc.txt
    run -ns: scripts/ccftpbatch.bat
    msg $chan The trigger $2 has been removed...hopefuly? 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
    unset %delmrc
  }
  elseif ($1 == !delcmd) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ $2 $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }


my new issues are:
1. doesnt check properly and notify if !delcmd <trigger> does not exist I got this working finally. moved elseif statement for checking to a new elseif and created a new $1 $2 check for non existant seperate from the check for existing
2. could not figure out how to implement the quoted snippet into my code yet to check for ! prefix before deletion

To-Do:
1. secure my code as mentioned by wims smile
2. get !editcmd snippet to work.

sorry, im still kinda new to scripting in mirc, thank you for your patience with me.

here is the whole code im trying to simplify and secure at this point. again, thanks for the tip on that one wims. i didnt even realize there was a security issue involved.
Code:
on *:TEXT:*:*: {
  if ($1 == !addcmd) { 
    if (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    elseif (!$2 = !$read(scripts/cc.txt,ntw,* $+ $2 $+ *)) { msg $chan $2 already taken. | halt }
    write -il1 scripts/cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write scripts/cc.txt $2 $3- | write scripts/cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 scripts/cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il8 scripts/cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: scripts/ccftpbatch.bat
    .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
  }
  elseif ($1 == !delcmd) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ $2 $+ *)) {
    set %delmrc on *:TEXT: $+ $2 $+ : $+
    elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    write -dw" %delmrc $+ *" scripts/cc.mrc
    write -dw"* $+ > $2 < $+ *" scripts/cc.html
    write -ds" $+ $2 $+ " scripts/cc.txt
    run -ns: scripts/ccftpbatch.bat
    msg $chan The trigger $2 has been removed...hopefuly? 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
    unset %delmrc
  }
  elseif ($1 == !delcmd) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ $2 $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
  elseif ($1 == !editcmd) {
    set %istriggeredit $2
    set %istriggert $3 $4-
    if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$3) { msg $chan $nick More parameters needed. | halt }
    elseif (!$read(scripts/cc.txt,ntw,* $+ %istriggeredit $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    write -ds" $+ %istriggeredit $+ " scripts/cc.txt | write scripts/cc.txt %istriggert 
    msg $chan The trigger %istriggeredit has been edited...hopefuly? | run -ns: scripts/ccftpbatch.bat
    unset %istriggeredit
    unset %istriggert 
  }
  elseif ($1 == !search) {
    set %istriggersearch $2
    elseif (!$3) { msg $chan not the correct parameters | halt }
    elseif (!$read(scripts/cc.txt,nts,* $+ %istriggersearch $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    msg $chan searching %istriggersearch
    filter -ff scripts/cc.txt scripts/temp.txt * $+ %istriggersearch $+ * 
    .play -pq3f1m1 $chan scripts/temp.txt 2000
    remove scripts/temp.txt
    unset %istriggersearch
  }
}

Last edited by bandbonjtv; 15/10/12 12:04 AM. Reason: (delete issue solved) found a way to delete with check for existing triggers and respond if the trigger does not exist
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
now ive got the !delcmd to delete and check properly, but i cant get the !addcmd to check for the ! prefix, and i cant get it to stop adding multiples.


Code:
on *:TEXT:*:*: {
  if ($1 == !addcmd) && (!* iswmcs $2) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { 
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    write -il1 scripts/cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write scripts/cc.txt $2 $3- | write scripts/cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 scripts/cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il8 scripts/cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: scripts/ccftpbatch.bat
    .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
  }
  elseif ($1 == !addcmd) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger already exists. | halt }
  elseif ($1 == !addcmd) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger already exists. | halt }
  elseif ($1 == !delcmd) && (!* iswmcs $2) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) {
    set %delmrc on *:TEXT: $+ $2 $+ : $+
    elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    write -dw" %delmrc $+ *" scripts/cc.mrc
    write -dw"* $+ > $2 < $+ *" scripts/cc.html
    write -ds" $+ $2 $+ " scripts/cc.txt
    run -ns: scripts/ccftpbatch.bat
    msg $chan The trigger $2 has been removed...hopefuly? 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
    unset %delmrc
  }
  elseif ($1 == !delcmd) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger doesnt exists. | halt }
  elseif ($1 == !delcmd) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger doesnt exists. | halt }
  elseif ($1 == !editcmd) {
    set %istriggeredit $2
    set %istriggert $3 $4-
    if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$3) { msg $chan $nick More parameters needed. | halt }
    elseif (!$read(scripts/cc.txt,ntw,* $+ %istriggeredit $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    write -ds" $+ %istriggeredit $+ " scripts/cc.txt | write scripts/cc.txt %istriggert 
    msg $chan The trigger %istriggeredit has been edited...hopefuly? | run -ns: scripts/ccftpbatch.bat
    unset %istriggeredit
    unset %istriggert 
  }
  elseif ($1 == !search) {
    set %istriggersearch $2
    elseif (!$3) { msg $chan not the correct parameters | halt }
    elseif (!$read(scripts/cc.txt,nts,* $+ %istriggersearch $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    msg $chan searching %istriggersearch
    filter -ff scripts/cc.txt scripts/temp.txt * $+ %istriggersearch $+ * 
    .play -pq3f1m1 $chan scripts/temp.txt 2000
    remove scripts/temp.txt
    unset %istriggersearch
  }
}


Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
what am i doing wrong? i really want to get this working soon

Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
this should be simple to yall genius' ...please, i need advice; im stuck without a paddle.

Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
UPDATE*
i updated the code below to reflect my fidgeting. i finally got the !delcmd to delete and check properly, i think i got the !addcmd to check for the ! prefix now, but i cant get it to stop adding multiples still??? ive been fiddlin around with the code, and i think thats all thats left for debugging before moving onto securing the code and also fixing the !editcmd section

final goal:
the function of this script should add custom triggers to 3 files plus a backup file with date created blah blah, and check to see if there are duplicates before adding a new trigger thru the use of !addcmd <!trigger>

the second part of this script deletes the <!trigger> found in the trigger list. (ops only)

the !editcmd <!trigger> is not being messed with yet, because id like the !addcmd and !delcmd to work first before i mess with this to also get the right syntax for reading and writing parameters for the code.

the !search <!trigger> is suppose to search the associated .txt file and return in chat all found matching wildcarded <!triggers> (i dont want it showing triggers that dont include the ! prefix. but it can search for words without the ! prefix (there shouldnt be any wrong syntax triggers as detected by !addcmd <!trigger> previously in the script ) i want it to say "no matches found if no results." if not right now its fine. this command is not as important as !addcmd .

please help if you dare to take this project on smile im newish to mirc scripts, but i managed to get this far on a few basic base scripts and alot of google searches.


Code:
on *:TEXT:*:*: {
  if ($1 == !addcmd) && (!* iswmcs $2) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { 
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    write -il1 scripts/cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write scripts/cc.txt $2 $3- | write scripts/cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 scripts/cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 scripts/cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: scripts/ccftpbatch.bat
    .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
  }
  elseif ($1 == !addcmd) && (!* iswmcs $2) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger already exists 1. | halt }
  elseif ($1 == !addcmd) && (!* iswmcs $2) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger already exists 2. | halt }
  elseif ($1 == !addcmd) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick wrong syntax. | halt }

  elseif ($1 == !delcmd) && (!* iswmcs $2) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) {
    set %delmrc on *:TEXT: $+ $2 $+ : $+
    elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    write -dw" %delmrc $+ *" scripts/cc.mrc
    write -dw"* $+ > $2 < $+ *" scripts/cc.html
    write -ds" $+ $2 $+ " scripts/cc.txt
    run -ns: scripts/ccftpbatch.bat
    msg $chan The trigger $2 has been removed...hopefuly? 
    .timer 1 1 load -rs scripts/cc.mrc | .timer 1 1 load -rs scripts/cc.txt | .timer 1 1 load -rs scripts/cc.html
    unset %delmrc
  }
  elseif ($1 == !delcmd) && ($2 != !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger doesnt exists. | halt }
  elseif ($1 == !delcmd) && (!$2 = !$read(scripts/cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger doesnt exists. | halt }

  elseif ($1 == !editcmd) {
    set %istriggeredit $2
    set %istriggert $3 $4-
    if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif (!$3) { msg $chan $nick More parameters needed. | halt }
    elseif (!$read(scripts/cc.txt,ntw,* $+ %istriggeredit $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    write -ds" $+ %istriggeredit $+ " scripts/cc.txt | write scripts/cc.txt %istriggert 
    msg $chan The trigger %istriggeredit has been edited...hopefuly? | run -ns: scripts/ccftpbatch.bat
    unset %istriggeredit
    unset %istriggert 
  }
  elseif ($1 == !search) {
    set %istriggersearch $2
    elseif (!$3) { msg $chan not the correct parameters | halt }
    elseif (!$read(scripts/cc.txt,nts,* $+ %istriggersearch $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
    msg $chan searching %istriggersearch
    filter -ff scripts/cc.txt scripts/temp.txt * $+ %istriggersearch $+ * 
    .play -pq3f1m1 $chan scripts/temp.txt 2000
    remove scripts/temp.txt
    unset %istriggersearch
  }
}

Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
im still having issues with this script. please help me

Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
this is the most current version (not sure if its better then the last lol)

Code:
on *:TEXT:*:*: {
  if ($1 == !addcmd) && ($nick isop $chan) && (!* iswmcs $2) && ($2 != !$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) {  
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    elseif ($1 == !addcmd) && ($nick isop $chan) && (!* !iswm $2) { msg $chan $nick wrong syntax. | halt }
    set %wildcardchk $3-
    ;yes wildcard
    if (*$nick* iswm %wildcardchk) && (*$2* iswm %wildcardchk) { 
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ $chr(32) $+ $chr(42) $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ $chr(42) $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    ;yes wildcard
    elseif (*$nick* !iswm %wildcardchk) && (*$2* iswm %wildcardchk) { 
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ $chr(32) $+ $chr(42) $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ $chr(42) $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    ;no wildcard
    elseif (*$nick* !iswm %wildcardchk) && (*$2* !iswm %wildcardchk) {
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    ;no wildcard
    elseif (*$nick* iswm %wildcardchk) && (*$2* !iswm %wildcardchk) {
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added $2 to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    unset %wildcardchk
  }
  elseif ($1 == !addcmd) && (!$2 = !$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger already exists. | halt }
  elseif ($1 == !addcmd) && (!$2 = !$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ * $+ : $+ *)) { msg $chan $nick This trigger already exists. | halt }
}


elseif ($1 == !delcmd) && ($nick isop $chan) && (!* iswmcs $2) && (!$2 = !$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) {
  set %delmrc on *:TEXT: $+ $2 $+ : $+
  elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
  elseif (!$2) { msg $chan $nick More parameters needed. | halt }
  write -dw" %delmrc $+ $chr(42) $+ *" C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc
  write -dw"* $+ > $2 < $+ *" C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html
  write -ds"* $+ $2 $+ *" C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt
  run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
  msg $chan The trigger $2 has been removed...hopefuly? 
  .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html
  unset %delmrc
}
elseif ($1 == !delcmd) && ($nick isop $chan) && ($2 != $read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ *)) { msg $chan $nick This trigger doesnt exists. | halt }
elseif ($1 == !delcmd) && ($nick isop $chan) && (!$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ *)) { msg $chan $nick This trigger doesnt exists. | halt }
elseif ($1 == !editcmd) {
  set %istriggeredit $2
  set %istriggert $3 $4-
  if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
  elseif (!$3) { msg $chan $nick More parameters needed. | halt }
  elseif (!$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt,ntw,* $+ %istriggeredit $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
  write -ds" $+ %istriggeredit $+ " C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt %istriggert 
  msg $chan The trigger %istriggeredit has been edited...hopefuly? | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
  unset %istriggeredit
  unset %istriggert 
}
elseif ($1 == !search) {
  set %istriggersearch $2-
  elseif (!$3) { msg $chan not the correct parameters | halt }
  elseif (!$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt,nts,* $+ %istriggersearch $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
  msg $chan searching %istriggersearch
  filter -ff C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt * $+ %istriggersearch $+ * 
  .play -pq3f1m1 $chan C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt 2000
  remove C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt
  unset %istriggersearch
}

Last edited by bandbonjtv; 15/03/13 09:30 AM. Reason: added code tags
Joined: Oct 2012
Posts: 16
B
Pikka bird
OP Offline
Pikka bird
B
Joined: Oct 2012
Posts: 16
i finally got it...still need help with !editcmd tho. but i havent been messin around with it too much recently. anyways wanted to share the final results of a working set of codes. i hope somebody can use this somewhere. i know there are other ones out there that do the same thing too, but i couldnt find the package i liked that updated an html page everytime a new command was added. you must also include your own batch files, and html page in the appropriate locations. any suggestions are welcome.

Code:
;;;;;;;;;;;;;ADD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
on *:TEXT:*:*: {
  if ($1 == !addcmd) && ($nick isop $chan) && (!* iswmcs $2) && (!$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) {
    elseif (!$2) { msg $chan $nick More parameters needed. | halt }
    elseif ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
    elseif ($2 == !addcmd) || ($2 == !delcmd)  || ($2 == ! $+ $null) { msg $chan $nick Primary triggers cant be set. | halt }
    elseif ($1 == !addcmd) && ($nick isop $chan) && (!* !iswm $2) { msg $chan $nick wrong syntax. | halt }
    set %wildcardchk $3-
    ;yes wildcard
    if (*$nick* iswm %wildcardchk) && (*$2* iswm %wildcardchk) { 
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ $chr(32) $+ $chr(42) $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ $chr(42) $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added " $+ $2 $+ " to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    ;yes wildcard
    elseif (*$nick* !iswm %wildcardchk) && (*$2* iswm %wildcardchk) { 
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ $chr(32) $+ $chr(42) $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ $chr(42) $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added " $+ $2 $+ " to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    ;no wildcard
    elseif (*$nick* !iswm %wildcardchk) && (*$2* !iswm %wildcardchk) {
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added " $+ $2 $+ " to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    ;no wildcard
    elseif (*$nick* iswm %wildcardchk) && (*$2* !iswm %wildcardchk) {
      write -il1 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc on *:TEXT: $+ $2 $+ : $+ $chr(35) $+ : { describe $chr(35) $3- } | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt $2 $3- | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc1.txt $2 $3- $chr(91) $+ CREATED BY $+ $chr(93) $nick | /write -l4 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html This page was modified on: $date(ddd mmm dd $+ $chr(44) yyyy) $chr(64) $time(h:nntt) <br><ol> | write -il7 C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> <td> $3- </td></tr> | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
      .timer 1 1 describe # $nick added " $+ $2 $+ " to $me $+ . Thank you for your addition. Click http://tinyurl.com/all-bot-commands for the complete list of commands. 
      .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html 
    }
    unset %wildcardchk
    elseif ($1 == !addcmd) && ($nick isop $chan) && (!* iswmcs $2) && ($read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger already exists. | halt }
  }
  
;;;;;;;;;;;;;;SEARCH;;;;;;;;;;;;;;;;; 
  elseif ($1 == !searchcmd) {
    set %istriggersearch $2- 
    if (!$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt,ntw,* $+ $2- $+ *)) { msg # Sorry $nick $+ , No Results. | halt }
    describe # Searching Command List for $2-
    filter -ff C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt * $+ $2- $+ *
    .play -pq3l1m3 # C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt 2000 | .play -pq3l2m3 # C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt 2000 | .play -pq3l3m3 # C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt 2000
    remove C:\Users\CGI\AppData\Roaming\mIRC\scripts\temp.txt
    unset %istriggersearch
  }
  
;;;;;;;;;;;;;;;;;;;;DELCMD;;;;;;;;;;;;;;; 
  elseif ($1 == !delcmd) && ($nick == mwconjtv1) && (!* iswmcs $2) && ($read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) {
    elseif ($1 == !delcmd) && ($nick != mwconjtv1) { msg # $nick not enough access. | halt }
    elseif ($1 == !delcmd) && (!$2) { msg $chan $nick More parameters needed. | halt }
    set %istriggerdel $2 $+
    set %delhtml <tr><td  $+ $chr(32) $+ nowrap $+ $chr(61) $+ $chr(34) $+ nowrap $+ $chr(34) $+ > $+ $chr(32) $+ $2 $+ $chr(32) $+ </td> $+ 
    set %delmrc on *:TEXT: $+ $2 $+ : $+ 
    write -dw"* $+ %delmrc $+ *" C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc
    write -dw"* $+ $2 $+ *" C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html
    write -dw"* $+ $2 $+ *" C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt
    run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
    msg $chan The trigger $2 has been removed. 
    .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | .timer 1 1 load -rs C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.html
    unset %istriggerdel
    unset %delhtml
    unset %delmrc
  }
  elseif ($1 == !delcmd) && ($2 != !$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.mrc,ntw,* $+ : $+ $2 $+ : $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
}



Below is the editcmd i need help with to mix in the above somewhere
Code:
elseif ($1 == !editcmd) {
  set %istriggeredit $2
  set %istriggert $3 $4-
  if ($nick !isop $chan) { msg $chan $nick not enough access. | halt }
  elseif (!$3) { msg $chan $nick More parameters needed. | halt }
  elseif (!$read(C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt,ntw,* $+ %istriggeredit $+ *)) { msg $chan $nick This trigger doesnt exist. | halt }
  write -ds" $+ %istriggeredit $+ " C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt | write C:\Users\CGI\AppData\Roaming\mIRC\scripts\cc.txt %istriggert 
  msg $chan The trigger %istriggeredit has been edited...hopefuly? | run -ns: C:\Users\CGI\AppData\Roaming\mIRC\scripts\ccftpbatch.bat
  unset %istriggeredit
  unset %istriggert 
}



Link Copied to Clipboard