I've just got back from a 9 year scripting break, then I started using AMIP and understood that I had to pick it up again :) So here's my first real attempt on something "usefull" :)
I know that there's some AMIP scripts out there allready, but I haven't found anyone like this so far.
The first version of ACP is
The AMIP DDE name must be mplug or mPlug.
I could probably have made a nicer code, but it works for now :)
EDIT:
Plans for the future
Probably will think out more as the time goes by, but that's what I've got so far
;===========================
; AMIP Control Panel v1.0 Beta
; Written by Ayon
;===========================
on 1:LOAD:{
echo -at ========================
echo -at AMIP Control Panel v1.0
echo -at Written by Ayon
echo -at ========================
echo -at Right-click on any channel to open
echo -at the ACP. The menu will be hidden if
echo -at the AMIP plugin isn't found.
echo -at Commands:
echo -at /amip cp - Opens the control panel
echo -at /amip help - Opens the help dialog
echo -at ========================
if (!$exists($+($scriptdir,amip.ini))) { amip makeini }
}
alias amip {
if ($1 == cp) { $iif($isdde(mplug), dialog -m amip amip, echo -at ACP > Could not find an active instance of AMIP) }
elseif ($1 == help) { dialog -m amiphelp amiphelp }
elseif ($1 == makeini) {
writeini $+($scriptdir,amip.ini) display files np: [name] :: [etime]/[time] ([prc]%) :: [br]Kbps/[sr]kHz/[mode] :: Powered by ACP v1.0 ::
writeini $+($scriptdir,amip.ini) display stream np: [name] :: [etime] :: Stream :: Powered by ACP v1.0 ::
writeini $+($scriptdir,amip.ini) config announce public
writeini $+($scriptdir,amip.ini) config allchans 0
}
elseif ($1 == saveini) {
if ($did(amip,11) != $amip(display,files)) {
var %x = 1
var %amip.fdisp
while ($did(amip,11).lines >= %x) {
var %amip.fdisp = %amip.fdisp $did(amip,11,%x)
inc %x
}
writeini $+($scriptdir,amip.ini) display files $replace(%amip.fdisp,,{b},,{c})
}
if ($did(amip,12) != $amip(display,stream)) {
var %x = 1
var %amip.sdisp
while ($did(amip,12).lines >= %x) {
var %amip.sdisp = %amip.sdisp $did(amip,12,%x)
inc %x
}
writeini $+($scriptdir,amip.ini) display stream $replace(%amip.sdisp,,{b},,{c})
}
writeini $+($scriptdir,amip.ini) config announce $iif($did(amip,8).state, public, private)
writeini $+($scriptdir,amip.ini) config allchans $did(amip,10).state
dde mplug setrepeat $iif($did(amip,18).state, on, off)
dde mplug setshuffle $iif($did(amip,19).state, on, off)
}
else { return $readini($+($scriptdir,amip.ini),$1,$2) }
}
alias amipnp {
if (!$exists($+($scriptdir,amip.ini))) { echo -at ACP > Missing config file (amip.ini). Launch the control panel to create a new default config file automaticly. | return }
var %amip.output = $amip(display,$iif($dde(mplug,var_stream),stream,files))
var %amip.vars = $regex(%amip.output,/\[([^\]]+)\]/g)
var %x = 1
while (%amip.vars >= %x) {
if ($regml(%x) == time) { var %amip.output = $replace(%amip.output,[time],$+($dde(mplug,var_min),:,$dde(mplug,var_sec))) | goto continue }
if ($regml(%x) == etime) { var %amip.output = $replace(%amip.output,[etime],$+($dde(mplug,var_pm),:,$dde(mplug,var_ps))) | goto continue }
if ($regml(%x) == ltime) { var %amip.output = $replace(%amip.output,[ltime],$+($iif(!$dde(mplug,var_mil),00,$dde(mplug,var_mil)),:,$iif(!$dde(mplug,var_sel),00,$dde(mplug,var_sel)))) | goto continue }
var %amip.output = $replace(%amip.output,$+([,$regml(%x),]),$dde(mplug,$+(var_,$regml(%x))))
:continue
inc %x
}
$iif($amip(config,announce) == public, $iif($amip(config,allchans), amsg, msg $active), echo -at) $replace(%amip.output,{b},,{c},)
}
dialog amip {
title "AMIP Control Panel v1.0 by Ayon"
size -1 -1 166 113
option dbu
menu "&File", 1
item "&Save", 3, 1
item break, 2, 1
item "&Close", 4, 1, cancel
tab "Settings", 5, 4 0 159 99
tab "Display", 6
box "Announcement", 7, 8 16 82 34, tab 5
radio "Public", 8, 12 24 26 10, group tab 5
radio "Private", 9, 56 24 26 10, group tab 5
check "All channels", 10, 12 36 38 10, tab 5
edit "", 11, 8 24 150 30, tab 6 multi autovs
edit "", 12, 8 64 150 30, tab 6 multi autovs
text "Files:", 13, 8 16 13 8, tab 6
text "Streams:", 14, 8 56 22 8, tab 6
button "Help", 15, 58 100 33 12
button "Save", 16, 94 100 33 12
button "Close", 27, 130 100 33 12, ok cancel
box "Player config", 17, 92 16 66 34, tab 5
check "Repeat", 18, 96 24 58 10, tab 5 push
check "Shuffle", 19, 96 36 58 10, tab 5 push
box "AMIP config", 20, 28 52 114 44, tab 5
button "Playlist search", 21, 32 72 49 10, tab 5
button "Open AMIP config", 22, 32 60 49 10, tab 5
button "Reindex playlist", 23, 60 84 49 10, tab 5
button "Clear local", 24, 88 60 49 10, tab 5
button "Clear cache", 25, 88 72 49 10, tab 5
link "AMIP Variables", 26, 4 102 38 8
}
dialog amiphelp {
title "ACP Help"
size -1 -1 174 170
option dbu
text "About:", 1, 4 4 17 8
text "ACP is a small and easy to use AMIP control panel for mIRC.", 2, 4 12 146 8
text "How to use it:", 3, 4 60 34 8
text "It's built to make it easy to change how song info is showed announced. You can define if the announcement should be sent to you privately, or public. If you select public you can also decide whether to announce only to the active channel or to all channels on a network.", 4, 4 20 166 36
text "It supports all AMIP variables. To trigger a variable you just wrap the variable name inside square brackets.", 5, 4 68 165 16
text "Example:", 6, 4 120 145 8
text "[name] :: [etime]/[time] ([prc]%) :: [br]Kbps/[sr]kHz/[mode]", 7, 4 128 145 8
text "Result:", 8, 4 136 145 8
text "Tatanka - Let's Rock :: 00:12/04:33 (4%) :: 192Kbps/44kHz/Stereo", 9, 4 144 165 8
button "Close", 10, 68 156 37 12, ok cancel
text "Other variables:", 11, 4 84 39 8
text "[time]", 12, 4 92 14 8
text "[etime]", 13, 4 100 17 8
text "[ltime]", 14, 4 108 15 8
text "Returns time left", 15, 28 108 40 8
text "Returns elapsed time", 16, 28 100 51 8
text "Returns total time", 17, 28 92 43 8
}
on 1:DIALOG:amip:init:*:{
if (!$exists($+($scriptdir,amip.ini))) { amip makeini | echo -at ACP > A new default config file was succsessfully created. }
did -c amip $iif($amip(config,announce) == public, 8, 9)
did -a amip 11 $replace($readini($+($scriptdir,amip.ini),n,display,files),{c},,{b},)
did -a amip 12 $replace($readini($+($scriptdir,amip.ini),n,display,stream),{c},,{b},)
if ($amip(config,announce) == private) { did -b amip 10 }
$iif($amip(config,allchans), did -c amip 10)
$iif($dde(mplug,var_repeat) == on, did -c amip 18)
$iif($dde(mplug,var_shuffle) == on, did -c amip 19)
}
on 1:DIALOG:amip:sclick:*:{
if ($did == 8) { did -u amip 9 | did -e amip 10 }
if ($did == 9) { did -u amip 8 | did -b amip 10 }
if ($did == 15) { dialog -m amiphelp amiphelp }
if ($did == 16) { amip saveini }
if ($did == 21) { dde mplug search }
if ($did == 22) { dde mplug options }
if ($did == 23) { dde mplug reindex }
if ($did == 24) { dde mplug clear | echo -at ACP > Cleared local playlist (search results), and cached player playlist. }
if ($did == 25) { dde mplug clearcache | echo -at ACP > Cleared cached song information. }
if ($did == 26) { url http://amip.tools-for.net/wiki/manual/amip }
}
menu channel,query {
$iif($isdde(mplug), ACP)
.Control Panel:amip cp
.-
.$iif($dde(mplug,var_playing),Announce,$style(2) Not playing):amipnp
.-
.Previous:dde mplug control <
.Play/Pause:dde mplug $iif(!$dde(mplug,var_playing), Play, control pause)
.Next:dde mplug control >
}