|
EffingHell
|
EffingHell
|
Hi, I was wondering if i could trigger an mp3 in my bot, with something like !play, !random, !stop, !shuffle etc..
;/ I don't know how to make an mp3 player do this though..
In a script bot ofcourse
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
Here's a simple one..
alias mp3 {
set %mp3dir $$sdir=" Set Mp3 Directory: "
write -c mp3.txt
noop $findfile(%mp3dir,*.mp3,0,write mp3.txt $1-)
}
on $*:text:/!(play|stop|pause|resume|random)/Si:*:{
if ($isfile(mp3.txt)) {
if ($1 == !random) splay $read(mp3.txt,$r(1,$lines(mp3.txt)))
if ($1 == !play) splay $read(mp3.txt,$2)
if ($1 == !stop) splay stop
if ($1 == !pause) splay pause
if ($1 == !resume) splay resume
}
}
Simple put this in your bot, type /mp3 to set your directory. And in your mIRC/Script type the above commands. !play 5 - Plays the fifth mp3 in your mp3 file, etc. It's just a pretty basic one as I have to go out now, I'm sure you'll get more responsive replies soon.
|
|
|
|
EffingHell
|
EffingHell
|
Is there anyway to get it to spam?
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
alias mp3 {
set %mp3dir $$sdir=" Set Mp3 Directory: "
write -c mp3.txt
noop $findfile(%mp3dir,*.mp3,0,write mp3.txt $1-)
}
on $*:text:/!(play|stop|pause|resume|random)/Si:*:{
if ($isfile(mp3.txt)) {
var %target = $iif($target ischan,$chan,$nick)
if ($1 == !random) { splay $read(mp3.txt) | msg %target I'm now randomly playing $nopath($insong.fname) }
if ($1 == !play) { splay $read(mp3.txt,$2) | msg %target I'm now playing $nopath($read(mp3.txt,$2)) }
if ($1 == !stop) {
if ($insong) { splay stop | msg %target Song stopped }
else { msg %target Song not started }
}
if ($1 == !pause) {
if ($insong) && (!$insong.pause) { splay pause | msg %target Song stopped. }
}
if ($1 == !resume) {
if ($insong) && ($insong.pause) { splay resume | msg %target Song resumed. }
}
}
}
|
|
|
|
EffingHell
|
EffingHell
|
I know this is really annoying, But is there any way to get it to play my songs in alphabetical order? because they are all jumbled up ;/
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Without side tracking the topic to much. Could you explain this little line? on $*:text:/!(play|stop|pause|resume|random)/Si:*:{ Is the $ required for the !triggers ? What's the /Si part? Never seen this kind of combining before... Thx 
|
|
|
|
Joined: Mar 2005
Posts: 420
Fjord artisan
|
Fjord artisan
Joined: Mar 2005
Posts: 420 |
the $ means that regex is being used in the event. Im not into regex yet but what I could tell is that any word that matches the words listed then the event will be triggered. Google for some regex tutorial 
|
|
|
|
Joined: Nov 2006
Posts: 1,552
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,552 |
Well, the $ prefix makes matching text a regex (therefore the /regex/) S > applies "strip control codes" i > applies "case insensitivity" to the regex
|
|
|
|
EffingHell
|
EffingHell
|
Post deleted by EffingHell
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
You just nailed it with the if ($nick == <somenick>) didn't you try it?
on $*:text:/!(play|stop|pause|resume|random)/Si:*:{
if ($nick == YourNick) {
if ($isfile(mp3.txt)) {
var %target = $iif($target ischan,$chan,$nick)
if ($1 == !random) { splay $read(mp3.txt) | msg %target I'm now randomly playing $nopath($insong.fname) }
if ($1 == !play) { splay $read(mp3.txt,$2) | msg %target I'm now playing $nopath($read(mp3.txt,$2)) }
if ($1 == !stop) {
if ($insong) { splay stop | msg %target Song stopped }
else { msg %target Song not started }
}
if ($1 == !pause) {
if ($insong) && (!$insong.pause) { splay pause | msg %target Song stopped. }
}
if ($1 == !resume) {
if ($insong) && ($insong.pause) { splay resume | msg %target Song resumed. }
}
}
}
}
|
|
|
|
EffingHell
|
EffingHell
|
!pause just stops the song and !resume restarts it :[
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
It shouldn't do, it works for me. Change:
if ($insong) && (!$insong.pause) { splay pause | msg %target Song stopped. }
to
if ($insong) && (!$insong.pause) { splay pause | msg %target Song paused. }
|
|
|
|
|