Hello, I created a snippet.
I wanted a music script in my bot, that every 60 seconds the song shows.
But the script does, now everytime says the Same song the same and number.
Bit, if i say ]music now, than says my bot the correct number and time
Does anyone have a tip, why my bot every time this says.
Sorry for my bad english, but my English is not that good.
on *:TEXT:]music *:*: {
set %music $dde(mPlug,format,"4Muziek:_%name_[%4]_(%pm:%ps/%min:%sec)_[%br~Kbps_-_%sr~KHz_-_%typ]")
set %time timer 0 60
if ($2 == on) {
if ($readini(Lotk.ini, $address($nick,2), access) >= 800) {
%time msg # $dde(mPlug,format,"4Muziek:_%name_[%4]_(%pm:%ps/%min:%sec)_[%br~Kbps_-_%sr~KHz_-_%typ]")
msg # Music player is now on
unset %music
}
else { notice $nick You need access level 800 to perform this command. | HALT }
}
if ($2 == now) {
if ($readini(Lotk.ini, $address($nick,2), Access) >= 800) || ($readini($chan $+ Lotk.ini, $address($nick,2), Access) >= 800) {
msg # %music
}
else { notice $nick You need access level 800 to perform this command. | HALT }
}
if ($2 == off) {
if ($readini(Lotk.ini, $address($nick,2), access) >= 800) {
timers off
msg # Music player is now off
}
else { notice $nick You need access level 800 to perform this command. | HALT }
}
}
@Fuzionx
Thanks, it works now.
14:53:25 30/11/11 » @Gekkegast « ]music on
14:53:25 30/11/11 » @Lotk « Music player is now on
14:53:31 30/11/11 » @Lotk « Muziek: Benton - New-ro-phen [] (00:13/05:36) [320Kbps - 44KHz - Stereo]
14:53:35 30/11/11 » @Lotk « Muziek: Benton - New-ro-phen [] (00:18/05:36) [320Kbps - 44KHz - Stereo]
14:53:41 30/11/11 » @Lotk « Muziek: Benton - New-ro-phen [] (00:23/05:36) [320Kbps - 44KHz - Stereo]
The $dde() identifier is being evaluated when you start the timer and not when it fires. You store the current song in the timer and than say it every 60 seconds.
Dutch: Het commando $dde() word uitgevoerd wanneer jij de timer start, en niet als de timer afgaat (elke 60 seconden dus). Het liedje wat op dat moment aan staat word in de timer opgeslagen en die zegt het gewoon elke 60 seconden. Voorbeeld: Je luistert het liedje "David Guetta - Titanium" en je voert dit commando uit:
%time msg # $dde(mPlug,format,"4Muziek:_%name_[%4]_(%pm:%ps/%min:%sec)_[%br~Kbps_-_%sr~KHz_-_%typ]")
Dan zet hij dit in de timer:
You should make an alias for messaging the current song and excecute that every 60 seconds.
Dutch: Je moet een alias maken die het huidige liedje messaged naar de channel en die elke 60 seconden uitvoeren. Voorbeeld:
; The alias
alias nowplaying {
if ($me ison $$1) {
msg $1 $dde(mPlug,format,"4Muziek:_%name_[%4]_(%pm:%ps/%min:%sec)_[%br~Kbps_-_%sr~KHz_-_%typ]")
}
}
; The timer
timer 0 60 nowplaying $chan
This way it should message the current playing song everytime.
Dutch: met deze manier word elke keer het huidige liedje gemessaged naar de channel