Send a dedication
mIRC Code
+ 0 likes
Please Register to submit score.
| Average Score | 4.0 (of 1 scores) |
| Date Added | Oct 16, 2009 |
| Last Updated | Oct 16, 2009 |
| Tags | dedicate dedication songs youtube |
Introduction
Its just a little snippet that allows you to send a song dedication to another user in the channel along with a youtube link.
[!@]dedi|dedication <targetnick> <song/artist> <song/artist>
| Code: |
[16:03] <Riffpilgrim> !dedicate darkdan alter bridge broken wings [16:03] -Bot- ((Dedication)) Dedication sent to darkdan! [16:19] <Riffpilgrim> !dedi riffpilgrim I shot the sheriff Eric clapton [16:19] -Bot- ((Dedication)) Riffpilgrim has dedicated: I shot the sheriff Eric clapton to you! [Associated video] www.youtube.com/watch?v=10qLYy6hiFQ |
heres a color alias also just incase you don't have one already:
| Code: |
| alias c1 return $+($chr(3),07,$1-,$chr(3)) alias c2 return $+($chr(3),14,$1-,$chr(3)) |
Its just something a bit different I originally made for my bot Beard on the swiftirc network, hope you like it.
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 1:03 pm
Posted on Oct 16, 2009 1:03 pm
Should add the . trigger, as a lot of people use it for speed over ! trigger.
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 3:08 pm
Posted on Oct 16, 2009 3:08 pm
| Code: |
| if (*id="video-main-content-* iswm %url) { noop $regex(%url,/id="video-main-content-(.+?)"/i) |
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 3:21 pm
Posted on Oct 16, 2009 3:21 pm
Thats a good point, I didn't think of that at the time - I'm not the most logical of thinkers really.
Changed, thanks for the tip sunslayer :)
Changed, thanks for the tip sunslayer :)
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 4:22 pm
Posted on Oct 16, 2009 4:22 pm
You regex trigger can be simplified to:
since that'll catch dedi or dedicate. I don't see the need for grouping...
Then again, if you only want to match for (!@)dedi and (!@)dedicate exactly, you can do:
Or
| Code: |
| on $*:text:/^([!@]dedi)/Si:#: { |
Then again, if you only want to match for (!@)dedi and (!@)dedicate exactly, you can do:
| Code: |
| on $*:text:/^[!@](\w+)/Si:#: { if ($regml(1) == dedi) || ($regml(1) == dedicate) { ... } |
| Code: |
| on $*:text:/^[!@](\w+)/Si:#: { if ($istok(dedi dedicate,$regml(1),32)) { ... |
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 7:08 pm
Posted on Oct 16, 2009 7:08 pm
Maybe Riffpilgrim meant:
/^[!@]dedicat(e|ion)/Si
/^[!@]dedicat(e|ion)/Si
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 7:27 pm
Posted on Oct 16, 2009 7:27 pm
To me:
does not seem simplified, if anything you are complicating things. I was indeed aiming for it to just match "dedi" or "dedicate".
Is it ever so necessary for every comment to be a criticism of the trigger?
As much as I appreciate it as I do have alot still to learn about regex maybe give me a little feedback on the rest of it too? :D
| Quote: |
| on $*:text:/^[!@](\w+)/Si:#: { if ($regml(1) == dedi) || ($regml(1) == dedicate) { ... } Or Code: on $*:text:/^[!@](\w+)/Si:#: { if ($istok(dedi dedicate,$regml(1),32)) { |
does not seem simplified, if anything you are complicating things. I was indeed aiming for it to just match "dedi" or "dedicate".
Is it ever so necessary for every comment to be a criticism of the trigger?
As much as I appreciate it as I do have alot still to learn about regex maybe give me a little feedback on the rest of it too? :D
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 7:41 pm
Posted on Oct 16, 2009 7:41 pm
| Quote: |
| Is it ever so necessary for every comment to be a criticism of the trigger? |
| Code: |
| if (!$2) || (!$3) || ($2 !ison $chan) { .notice $nick $logo(Error) Please specify a song/nick $chr(124) !dedication <nick> <song> <artist> | halt } |
| Code: |
| if ($left($1,1) == !) .notice $nick $logo(Dedication) $c2(Dedication sent to $2 $+ !) |
| Code: |
| hadd -m $sockname end $regml(1) |
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 8:22 pm
Posted on Oct 16, 2009 8:22 pm
Well whatever you want to do with the trigger.
Add the \b (boundary) such that it matches on
!dedi !dedicate and !dedication since without
the \b it was gonna match on !dedication anyway
and anything that followed !dedi command.
You could rearrange the whole if !$2 || !$3
to be as follows. No need for %whom just use $2
Only the first hadd needs the -m and %dedi
can be used for the whole hash table name one
time like below.
You may want to add flood protection.
Add the \b (boundary) such that it matches on
!dedi !dedicate and !dedication since without
the \b it was gonna match on !dedication anyway
and anything that followed !dedi command.
You could rearrange the whole if !$2 || !$3
to be as follows. No need for %whom just use $2
Only the first hadd needs the -m and %dedi
can be used for the whole hash table name one
time like below.
You may want to add flood protection.
| Code: |
| on $*:text:/^[!@]dedi(cate|cation)?\b/Si:#: { if ($3) && ($2 ison #) { if ($left($1,1) == !) .notice $nick $logo(Dedication) $c2(Dedication sent to $2 $+ !) var %dedi $+(durl.,$right($ticks,5)) hadd -m %dedi whom $2 hadd %dedi from $nick hadd %dedi info $replace($3-,$chr(32),+) hadd %dedi send $iif($left($1,1) == @,.msg #,.notice $2) hadd %dedi ornot $iif($left($1,1) == @,to1 $2,to you!)) sockopen %dedi www.youtube.com 80 } else { .notice $nick $logo(Error) Please specify a song/nick $chr(124) !dedication <nick> <song> <artist> } } |
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 8:29 pm
Posted on Oct 16, 2009 8:29 pm
| Quote: |
Code: if (!$2) || (!$3) || ($2 !ison $chan) { .notice $nick $logo(Error) Please specify a song/nick $chr(124) !dedication <nick> <song> <artist> | halt } you could remove the !$2 part of the /if statement seeing as if $2 isnt on $chan it wouldnt matter if there was a $2? |
I can see what you mean however, in the unlikely event that someone in the channel shares the same name as the dedication i think it should stay in :p
| Quote: |
Code: if ($left($1,1) == !) .notice $nick $logo(Dedication) $c2(Dedication sent to $2 $+ !) may be deliberate but i dont see anything for if $left($1,1) == @ |
This was deliberate to prevent ".notice $nick $logo(Dedication) $c2(Dedication sent to $2 $+ !)" occurring if the command is used publicly, theres no point displaying the message if they can see the result in the channel.
| Quote: |
Code: hadd -m $sockname end $regml(1) seems redundant if ur just gonna free the table in a few lines comepared to just using $regml(1) instead of $hget($sockname,end) |
This however, is very true thanks for pointing it out.
I wasn't expecting to come under as much scrutiny as this :o
& thanks gooshie about the hash tables, i wasn't aware that -m can be used once, when the table is created. Also, this snippet was originally made for my bot which has flood protection - the snippet performs the task outlined and simple flood protection can be added easily.
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 8:51 pm
Posted on Oct 16, 2009 8:51 pm
Riffpilgrim
Scroll up to my previous post. All that
!$2 !$3 !ison negative logic can be rearranged
and simplified to give same results as your
original with less keystrokes and easier to read.
Scroll up to my previous post. All that
!$2 !$3 !ison negative logic can be rearranged
and simplified to give same results as your
original with less keystrokes and easier to read.
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 9:28 pm
Posted on Oct 16, 2009 9:28 pm
Interesting use of hashtables Riffpilgrim :)
I was just curious why you didn't just use /Sockmark
Your code looks nice and neat except for this redundancy.
--->> $+(durl.,%dedi) <<---
You use it 6 times so it should be a variable like %sockname
Since %dedi is only used with $+(durl.,%dedi)
I would suggest something like this
And then just use %sockname instead of $+(durl.,%dedi)
Good working code though Riffpilgrim :)
I was just curious why you didn't just use /Sockmark
Your code looks nice and neat except for this redundancy.
--->> $+(durl.,%dedi) <<---
You use it 6 times so it should be a variable like %sockname
Since %dedi is only used with $+(durl.,%dedi)
I would suggest something like this
| Code: |
| var %sockname $+(durl.,$right($ticks,5)),%whom $2 |
And then just use %sockname instead of $+(durl.,%dedi)
Good working code though Riffpilgrim :)
mIRC Snippet:
Send a dedication
Posted on Oct 16, 2009 11:56 pm
Posted on Oct 16, 2009 11:56 pm
| Quote: |
| Is it ever so necessary for every comment to be a criticism of the trigger |
mIRC Snippet:
Send a dedication
Posted on Oct 17, 2009 6:24 am
Posted on Oct 17, 2009 6:24 am
| Quote: |
| Quote: Is it ever so necessary for every comment to be a criticism of the trigger Actually if you see it as an "open discussion," rather than a "criticism," it can benefit every one of us to learn from each other and gain more knowledge. |
Agreed.
-Cool gooshie I shall steer towards your method next time :)
-fordlawnmower, good idea about using a variable to store the sockname throughout the opening hash table. :D As for using sockmark instead, I simply havn't tried it yet- I think I will give it a go next time though :)
Thanks for the feedback guys
mIRC Snippet:
Send a dedication
Posted on Oct 17, 2009 8:14 am
Posted on Oct 17, 2009 8:14 am
btw.. i had already mentioned the
hash table name in my earlier post.
hash table name in my earlier post.
mIRC Snippet:
Send a dedication
Posted on Oct 17, 2009 8:43 am
Posted on Oct 17, 2009 8:43 am
Yes I know sorry but your antiflood link distracted me enough to forget you had mentioned it XD




