Advertisement
coreag

msplay

Dec 30th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 65.13 KB | None | 0 0
  1. ;# msplay_beta_v600 Pre 1.0 Remake
  2. ;# Created by Sporc & Naki
  3. ;# 09/28/2007 1:00am EST
  4.  
  5. /*
  6. v5-v5.3.6
  7. -Took scorps original sound script, soundchit5 and Modified it so it was smaller
  8. --Script consisted of two parts, msound and msplay
  9. ---Did away with msound and made it all as msplay using a lot of $iif()
  10. -Added a bunch of new features to the script
  11. --Added F'key support
  12. ---F8 - Plays random family guy file
  13. ---F7 - Specify file play
  14. ---sF5 - Makes a dumplist of all the sound files in your $mp3dir
  15. -Cant remember what else i did... heh
  16. v5.4.0
  17. -Added timestamps
  18. -Added F'key support
  19. -- sF6 - Toggles CTCP for msplay on and off
  20. -Bug Fixes
  21. --Fixed double send bug
  22. --Fixed no file bug
  23. --Fixed bugs concerning new sound alias
  24. v5.4.3
  25. -Added some shit but cant remember (sux)
  26. -Bug Fixes
  27. --Fixed number issue with $msvar
  28. v5.4.6
  29. -Changed $2 to $2- in Sound to take in consideration of filename with spaces.
  30. v5.5.0
  31. -Complete overhaul on msplay/easyfs/sound commands
  32. v5.5.2
  33. - Scorp pointed out to me a huge flaw in the system. It is fixed now! hopefully
  34. v552 Pre 1.0 Remake Beta
  35. -Prepairing script for dialog system for configuration only.
  36. -Changed script from 5.5.2 to a PreBeta
  37. --Did this because basiclly i redid the script to make it more user
  38. friendly instead of having it me friendly.
  39. -$easyfs
  40. --$easyfs is a new version of my first $easyfs so the easyfs in this
  41. script is actually version 2.0 which is used in conjunction with mschk
  42. --- Features of $easyfs
  43. ----easyfs can be used with the %msdir variable to scan a multiple of
  44. directories instead of just one. Usage $easyfs(file,#). the number
  45. 0 returns the number of matches and then 1+ works the same way as
  46. $findfile to return the directory in which the file exist.
  47. -$mschk
  48. --Just checks to see if the file extension is a media type supported by
  49. mIRC.
  50. -msplay - msound
  51. -- changed these so they would no longer conflict with mIRC's default
  52. /sound system.
  53. -Extra Notes
  54. --This version will go from a Prebeta to a full beta once the dialog
  55. for configuration is integrated into the script.
  56. v553
  57. - Integrated dialog configuration into script for a more user friendly configuration.
  58. v555
  59. - Integrated beta work on dialog control for silent playing.
  60. - Integrated beta work on dialog control of allowing sound interruption.
  61. - Attempted to fix filerecieve renaming once a file is sent.
  62. - Need to find a way to allow for multiple file download renaming correctly.
  63. -A way to keep track of which file belongs to which rename.
  64. v556 and v557
  65. -Why the editor didnt add this i dont know. So i wont know what was done
  66. to these two original versions
  67. v558
  68. -Added $msxml which renames files from xml to the file format it was so it plays.
  69. v559
  70. -Removed $msxml because an xml file isn't a sound file.
  71. v560
  72. -Added to options dialog "Enable Function Keys" to toggle the use of the F keys.
  73. -Added Mute MSplay toggle to F1 and popup menu. Allows the user to quickly
  74. mute the incoming sounds playing but still be able to see which sound was played.
  75. v561
  76. - Fixed file recieve renameing. File is only renamed if the filename requires _' be taken out.
  77. v562
  78. - Adding options to include ogg, midi, wma directories.
  79. - Redid the way duplicate internal sound directories are checked when adding to %msdir automaticly.
  80. - Fixed "Function Key" enable and disable function in dialog options.
  81. v563
  82. - Reorganized the configuration dialog into tabs.
  83. - Added user the ability to control which Function button does what.
  84. v564
  85. - Changed text strings in menu and config dialog.
  86. - Dialog rearranged a few things and minor changes.
  87. v565
  88. - Added "Play Search String" option to Function Key control dialog.
  89. Users, can specify the text "*blah*" and it will search for the random match and play it.
  90. v566
  91. - Added checks to msplay so if something is being played, and then another file
  92. format is loaded, the current sound stops and the new sound is played.
  93. v567
  94. - Readded the xml thing cause i got tired of searching 100 times for a song
  95. THAT DOES EXIST
  96. v568
  97. - Fixed a small dialog number problem for the last 2 Function buttons.
  98. - Added an option to dialog (for now) to only request sound file if the filesize
  99. is above the entered byte size.
  100. v570.-1
  101. - Building a new addition to the script that will ignore sounds over a set
  102. filesize.
  103. v571
  104. - In previous versions if multiple files were being recieved, only 1 was named correctly. So...
  105. Fixed the renaming part of the script when a sound file is recieved. File md5 & filename information
  106. is sent to a hash table on the client's side. Once recieved the hash table is checked for a md5
  107. match, if found renames accordingly.
  108. v572
  109. - added basic support for drag and drop must add *.*:/msdad $1- to the drag and drop
  110. menu under options - mouse - drag drop. this is a beta release and is buggy and
  111. only works with files in the %msdir
  112. v573
  113. - added %ms_chkply so the script would stop any sounds unless the user wanted it to
  114. v574
  115. - Finished option for accepting a file only if it's filesize is below the users input limit.
  116. Adding "On new msplay stop current playing sound" to the options dialog to be used with %ms_chkply.
  117. If a new sound is played and a current sound is playing, it will stop the current first. Not to be confused
  118. with same type stopping, as same types get stopped automaticly by mirc.
  119. v575
  120. - Fixed some srequest errors I (scorpwanna) created while adding to 574.
  121. v576
  122. - Added a replay/random switch to msplay so if %msrp is true it will redo the msplay command again after the sound is finished playing
  123. until the timer is deleted
  124. v577
  125. - Adding MSOUND action playing. Option to play either using original CTCP method or as an action.
  126. v578
  127. - Added Display File Info, when playing a sound file the information is shown over chat (only when played as an action).
  128. v579
  129. - Added toggleing for Action/CTCP to Function Keys.
  130. v580
  131. - I think I fixed a problem I created while adding the file info. Seems when a sound was requested it requested the file and info as the filename.
  132. That wasn't good, so using the power of regex I divided it correctly. Should work now.
  133. v581
  134. - Fixed a problem I created while adding the file info. Filenames with .'s in them were ignored and a default file played in it's place while displaying
  135. the correct file.
  136. v582
  137. -Misc. tweaks to the on action section.
  138. v583
  139. - Made it so when MSOUND actions are played and you have allow incoming turned off, it still shows the action but does not show the CTCP event.
  140. Moved the Mute Incoming menu option under MSplay. Cleaned up some echoing. Created an alias to shorten the filesize of all the writeini's used.
  141. v584
  142. - Since mIRC fails to deliever on the ! and $null meaning, I had to change the on load if statements for settings.
  143. Apparently (!$msound(setting)) is not the same as ($msound(setting) == $null) if $msound(setting) returns 0.
  144. v585
  145. - Fixed a bug having to do with the Include sound directories. Was not adding all selected and ignoring accidental duplications.
  146. v586
  147. - Fixed a random glitch in $easyfs. For some odd reason it was adding 2 more found entries when they didn't exist.
  148. Minor config dialog tweaks.
  149. v587
  150. - Adjusted the privmsging for the actions to not display the path of the file for those without this script.
  151. v588
  152. - Upon taking out the file path (so it wouldn't bother those without the script, the md5 lookup didn't have the
  153. file path needed to search so a change up of SREQUEST was needed.
  154. v589
  155. - Playlist function added, but the playlist mode is still in it's testing phase. Added dialog for Adding, Deleteing and Editing Msplay created .m3u playlists.
  156. The playlist editor does not work well with .m3u's created by outside programs such as Winamp and Windows Media Player.
  157. If a file isn't found in a playlist it will go to the next one, this may cause a problem later if each file can't be found it may cause an unstable loop.
  158. v590
  159. - Fixed Deleting a file listed in a playlist. Added a halt to the "is empty list" error so it doesn't just loop forever. Added a 3 non-exist limit to playing files in
  160. a list. If 3 files fail to play, in a list, in a row, pops up a warning rather than get crazy with looping.
  161. v591
  162. - Fixed problem while trying to apply settings in the options dialog. Problem has been there since the beginning, I just forgot to add to write the settings for the
  163. Function keys to defaults of 1. Something had to be selected in the dropdown ID box. Thanks Guyver for finding it so I could fix it.
  164. v592
  165. - Misc. cleaning. Removed the need for the %ms_chkply variable getting set, having the data is stored in the config file and a variable is pointless.
  166. Took out %msigon and various other variables that no longer served a purpose. Lesson'ed the need for some setting of %variables by making some local.
  167. v593
  168. - Minor playlist repair.
  169. v594
  170. - Cleanup. Added goto next playlist if at end of another. Added submenu playlist selection.
  171. v595
  172. - Fixed a bug where when someone would play an MSOUND and if you had the playlist option on, when the sound was done, would make the playlist start.
  173. v595b
  174. - Guyver wanted highlighting.
  175. v596
  176. - added an equation to calculate a start pos on mp3's because mIRC is stupid
  177. v597
  178. - In process of adding a "MSPLAY for dummies" dialog for those who are too lazy to type in /msplay and would rather waste time having to click buttons.
  179. v598
  180. - Changed up the options dialog. naki wanted a minimize button in the "MSPLAY for dummies" dialog so I gave it one, which in turn puts it on the desktop of windows.
  181. Reorganized "MSPLAY for dummies and added a scrollbar.
  182. v599
  183. - Options dialog straightening. Prefixes "@%+" will now be shown if checked "on" in the mirc options. Fixed own msplay coloring. That's right color not colour.
  184. v600
  185. - Adding the use of an external player.
  186. */
  187.  
  188. alias msplayversion { return 600 }
  189.  
  190. alias msplay {
  191.   unset %playlistmodeused %msplay_playlistline
  192.   if ($msoundcfg(enableplaylist) == 1) {
  193.     var %curplaylist = $iif($msoundcfg(curplaylist) == $null,$msoundcfg(playlist),$msoundcfg(curplaylist))
  194.     var %playlist = $+(",$msoundcfg(playlistdir) $+ $gettok(%curplaylist,2,58),")
  195.     set %playlistmodeused $true
  196.     if ($exists(%playlist)) {
  197.       if (($1 isnum) || ($1 == $null)) {
  198.         var %lines = $lines(%playlist), %playfile = $read(%playlist,$1)
  199.         if (%lines) {
  200.           if (%playfile) { set %msplay_playlistline $1 }
  201.           else { %playfile = $read(%playlist,1) | set %msplay_playlistline 1 }
  202.         }
  203.         else { var %dumbass = $input(Playlist is empty dumbass!.,wo,MSPLAY ERROR) | halt }
  204.       }
  205.       else {
  206.         var %lines = $lines(%playlist), %i = 1, %foundonline, %playfile
  207.         while (%lines > 0) {
  208.           var %file = $nopath($read(%playlist, %i))
  209.           if ($1- isin %file) { %foundonline = $readn | goto continue }
  210.           dec %lines | inc %i
  211.         }
  212.         :continue
  213.         if (%foundonline) { %playfile = $read(%playlist,%foundonline) | set %msplay_playlistline %foundonline }
  214.         else { %playfile = $read(%playlist,1) | set %msplay_playlistline 1 }
  215.       }
  216.       echo -ag %playfile $exists(%playfile)
  217.       if ($exists(%playfile)) {
  218.         if (%msplaylistnullcount) { unset %msplaylistnullcount }
  219.         msound $file(%playfile).size %playfile
  220.       }
  221.       if (!$exists(%playfile)) {
  222.         if (%msplaylistnullcount == $null) { set %msplaylistnullcount 1 }
  223.         if (%msplaylistnullcount) {
  224.           inc %msplaylistnullcount
  225.           if (%msplaylistnullcount >= 4) {
  226.             unset %msplaylistnullcount
  227.             var %nads = %msplay_playlistline
  228.             var %range = : $+ $calc(%nads -2) $+ : $+ $calc(%nads -1) $+ : $+ %nads $+ :
  229.             var %lines = : $+ $lines(%playlist) $+ :
  230.             var %dumbass = $input(3 files in the playlist have failed to play in a row. Do you wish to continue playing the list?,wy,MSPLAY ERROR)
  231.             if (%dumbass == $false) { halt }
  232.             if ((%lines isin %range) || (-1 isin %range)) {
  233.               if ($msoundcfg(stopplaylist) == 1) { halt }
  234.               if ($msoundcfg(gotonextplaylist) == 1) {
  235.                 unset %msplay_playlistline
  236.                 gotonextplaylist
  237.               }
  238.             }
  239.           }
  240.         }
  241.         if ($msoundcfg(notfoundwarning) == 1) { var %dumbass = $input(The file in the playlist you are trying to play does not exist anymore or has been moved. Do you want to continue playing? $crlf %playfile,wy,MSPLAY ERROR) }
  242.         if ((%dumbass) || ($msoundcfg(notfoundwarning) != 1)) { .timer 1 0 msplay $calc(%msplay_playlistline +1) }
  243.       }
  244.     }
  245.     else { var %dumbass = $input(The selected playlist does not exist. Check your settings dumbass!.,wo,MSPLAY ERROR) }
  246.     halt
  247.   }
  248.   :start
  249.   if ($msoundcfg(stopcurrent) == 1) {
  250.     if (($insong) || ($inwave) || ($inmidi)) { splay stop }
  251.   }
  252.   var %msfn, %msrpv
  253.   if ($1 == $null) { %msfn = $easyfs(*,$rand(1,$easyfs(*,0))) }
  254.   if ($left($1,1) == $chr(35)) {
  255.     set %mschan $1
  256.     %msrpv = $2
  257.     if ($3) { %msfn = $easyfs($2,$3) | goto sound }
  258.     elseif (($2) && (!$3)) { %msfn = $easyfs($2,$rand(1,$easyfs($2,0))) }
  259.     goto sound
  260.   }
  261.   elseif ($1 isnum) { %msfn = $easyfs(*,$1) | goto sound }
  262.   else {
  263.     if ($2) { %msfn = $easyfs($1,$2) | %msrpv = $1 | goto sound }
  264.     elseif (($1) && (!$2)) { %msfn = $easyfs($1,$rand(1,$easyfs($1,0))) | %msrpv = $1 | goto sound }
  265.   }
  266.   :sound
  267.   var %msdumb = $msext(%msfn)
  268.   if ((%msfn == $null) || (%msfn isnum)) { halt }
  269.   ;if ($gettok(%msfn,-1,46) == xml) { goto start }
  270.   elseif (!%msdumb) { msre | halt }
  271.   else {
  272.     msound $file(%msfn).size %msfn
  273.     if (%msrp) { .timerms -m 1 $calc($sound2(%msfn).length + 1000) msre %msrpv }
  274.   }
  275. }
  276.  
  277. alias msre { msplay $1- }
  278.  
  279. ;on 1:join:#null:{ if (($nick == $me) || ($nick == scorpwanna)) { msplay $chan rb-incominggame.mp3 } }
  280.  
  281. #functionkeys on
  282. alias F1 { funckeycore F1 }
  283. alias F2 { funckeycore F2 }
  284. alias F3 { funckeycore F3 }
  285. alias F4 { funckeycore F4 }
  286. alias F5 { funckeycore F5 }
  287. alias F6 { funckeycore F6 }
  288. alias F7 { funckeycore F7 }
  289. alias F8 { funckeycore F8 }
  290. alias F9 { funckeycore F9 }
  291. alias F10 { funckeycore F10 }
  292. alias F11 { funckeycore F11 }
  293. alias F12 { funckeycore F12 }
  294. #functionkeys end
  295.  
  296. ;Begin Function Key Core
  297. alias -l funckeycore {
  298.   var %func = $gettok($msoundcfg($1),1,44)
  299.   if (%func == 1) { msplay }
  300.   if ((%func == 2) || (%func == 8)) { msplay $gettok($msoundcfg($1),2,44) }
  301.   if (%func == 3) { var %selectfile = $sfile(*.wav,Select Sound File,Play) | if (%selectfile) { msplay $nopath(%selectfile) }  }
  302.   if (%func == 4) { writeini -n $msoundcfgfile settings acceptsrequest $iif($msoundcfg(acceptsrequest) == 0,1,0) | echo $colour(notice) -a $timestamp * The ability to hear incoming sounds has been turned $iif($msoundcfg(acceptsrequest) == 0,Off,On) }
  303.   if (%func == 5) { writeini -n $msoundcfgfile settings mutemsplay $iif($msoundcfg(mutemsplay) == 0,1,0) | echo $colour(notice) -a $timestamp * $iif($msoundcfg(mutemsplay) == 0,Unmuted,Muted) MSplay }
  304.   if (%func == 6) { writeini -n $msoundcfgfile settings soundinterrupt $iif($msoundcfg(soundinterrupt) == 0,1,0) | echo $colour(notice) -a $timestamp * Sound Interruptions are now $iif($msoundcfg(soundinterrupt) == 0,Not Allowed,Allowed) }
  305.   if (%func == 7) { writeini -n $msoundcfgfile settings enablesmode $iif($msoundcfg(enablesmode) == 0,1,0) | echo $colour(notice) -a $timestamp * Silent Mode is now $iif($msoundcfg(enablesmode) == 0,Disabled,Enabled) }
  306.   if (%func == 9) { writeini -n $msoundcfgfile settings stopcurrent $iif($msoundcfg(stopcurrent) == 0,1,0) | echo $colour(notice) -a $timestamp * Stopping Current sound on new sound has been turned $iif($msoundcfg(stopcurrent) == 0,Off,On) }
  307.   if (%func == 10) { writeini -n $msoundcfgfile settings ctcpactionplay $iif($msoundcfg(ctcpactionplay) == 0,1,0) | echo $colour(notice) -a $timestamp * MSound will now play sounds as $iif($msoundcfg(ctcpactionplay) == 0, an ACTION, a CTCP) }
  308.   if (%func == 11) { writeini -n $msoundcfgfile settings enableplaylist $iif($msoundcfg(enableplaylist) == 0,1,0) | echo $colour(notice) -a $timestamp * Playlist Mode is now $iif($msoundcfg(enableplaylist) == 0,Disabled,Enabled)  }
  309. }
  310. ;End Function Key Core
  311.  
  312. alias easyfs {
  313.   var %msnumtok = $gettok(%msdir,0,44), %msgtk, %msisgood, %mschorn, %msnaki, %msscorp, %msomg
  314.   %msgtk = 1
  315.   unset %mssfile_*
  316.   while (%msgtk <= %msnumtok) {
  317.     if ($2 == 0) { set %mssfile_ $+ [ %msgtk ] $findfile($gettok(%msdir,%msgtk,44) , * $+ $1 $+ * ,$2) }
  318.     if ($2 >= 1) {
  319.       %msomg = $2
  320.       %msisgood = $findfile($gettok(%msdir,%msgtk,44),* $+ $1 $+ * , $mschk($2,%msgtk,$1))
  321.       if (%msisgood) {
  322.         return %msisgood
  323.       }
  324.     }
  325.     inc %msgtk 1
  326.   }
  327.   if ($2 == 0) {
  328.     %msnaki = $var(mssfile_*,0)
  329.     %msscorp = 1
  330.     while (%msscorp <= %msnaki) {
  331.       %mschorn = $calc( [ %mssfile_ [ $+ [ %msscorp ] ] ] + %mschorn)
  332.       inc %msscorp 1
  333.     }
  334.     return %mschorn
  335.   }
  336. }
  337.  
  338. alias mschk {
  339.   var %msf
  340.   if ($2 == 1) { return $1 }
  341.   elseif ($2 >= 2) {
  342.     var %msa = 1
  343.     while (%msa <= $2) {
  344.       set %msb_ [ $+ [ $calc($2 - %msa) ] ] $findfile($gettok(%msdir,$calc($2 - %msa),44), * $+ $3 $+ *,0))
  345.       inc %msa 1
  346.     }
  347.     unset %msb_0
  348.     var %msc = 1, %msd
  349.     while (%msc <= $var(msb_*)) {
  350.       %msd = $calc( %msb_ [ $+ [ %msc ] ] + %msd )
  351.       inc %msc 1
  352.     }
  353.     set %mse $calc($easyfs($3,0) - %msd)
  354.     %msf = $calc($1 - %msd)
  355.   }
  356.   unset %msb_* %mse
  357.   return %msf
  358. }
  359.  
  360. alias usvar { unset %msvar | unset %mschan | unset %msf2 | unset %msf3 | unset %msff | unset %msout }
  361.  
  362. alias msound {
  363.   var %fileinfo
  364.   if (($msoundcfg(ctcpactionplay) == 0) && ($msoundcfg(displayfileinfo) == 1)) {
  365.     ;Get file info
  366.     var %filetype, %length, %bitrate, %sample, %mode
  367.     %filetype = $right($2-,3)
  368.     if (%filetype == mp3) {
  369.       %length = $sound($2-).length
  370.       var %length2 = $int($calc(%length * 0.001))
  371.       var %lengthmin = $int($calc(%length2 /60))
  372.       var %lengthsec = $calc(%length2 - $calc(%lengthmin *60))
  373.       %lengthsec = $iif($len(%lengthsec) = 1,0 $+ %lengthsec,%lengthsec)
  374.       %bitrate = $sound($2-).bitrate $+ kbps
  375.       %sample = $sound($2-).sample $+ khz
  376.       %mode = $sound($2-).mode
  377.       %length = %lengthmin $+ : $+ %lengthsec
  378.     }
  379.     %fileinfo = %bitrate %sample %mode %length
  380.   }
  381.   var %caplay = $msoundcfg(ctcpactionplay)
  382.   var %ensmode = $iif($msoundcfg(enablesmode) == 1,SPLAY,SOUND)
  383.   var %prefix = $gettok($readini(mirc.ini,options,n2),30,44)
  384.   %prefix = $iif(%prefix == 1,$iif($me isop #,@))
  385.   echo $colour($iif(%caplay = 1,ctcp,own)) -al $timestamp $iif(%caplay = 1,[M $+ %ensmode,* %prefix $+ $me M $+ %ensmode) $nopath($2-) $+ $iif(%caplay = 1,]) %fileinfo
  386.   if ($msoundcfg(enablesmode) == 0) { PRIVMSG $active $iif(%caplay = 1,MSOUND,ACTION MSOUND) $1 $nopath($2-) %fileinfo $+  }
  387.   var %runexternal = false
  388.   if (($gettok($msoundcfg(useexprogram),1,44) == 1) && ($gettok($msoundcfg(useexprogram),2,44) != $null)) { %runexternal = true }
  389.   if (%runexternal == true) { run -n $+(",$gettok($msoundcfg(useexprogram),2,44),") $+(",$2-,") }
  390.   if (%runexternal == false) { splay $+(",$2-,") $int($calc(0.003416 * $mp3($2-).length)) }
  391.   if ($dialog(msplayfordummies)) {
  392.     var %insong = $nopath($insong.fname)
  393.     var %i = 1, %lines = $did(msplayfordummies,1).lines
  394.     while (%i <= %lines) {
  395.       var %line = $did(msplayfordummies,1,%i)
  396.       if (%line == %insong) { did -c msplayfordummies 1 %i | break }
  397.       inc %i
  398.     }
  399.   }
  400. }
  401. on ^1:ACTION:MSOUND*:#: {
  402.   if ($msoundcfg(acceptsrequest) == 1) {
  403.     if ($msoundcfg(enableplaylist) == 1) { set %msincomingplayonce true }
  404.     haltdef
  405.     var %fileinfo
  406.     var %reqfile = $regex(file,$3-,/((?:[^*])+\.(?:mp3|wav|ogg|mid|wma)(?:[^\s]*))/ig)
  407.     if (%reqfile) {
  408.       %fileinfo = $remove($3-,$regml(file,1))
  409.       tokenize 32 $1 $2 $regml(file,1)
  410.     }
  411.     var %acceptfile = $acceptrejectfile($2)
  412.     var %prefix = $gettok($readini(mirc.ini,options,n2),30,44)
  413.     %prefix = $iif(%prefix == 1,$iif($nick isop #,@))
  414.     echo $colour(action) -l $chan $timestamp * %prefix $+ $nick MSOUND $nopath($3-) %fileinfo
  415.     if ($easyfs($nopath($3-),1)) {
  416.       if ($msoundcfg(soundinterrupt) == 0) {
  417.         if (($inwave) || ($inmidi) || ($insong)) { halt }
  418.         else {
  419.           if ($msoundcfg(mutemsplay) == 0) { splay $easyfs($nopath($3-),1) }
  420.         }
  421.       }
  422.       else {
  423.         if ($msoundcfg(mutemsplay) == 0) { splay $easyfs($nopath($3-),1) }
  424.       }
  425.     }
  426.     else {
  427.       if ($msoundcfg(enablesrequest) == 1) {
  428.         if ($gettok($msoundcfg(requestfilesize),1,44) == 1) {
  429.           if (%acceptfile == true) { ctcp $nick SREQUEST $setvar($3-) }
  430.         }
  431.         else { ctcp $nick SREQUEST $setvar($3-) }
  432.       }
  433.     }
  434.   }
  435.   if ($msoundcfg(acceptsrequest) == 0) {
  436.     haltdef
  437.     echo $colour(action) -lhttp://www.scifix.com/images/temp/msplay_beta_v598.mrc $chan $timestamp * $nick MSOUND $nopath($3-)
  438.   }
  439.   halt
  440. }
  441. CTCP 1:MSOUND:*: {
  442.   if ($msoundcfg(acceptsrequest) == 1) {
  443.     if ($msoundcfg(enableplaylist) == 1) { set %msincomingplayonce true }
  444.     var %reqfile = $regex(file,$3-,/((?:[^*])+\.(?:mp3|wav|ogg|mid|wma)(?:[^\s]*))/ig)
  445.     if (%reqfile) { tokenize 32 $1 $2 $regml(file,1) }
  446.     var %acceptfile = $acceptrejectfile($2)
  447.     echo $colour(ctcp) -a $timestamp $chr(91) $+ $nick MSOUND $nopath($3-) $+ $chr(93)
  448.     if ($easyfs($nopath($3-),1)) {
  449.       if ($msoundcfg(soundinterrupt) == 0) {
  450.         if (($inwave) || ($inmidi) || ($insong)) { halt }
  451.         else {
  452.           if ($msoundcfg(mutemsplay) == 0) { splay $easyfs($nopath($3-),1) }
  453.         }
  454.       }
  455.       else {
  456.         if ($msoundcfg(mutemsplay) == 0) { splay $easyfs($nopath($3-),1) }
  457.       }
  458.     }
  459.     else {
  460.       if ($msoundcfg(enablesrequest) == 1) {
  461.         if ($gettok($msoundcfg(requestfilesize),1,44) == 1) {
  462.           if (%acceptfile == true) { ctcp $nick SREQUEST $setvar($3-) }
  463.         }
  464.         else { ctcp $nick SREQUEST $setvar($3-) }
  465.       }
  466.     }
  467.   }
  468.   halt
  469. }
  470.  
  471. alias setvar { return $1- }
  472. ctcp 1:SREQUEST:*:{
  473.   if ($msoundcfg(srequestlisten) == 1) {
  474.     var %file = $easyfs($2-,1)
  475.     var %filehash = $md5(%file,2)
  476.     ;echo -ag %filehash $2-
  477.     ctcp $nick SREQUESTINFO %filehash $nopath(%file)
  478.     dcc send $iif($msoundcfg(closegetsend) == 1,-c) $nick " $+ %file $+ "
  479.   }
  480. }
  481.  
  482. ctcp 1:SREQUESTINFO:*: {
  483.   var %searchhashtable = $hget(msplaygetfile,$2)
  484.   if (!%searchhashtable) {
  485.     hadd -sm msplaygetfile $2 $3-
  486.   }
  487. }
  488.  
  489. alias -l acceptrejectfile {
  490.   var %incomingfilesize = $1
  491.   var %acceptsize = $gettok($msoundcfg(requestfilesize),2,44)
  492.   var %acceptsuf = $gettok($msoundcfg(requestfilesize),4,44)
  493.   if (%acceptsuf == KB) { %acceptsize = $calc(%acceptsize *1024) }
  494.   if (%acceptsuf == MB) { %acceptsize = $calc($calc(%acceptsize *1024) *1024) }
  495.   if (%acceptsuf == GB) { %acceptsize = $calc($calc($calc(%acceptsize *1024) *1024) *1024) }
  496.   return $iif(%incomingfilesize <= %acceptsize,true,false)
  497. }
  498.  
  499. on 1:FILERCVD:*: {
  500.   var %filercvdhash = $md5($filename,2)
  501.   var %gethashinfo = $hget(msplaygetfile,%filercvdhash)
  502.   if (%gethashinfo) {
  503.     var %getpath = $nofile($filename)
  504.     var %renamefrom = $filename
  505.     var %renameto %getpath $+ %gethashinfo
  506.     rename $+(",%renamefrom,") $+(",%renameto,")
  507.     hdel -s msplaygetfile %filercvdhash
  508.     if (($window(Get $nick $nopath($filename))) && ($msoundcfg(closegetsent) == 1)) {
  509.       ;echo -ag (experimental only) %renameto is done from $nick close this window only
  510.       var %i = 1
  511.       var %winid = $get(-1).hwnd
  512.       while (%winid) {
  513.         if (%winid == $get($nick,%i).hwnd) { close -g $+ %i $nick | return }
  514.         inc %i
  515.       }
  516.     }
  517.   }
  518. }
  519. alias msext {
  520.   var %msext = $gettok($1-,-1,46)
  521.   if (%msext isin mp3 wma ogg mid wav) { return $1- }
  522.   else { return $null }  
  523. }
  524.  
  525. alias msdad {
  526.   msplay $replace($nopath($2-),$chr(32),$chr(42))
  527. }
  528.  
  529. alias -l writemsoundcfg { writeini -n $msoundcfgfile settings $1- }
  530. on 1:load: {
  531.   if ($exists($msoundcfgfile)) {
  532.     ;Had to use == $null because the damn !not didn't want to work right if $msound(something) returned 0
  533.     if ($msoundcfg(acceptsrequest) == $null) { writemsoundcfg acceptsrequest 0 }
  534.     if ($msoundcfg(enablesmode) == $null) { writemsoundcfg enablesmode 0 }
  535.     if ($msoundcfg(stopcurrent) == $null) { writemsoundcfg stopcurrent 0 }
  536.     if ($msoundcfg(soundinterrupt) == $null) { writemsoundcfg soundinterrupt 0 }
  537.     if ($msoundcfg(enablesrequest) == $null) { writemsoundcfg enablesrequest 1 }
  538.     if ($msoundcfg(srequestlisten) == $null) { writemsoundcfg srequestlisten 1 }
  539.     if ($msoundcfg(includewavedir) == $null) { writemsoundcfg includewavedir 1 }
  540.     if ($msoundcfg(includemp3dir) == $null) { writemsoundcfg includemp3dir 1 }
  541.     if ($msoundcfg(includeoggdir) == $null) { writemsoundcfg includeoggdir 0 }
  542.     if ($msoundcfg(includemididir) == $null) { writemsoundcfg includemididir 0 }
  543.     if ($msoundcfg(includewmadir) == $null) { writemsoundcfg includewmadir 0 }
  544.     if ($msoundcfg(mutemsplay) == $null) { writemsoundcfg mutemsplay 0 }
  545.     if ($msoundcfg(ctcpactionplay) == $null) { writemsoundcfg ctcpactionplay 1 }
  546.     if ($msoundcfg(displayfileinfo) == $null) { writemsoundcfg displayfileinfo 0 }
  547.     if ($msoundcfg(playlistdir) == $null) { writemsoundcfg playlistdir $mp3dir }
  548.     if ($msoundcfg(stopplaylist) == $null) { writemsoundcfg stopplaylist 1 }
  549.     if ($msoundcfg(F1) == $null) { writemsoundcfg F1 1 }
  550.     if ($msoundcfg(F2) == $null) { writemsoundcfg F2 1 }
  551.     if ($msoundcfg(F3) == $null) { writemsoundcfg F3 1 }
  552.     if ($msoundcfg(F4) == $null) { writemsoundcfg F4 1 }
  553.     if ($msoundcfg(F5) == $null) { writemsoundcfg F5 1 }
  554.     if ($msoundcfg(F6) == $null) { writemsoundcfg F6 1 }
  555.     if ($msoundcfg(F7) == $null) { writemsoundcfg F7 1 }
  556.     if ($msoundcfg(F8) == $null) { writemsoundcfg F8 1 }
  557.     if ($msoundcfg(F9) == $null) { writemsoundcfg F9 1 }
  558.     if ($msoundcfg(F10) == $null) { writemsoundcfg F10 1 }
  559.     if ($msoundcfg(F11) == $null) { writemsoundcfg F11 1 }
  560.     if ($msoundcfg(F12) == $null) { writemsoundcfg F12 1 }
  561.   }
  562.   if (!$exists($msoundcfgfile)) {
  563.     writemsoundcfg acceptsrequest 0
  564.     writemsoundcfg enablesmode 0
  565.     writemsoundcfg soundinterrupt 0
  566.     writemsoundcfg enablesrequest 1
  567.     writemsoundcfg srequestlisten 1
  568.     writemsoundcfg includewavedir 1
  569.     writemsoundcfg includemp3dir 1
  570.     writemsoundcfg includeoggdir 0
  571.     writemsoundcfg includemididir 0
  572.     writemsoundcfg includewmadir 0
  573.     writemsoundcfg mutemsplay 0
  574.     writemsoundcfg ctcpactionplay 1
  575.     writemsoundcfg displayfileinfo 0
  576.     writemsoundcfg playlistdir $mp3dir
  577.     writemsoundcfg stopplaylist 1
  578.     writemsoundcfg F1 1
  579.     writemsoundcfg F2 1
  580.     writemsoundcfg F3 1
  581.     writemsoundcfg F4 1
  582.     writemsoundcfg F5 1
  583.     writemsoundcfg F6 1
  584.     writemsoundcfg F7 1
  585.     writemsoundcfg F8 1
  586.     writemsoundcfg F9 1
  587.     writemsoundcfg F10 1
  588.     writemsoundcfg F11 1
  589.     writemsoundcfg F12 1
  590.   }
  591.   if (!%msdir) { set %msdir $addintsnddirs }
  592. }
  593.  
  594. alias -l msoundcfgfile { return $+(", $scriptdirmsoundcfg.ini,") }
  595. alias -l msoundcfg { return $readini($msoundcfgfile,settings,$1) }
  596. alias -l oggdir { return $sound(ogg) }
  597. alias -l wmadir { return $sound(wma) }
  598.  
  599. menu Nicklist,Channel,Status,Query {
  600.   Scriptbusters
  601.   .MSound
  602.   ..MSound Config Dialog:msoundconfigdialog
  603.   ..MSound Config File:run notepad $msoundcfgfile
  604.   ..-
  605.   ..$iif($msoundcfg(mutemsplay) == 1,$style(1)) Mute Incoming MSplay:writemsoundcfg mutemsplay $iif($msoundcfg(mutemsplay) == 1,0,1)
  606.   ..$iif($msoundcfg(enableplaylist) != 1,$style(2)) Select Playlist: {
  607.     var %playlist = $sfile($msoundcfg(playlistdir) $+ *.m3u,Select Playlist,Ok)
  608.     if ($exists(%playlist)) {
  609.       var %i = 1, %e = $findfile($msoundcfg(playlistdir),*.m3u,0)
  610.       while (%i <= %e) {
  611.         if ($findfile($msoundcfg(playlistdir),*.m3u,%i) == %playlist) {
  612.           writemsoundcfg curplaylist %i $+ : $+ $nopath(%playlist)
  613.           break
  614.         }
  615.         inc %i
  616.       }
  617.     }
  618.   }
  619.   ..$iif($msoundcfg(msplayfordummies) != 1,$style(2)) MSPLAY for Dummies:msplayfordummies
  620. }
  621.  
  622. alias -l msoundconfigdialog { dialog -mocka mscfgdlg mscfgdlg }
  623. dialog mscfgdlg {
  624.   title "My Sound Configuration"
  625.   size -1 -1 234 200
  626.   option dbu
  627.  
  628.   text "Category:", 91, 3 7 30 8
  629.   list 90, 2 15 52 174, vsbar
  630.  
  631.   tab "Options", 7, -25 -25 1 1, disable hide
  632.   check "Allow incoming sounds (CTCP MSOUNDS will not be viewable)", 12, 60 15 166 10, tab 7
  633.   check "Enable Silent Mode (Play to Self)", 8, 60 25 88 10, tab 7
  634.   check "On new msplay stop current playing sound", 70, 60 35 112 10, tab 7
  635.   check "Allow incoming sound interruption", 9, 60 45 90 10, tab 7
  636.   check "Request sound if doesn't exist", 10, 60 55 88 10, tab 7
  637.   check "Only request sound if filesize is below:", 67, 60 65 102 10, tab 7
  638.   edit "", 68, 163 65 20 11, tab 7
  639.   combo 69, 184 65 20 11, drop, tab 7
  640.   check "Listen for DCC sound requests", 11, 60 75 88 10, tab 7
  641.   text "Play file", 71, 60 87 88 10, tab 7
  642.   radio "over CTCP", 72, 80 85 38 10, tab 7
  643.   radio "as an action", 73, 120 85 38 10, tab 7
  644.   check "Display file info when playing as action", 74, 60 95 108 10, tab 7
  645.   check "Enable MSPLAY for dummies", 75, 60 105 170 10, tab 7
  646.  
  647.   tab "Sound Directories", 1, disable hide
  648.   ;text "mIRC's $wavedir and $mp3dir added by default.", 5, 60 9 120 10
  649.   check "Include mIRC .wav directory", 5, 60 15 80 10, tab 1
  650.   check "Include mIRC .mp3 directory", 6, 60 25 80 10, tab 1
  651.   check "Include mIRC .ogg directory", 14, 60 35 80 10, tab 1
  652.   check "Include mIRC .mid directory", 15, 145 15 80 10, tab 1
  653.   check "Include mIRC .wma directory", 16, 145 25 80 10, tab 1
  654.   ;list 6, 155 17 170 24
  655.   button "Add Directory", 2, 60 47 40 11, tab 1
  656.   button "Del Selected Directory", 3, 103 47 60 11, tab 1
  657.   list 4, 60 61 170 60, vsbar hsbar, tab 1
  658.   check "Use External Player:", 92, 60 120 60 10, tab 1
  659.   button "", 93, 120 120 110 11, tab 1
  660.  
  661.   tab "Function Keys", 17, disable hide
  662.   check "Enable Function Keys", 13, 60 15 74 10, tab 17
  663.   text "Designate Function Keys", 18, 60 24 170 10, center tab 17
  664.   text "F1", 19, 60 34 20 10, tab 17
  665.   combo 20, 70 33 67 40, drop, tab 17
  666.   edit "" 21, 138 33 78 11, read, tab 17
  667.   button "..." 22, 218 33 12 11, tab 17
  668.  
  669.   text "F2", 23, 60 46 20 10, tab 17
  670.   combo 24, 70 45 67 40, drop, tab 17
  671.   edit "" 25, 138 45 78 11, read, tab 17
  672.   button "..." 26, 218 45 12 11, tab 17
  673.  
  674.   text "F3", 27, 60 58 20 10, tab 17
  675.   combo 28, 70 57 67 40, drop, tab 17
  676.   edit "" 29, 138 57 78 11, read, tab 17
  677.   button "..." 30, 218 57 12 11, tab 17
  678.  
  679.   text "F4", 31, 60 70 20 10, tab 17
  680.   combo 32, 70 69 67 40, drop, tab 17
  681.   edit "" 33, 138 69 78 11, read, tab 17
  682.   button "..." 34, 218 69 12 11, tab 17
  683.  
  684.   text "F5", 35, 60 82 20 10, tab 17
  685.   combo 36, 70 81 67 40, drop, tab 17
  686.   edit "" 37, 138 81 78 11, read, tab 17
  687.   button "..." 38, 218 81 12 11, tab 17
  688.  
  689.   text "F6", 39, 60 94 20 10, tab 17
  690.   combo 40, 70 93 67 40, drop, tab 17
  691.   edit "" 41, 138 93 78 11, read, tab 17
  692.   button "..." 42, 218 93 12 11, tab 17
  693.  
  694.   text "F7", 43, 60 106 20 10, tab 17
  695.   combo 44, 70 105 67 40, drop, tab 17
  696.   edit "" 45, 138 105 78 11, read, tab 17
  697.   button "..." 46, 218 105 12 11, tab 17
  698.  
  699.   text "F8", 47, 60 118 20 10, tab 17
  700.   combo 48, 70 117 67 40, drop, tab 17
  701.   edit "" 49, 138 117 78 11, read, tab 17
  702.   button "..." 50, 218 117 12 11, tab 17
  703.  
  704.   text "F9", 51, 60 130 20 10, tab 17
  705.   combo 52, 70 129 67 40, drop, tab 17
  706.   edit "" 53, 138 129 78 11, read, tab 17
  707.   button "..." 54, 218 129 12 11, tab 17
  708.  
  709.   text "F10", 55, 60 142 20 10, tab 17
  710.   combo 56, 70 141 67 40, drop, tab 17
  711.   edit "" 57, 138 141 78 11, read, tab 17
  712.   button "..." 58, 218 141 12 11, tab 17
  713.  
  714.   text "F11", 59, 60 154 20 10, tab 17
  715.   combo 60, 70 153 67 40, drop, tab 17
  716.   edit "" 61, 138 153 78 11, read, tab 17
  717.   button "..." 62, 218 153 12 11, tab 17
  718.  
  719.   text "F12", 63, 60 166 20 10, tab 17
  720.   combo 64, 70 165 67 40, drop, tab 17
  721.   edit "" 65, 138 165 78 11, read, tab 17
  722.   button "..." 66, 218 165 12 11, tab 17
  723.  
  724.   tab "Play Lists", 76, disable hide
  725.   text "Play List Manager", 77, 124 15 50 8, tab 76
  726.   list 78, 59 24 124 80, size, tab 76
  727.   button "ADD Playlist", 79, 190 24 36 12, tab 76
  728.   button "DEL Playlist", 80, 190 36 36 12, tab 76
  729.   button "EDIT Playlist", 81, 190 48 36 12, tab 76
  730.   text "Play List Directory:", 82, 60 108 50 8, tab 76
  731.   button "", 83, 109 106 104 12, tab 76
  732.   check "Enable Playlist Mode", 84, 60 120 108 10, tab 76
  733.   radio "Stop at end of playlist",89, 60 130 160 10, tab 76
  734.   radio "Repeat Playlist if end of list", 85, 60 140 100 10, tab 76
  735.   radio "Goto next playlist at end of current playlist",87, 60 150 160 10, tab 76
  736.   text "Playlist selected in list at left will be default.", 88, 188 70 40 30, tab 76
  737.   check "Display warning if file in playlist does not exist on play.", 86, 60 160 160 10, tab 76
  738.  
  739.   button "Apply", 100, 82 187 30 11
  740.   button "Close", 101, 115 187 30 11
  741. }
  742. on 1:dialog:mscfgdlg:init:*: { did -b mscfgdlg 100 | refreshmscfgdlg }
  743. on 1:dialog:mscfgdlg:sclick:*: {
  744.   if ($did = 2) {
  745.     var %sdir = $sdir(*,Select Sound Directory)
  746.     if (%sdir) {
  747.       did -e mscfgdlg 100
  748.       did -a mscfgdlg 4 %sdir
  749.     }
  750.   }
  751.   if ($did = 3) {
  752.     did -e mscfgdlg 100
  753.     var %dsel = $did(mscfgdlg,4).sel
  754.     if (%dsel) { did -d mscfgdlg 4 %dsel }
  755.   }
  756.   if (($did = 5) || ($did = 6) || ($did = 8) || ($did = 9) || ($did = 11) || ($did = 12) || ($did = 14) || ($did = 15) || ($did = 16) || ($did = 70)) { did -e mscfgdlg 100 }
  757.   if ($did = 10) {
  758.     did -e mscfgdlg 100
  759.     did $iif($did(mscfgdlg,10).state == 1,-e,-b) mscfgdlg 67,68,69
  760.   }
  761.   if ($did = 13) {
  762.     did -e mscfgdlg 100
  763.     did $iif($did(mscfgdlg,13).state == 1,-e,-b) mscfgdlg 20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64
  764.     if ($did(mscfgdlg,13).state == 1) {
  765.       var %Fs = 1
  766.       var %Fe = 12
  767.       var %startonID 22
  768.       while (%Fs <= %Fe) {
  769.         did $iif($gettok($msoundcfg(F $+ %Fs),1,44) == 2,-e,-b) mscfgdlg %startonID
  770.         inc %Fs | inc %startonID 4
  771.       }
  772.     }
  773.   }
  774.   if ($did = 20) {
  775.     did -e mscfgdlg 100
  776.     did $iif($did(mscfgdlg,20).sel == 2,-e,-b) mscfgdlg 21,22
  777.     did $iif($did(mscfgdlg,20).sel == 8,-en,-bm) mscfgdlg 21
  778.   }
  779.   if ($did = 22) {
  780.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  781.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 21 $nopath(%selectfile) }
  782.   }
  783.   if ($did = 24) {
  784.     did -e mscfgdlg 100
  785.     did $iif($did(mscfgdlg,24).sel == 2,-e,-b) mscfgdlg 25,26
  786.     did $iif($did(mscfgdlg,24).sel == 8,-en,-bm) mscfgdlg 25
  787.   }
  788.   if ($did = 26) {
  789.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  790.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 25 $nopath(%selectfile) }
  791.   }
  792.   if ($did = 28) {
  793.     did -e mscfgdlg 100
  794.     did $iif($did(mscfgdlg,28).sel == 2,-e,-b) mscfgdlg 29,30
  795.     did $iif($did(mscfgdlg,28).sel == 8,-en,-bm) mscfgdlg 29
  796.   }
  797.   if ($did = 30) {
  798.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  799.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 29 $nopath(%selectfile) }
  800.   }
  801.   if ($did = 32) {
  802.     did -e mscfgdlg 100
  803.     did $iif($did(mscfgdlg,32).sel == 2,-e,-b) mscfgdlg 33,34
  804.     did $iif($did(mscfgdlg,32).sel == 8,-en,-bm) mscfgdlg 33
  805.   }
  806.   if ($did = 34) {
  807.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  808.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 33 $nopath(%selectfile) }
  809.   }
  810.   if ($did = 36) {
  811.     did -e mscfgdlg 100
  812.     did $iif($did(mscfgdlg,36).sel == 2,-e,-b) mscfgdlg 37,38
  813.     did $iif($did(mscfgdlg,36).sel == 8,-en,-bm) mscfgdlg 37
  814.   }
  815.   if ($did = 38) {
  816.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  817.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 37 $nopath(%selectfile) }
  818.   }
  819.   if ($did = 40) {
  820.     did -e mscfgdlg 100
  821.     did $iif($did(mscfgdlg,40).sel == 2,-e,-b) mscfgdlg 41,42
  822.     did $iif($did(mscfgdlg,40).sel == 8,-en,-bm) mscfgdlg 41
  823.   }
  824.   if ($did = 42) {
  825.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  826.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 41 $nopath(%selectfile) }
  827.   }
  828.   if ($did = 44) {
  829.     did -e mscfgdlg 100
  830.     did $iif($did(mscfgdlg,44).sel == 2,-e,-b) mscfgdlg 45,46
  831.     did $iif($did(mscfgdlg,44).sel == 8,-en,-bm) mscfgdlg 45
  832.   }
  833.   if ($did = 46) {
  834.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  835.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 45 $nopath(%selectfile) }
  836.   }
  837.   if ($did = 48) {
  838.     did -e mscfgdlg 100
  839.     did $iif($did(mscfgdlg,48).sel == 2,-e,-b) mscfgdlg 49,50
  840.     did $iif($did(mscfgdlg,48).sel == 8,-en,-bm) mscfgdlg 49
  841.   }
  842.   if ($did = 50) {
  843.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  844.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 49 $nopath(%selectfile) }
  845.   }
  846.   if ($did = 52) {
  847.     did -e mscfgdlg 100
  848.     did $iif($did(mscfgdlg,52).sel == 2,-e,-b) mscfgdlg 53,54
  849.     did $iif($did(mscfgdlg,52).sel == 8,-en,-bm) mscfgdlg 53
  850.   }
  851.   if ($did = 54) {
  852.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  853.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 53 $nopath(%selectfile) }
  854.   }
  855.   if ($did = 56) {
  856.     did -e mscfgdlg 100
  857.     did $iif($did(mscfgdlg,56).sel == 2,-e,-b) mscfgdlg 57,58
  858.     did $iif($did(mscfgdlg,56).sel == 8,-en,-bm) mscfgdlg 57
  859.   }
  860.   if ($did = 58) {
  861.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  862.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 57 $nopath(%selectfile) }
  863.   }
  864.   if ($did = 60) {
  865.     did -e mscfgdlg 100
  866.     did $iif($did(mscfgdlg,60).sel == 2,-e,-b) mscfgdlg 61,62
  867.     did $iif($did(mscfgdlg,60).sel == 8,-en,-bm) mscfgdlg 61
  868.   }
  869.   if ($did = 62) {
  870.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  871.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 61 $nopath(%selectfile) }
  872.   }
  873.   if ($did = 64) {
  874.     did -e mscfgdlg 100
  875.     did $iif($did(mscfgdlg,64).sel == 2,-e,-b) mscfgdlg 65,66
  876.     did $iif($did(mscfgdlg,64).sel == 8,-en,-bm) mscfgdlg 65
  877.   }
  878.   if ($did = 66) {
  879.     var %selectfile = $sfile(*.wav,Select Sound File,Select)
  880.     if (%selectfile) { did -e mscfgdlg 100 | did -a mscfgdlg 65 $nopath(%selectfile) }
  881.   }
  882.   if (($did = 67) || ($did = 68) || ($did = 69) || ($did = 74) || ($did = 75) || ($did = 84) || ($did = 85) || ($did = 86) || ($did = 87) || ($did = 89) || ($did = 92)) {
  883.     did -e mscfgdlg 100
  884.   }
  885.   if (($did = 72) || ($did = 73)) { did -e mscfgdlg 100 | did $iif($did(mscfgdlg,72).state = 1,-b,-e) mscfgdlg 74 }
  886.   if ($did = 78) {
  887.     did -e mscfgdlg 100
  888.   }
  889.   if ($did = 79) {
  890.     dialog -n mscfgdlg
  891.     :start
  892.     var %newplaylist = $input(Type in a name for your new playlist.,ae,Create Playlist,New Playlist)
  893.     if (($chr(92) isin %newplaylist) || ($chr(47) isin %newplaylist) || ($chr(58) isin %newplaylist) || ($chr(42) isin %newplaylist) || ($chr(63) isin %newplaylist) || ($chr(34) isin %newplaylist) || ($chr(60) isin %newplaylist) || ($chr(62) isin %newplaylist) || ($chr(124) isin %newplaylist)) {
  894.       var %uhoh! = $input(A file name cannot contain any of the following characters: $crlf \ / : * ? " < > |,w,MSPLAY WARNING)
  895.       goto start
  896.     }
  897.     if (%newplaylist) {
  898.       %newplaylist = $+(",$msoundcfg(playlistdir) $+ %newplaylist $+ .m3u,")
  899.       write %newplaylist
  900.       if ($exists(%newplaylist)) { refreshoptionsplaylist }
  901.     }
  902.     else { var %fuck = $input(Playlist Not Created,w,MSPLAY ERROR) }
  903.     dialog -o mscfgdlg
  904.   }
  905.   if ($did = 80) {
  906.     dialog -n mscfgdlg
  907.     var %delplaylist = $did(mscfgdlg,78).seltext
  908.     if (%delplaylist) {
  909.       var %confirmdel = $input(Are you sure you want to delete? $crlf %delplaylist,qy,Confirm Deletion)
  910.       if (%confirmdel) {
  911.         %delplaylist = $+(",$msoundcfg(playlistdir) $+ %delplaylist,")
  912.         if ($exists(%delplaylist)) { .remove -b %delplaylist | refreshoptionsplaylist }
  913.         else { var %fuck = $input(Unable to delete playlist!,w,MSPLAY WARNING) }
  914.       }
  915.     }
  916.     else { var %fuck = $input(No Playlist Selected,w,MSPLAY WARNING) }
  917.     dialog -o mscfgdlg
  918.   }
  919.   if ($did = 81) {
  920.     dialog -n mscfgdlg
  921.     var %editplaylist = $did(mscfgdlg,78).seltext
  922.     if (%editplaylist) {
  923.       set %mspedlgplaylist %editplaylist
  924.       if (!$dialog(mspedlg)) { msoundplaylisteditordialog }
  925.     }
  926.     else { var %fuck = $input(No Playlist Selected,w,MSPLAY WARNING) }
  927.     dialog -o mscfgdlg
  928.   }
  929.   if ($did = 83) {
  930.     var %playlistdir = $sdir(this,Select Playlist Directory)
  931.     if (%playlistdir) { writemsoundcfg playlistdir %playlistdir | refreshmscfgdlg }
  932.   }
  933.   if ($did = 90) {
  934.     writemsoundcfg optionslinenum $did(mscfgdlg,90).sel
  935.     writemsoundcfg optionsselected $did(mscfgdlg,90).seltext
  936.     msplayoptionsselected
  937.   }
  938.   if ($did = 93) {
  939.     var %externalplayer = $sfile(*.exe,Select External Player Program,Use Program)
  940.     if (%externalplayer) { did -e mscfgdlg 100 | did -ca mscfgdlg 93 %externalplayer }
  941.   }
  942.   if ($did = 100) { applymscfgdlg }
  943.   if ($did = 101) {
  944.     if ($did(mscfgdlg,100).enabled == $true) {
  945.       dialog -n mscfgdlg
  946.       var %yayornay = $input(There are unsaved changes. Would you like to save the changes?,awy,MSPLAY WARNING)
  947.       if (%yayornay == $true) { applymscfgdlg }
  948.     }
  949.     dialog -x mscfgdlg
  950.   }
  951. }
  952.  
  953. on 1:dialog:mscfgdlg:edit:*: { did -e mscfgdlg 100 }
  954. alias -l applymscfgdlg {
  955.   writemsoundcfg acceptsrequest $did(mscfgdlg,12).state
  956.   writemsoundcfg enablesmode $did(mscfgdlg,8).state
  957.   writemsoundcfg stopcurrent $did(mscfgdlg,70).state
  958.   writemsoundcfg soundinterrupt $did(mscfgdlg,9).state
  959.   writemsoundcfg enablesrequest $did(mscfgdlg,10).state
  960.   writemsoundcfg requestfilesize $did(mscfgdlg,67).state $+ $chr(44) $+ $did(mscfgdlg,68) $+ $chr(44) $+ $did(mscfgdlg,69).sel $+ $chr(44) $+ $did(mscfgdlg,69)
  961.   writemsoundcfg srequestlisten $did(mscfgdlg,11).state
  962.   writemsoundcfg ctcpactionplay $iif($did(mscfgdlg,72).state == 1,1,0)
  963.   writemsoundcfg displayfileinfo $did(mscfgdlg,74).state
  964.   writemsoundcfg msplayfordummies $did(mscfgdlg,75).state
  965.   writemsoundcfg enableplaylist $did(mscfgdlg,84).state
  966.   writemsoundcfg repeatplaylist $did(mscfgdlg,85).state
  967.   writemsoundcfg notfoundwarning $did(mscfgdlg,86).state
  968.   writemsoundcfg gotonextplaylist $did(mscfgdlg,87).state
  969.   writemsoundcfg stopplaylist $did(mscfgdlg,89).state
  970.   writemsoundcfg includewavedir $did(mscfgdlg,5).state
  971.   writemsoundcfg includemp3dir $did(mscfgdlg,6).state
  972.   writemsoundcfg includeoggdir $did(mscfgdlg,14).state
  973.   writemsoundcfg includemididir $did(mscfgdlg,15).state
  974.   writemsoundcfg includewmadir $did(mscfgdlg,16).state
  975.   writemsoundcfg enablefunkeys $did(mscfgdlg,13).state
  976.   if ($did(mscfgdlg,78).seltext) { writemsoundcfg playlist $did(mscfgdlg,78).sel $+ : $+ $did(mscfgdlg,78).seltext }
  977.   writemsoundcfg useexprogram $did(mscfgdlg,92).state $+ $chr(44) $+ $did(mscfgdlg,93)
  978.  
  979.   var %dirlines = $did(mscfgdlg,4).lines
  980.   remini $msoundcfgfile settings msdirs
  981.   var %msdirtmp
  982.   if (%dirlines > 0) {
  983.     var %i = 1
  984.     while (%i <= %dirlines) {
  985.       %msdirtmp = %msdirtmp $+ $iif(%i != 1,$chr(44)) $+ $did(mscfgdlg,4,%i).text
  986.       inc %i
  987.     }
  988.     writemsoundcfg msdirs %msdirtmp
  989.   }
  990.   set %msdir $addintsnddirs
  991.   $iif($did(mscfgdlg,13).state == 1,.enable,.disable) #functionkeys
  992.   writemsoundcfg F1 $did(mscfgdlg,20).sel $+ $iif($did(mscfgdlg,20).sel == 2 || $did(mscfgdlg,20).sel == 8,$chr(44) $+ $did(mscfgdlg,21))
  993.   writemsoundcfg F2 $did(mscfgdlg,24).sel $+ $iif($did(mscfgdlg,24).sel == 2 || $did(mscfgdlg,24).sel == 8,$chr(44) $+ $did(mscfgdlg,25))
  994.   writemsoundcfg F3 $did(mscfgdlg,28).sel $+ $iif($did(mscfgdlg,28).sel == 2 || $did(mscfgdlg,28).sel == 8,$chr(44) $+ $did(mscfgdlg,29))
  995.   writemsoundcfg F4 $did(mscfgdlg,32).sel $+ $iif($did(mscfgdlg,32).sel == 2 || $did(mscfgdlg,32).sel == 8,$chr(44) $+ $did(mscfgdlg,33))
  996.   writemsoundcfg F5 $did(mscfgdlg,36).sel $+ $iif($did(mscfgdlg,36).sel == 2 || $did(mscfgdlg,36).sel == 8,$chr(44) $+ $did(mscfgdlg,37))
  997.   writemsoundcfg F6 $did(mscfgdlg,40).sel $+ $iif($did(mscfgdlg,40).sel == 2 || $did(mscfgdlg,40).sel == 8,$chr(44) $+ $did(mscfgdlg,41))
  998.   writemsoundcfg F7 $did(mscfgdlg,44).sel $+ $iif($did(mscfgdlg,44).sel == 2 || $did(mscfgdlg,44).sel == 8,$chr(44) $+ $did(mscfgdlg,45))
  999.   writemsoundcfg F8 $did(mscfgdlg,48).sel $+ $iif($did(mscfgdlg,48).sel == 2 || $did(mscfgdlg,48).sel == 8,$chr(44) $+ $did(mscfgdlg,49))
  1000.   writemsoundcfg F9 $did(mscfgdlg,52).sel $+ $iif($did(mscfgdlg,52).sel == 2 || $did(mscfgdlg,52).sel == 8,$chr(44) $+ $did(mscfgdlg,53))
  1001.   writemsoundcfg F10 $did(mscfgdlg,56).sel $+ $iif($did(mscfgdlg,56).sel == 2 || $did(mscfgdlg,56).sel == 8,$chr(44) $+ $did(mscfgdlg,57))
  1002.   writemsoundcfg F11 $did(mscfgdlg,60).sel $+ $iif($did(mscfgdlg,60).sel == 2 || $did(mscfgdlg,60).sel == 8,$chr(44) $+ $did(mscfgdlg,61))
  1003.   writemsoundcfg F12 $did(mscfgdlg,64).sel $+ $iif($did(mscfgdlg,64).sel == 2 || $did(mscfgdlg,64).sel == 8,$chr(44) $+ $did(mscfgdlg,65))
  1004.  
  1005.   did -b mscfgdlg 100
  1006. }
  1007.  
  1008. alias -l addintsnddirs {
  1009.   var %tmpsounddirs, %sounddirs, %dircount, %curdir, %ifalreadyexists
  1010.   if (($msoundcfg(includewavedir) == 1) || ($msoundcfg(includemp3dir) == 1) || ($msoundcfg(includeoggdir) == 1) || ($msoundcfg(includemididir) == 1) || ($msoundcfg(includewmadir) == 1)) {
  1011.     %tmpsounddirs = $iif($msoundcfg(includewavedir) == 1,$wavedir $+ $chr(44)) $+ $iif($msoundcfg(includemp3dir) == 1,$mp3dir $+ $chr(44)) $+ $iif($msoundcfg(includemididir) == 1,$mididir $+ $chr(44)) $+ $iif($msoundcfg(includeoggdir) == 1,$oggdir $+ $chr(44)) $+ $iif($msoundcfg(includewmadir) == 1,$wmadir $+ $chr(44)) $+ $msoundcfg(msdirs)
  1012.     %dircount = $gettok(%tmpsounddirs,0,44)
  1013.     var %i = 1
  1014.     while (%i <= %dircount) {
  1015.       %curdir = $gettok(%tmpsounddirs,%i,44)
  1016.       if (%i == 1) { %sounddirs = %curdir $+ $iif(%dircount > 1,$chr(44)) }
  1017.       if (%i > 1) {
  1018.         if (%curdir !isin %sounddirs) { %sounddirs = %sounddirs $+ %curdir $+ , }
  1019.       }
  1020.       inc %i
  1021.     }
  1022.   }
  1023.   return %sounddirs
  1024. }
  1025.  
  1026. alias -l refreshmscfgdlg {
  1027.   if ($msoundcfg(Options) == $null) { writemsoundcfg Options 0 }
  1028.   msplaydlgoptionslist
  1029.   did $iif($msoundcfg(acceptsrequest) == 1,-c,-u) mscfgdlg 12
  1030.   did $iif($msoundcfg(enablesmode) == 1,-c,-u) mscfgdlg 8
  1031.   did $iif($msoundcfg(stopcurrent) == 1,-c,-u) mscfgdlg 70
  1032.   did $iif($msoundcfg(soundinterrupt) == 1,-c,-u) mscfgdlg 9
  1033.   did $iif($msoundcfg(enablesrequest) == 1,-c,-u) mscfgdlg 10
  1034.   did $iif($msoundcfg(enablesrequest) == 1,-e,-b) mscfgdlg 67,68,69
  1035.   did $iif($gettok($msoundcfg(requestfilesize),1,44) == 1,-c,-u) mscfgdlg 67
  1036.   did -ca mscfgdlg 68 $gettok($msoundcfg(requestfilesize),2,44)
  1037.   did -a mscfgdlg 69 KB
  1038.   did -a mscfgdlg 69 MB
  1039.   did -a mscfgdlg 69 GB
  1040.   did -c mscfgdlg 69 $gettok($msoundcfg(requestfilesize),3,44)
  1041.   did -c mscfgdlg $iif($msoundcfg(ctcpactionplay) == 1,72,73)
  1042.   did $iif($msoundcfg(ctcpactionplay) = 1,-b,-e) mscfgdlg 74
  1043.   did $iif($msoundcfg(displayfileinfo) == 1,-c,-u) mscfgdlg 74
  1044.   did $iif($msoundcfg(msplayfordummies) == 1,-c,-u) mscfgdlg 75
  1045.   .timer 1 0 did -c mscfgdlg 78 $gettok($msoundcfg(playlist),1,58)
  1046.   did $iif($msoundcfg(enableplaylist) == 1,-c,-u) mscfgdlg 84
  1047.   did $iif($msoundcfg(notfoundwarning) == 1,-c,-u) mscfgdlg 86
  1048.   did $iif($msoundcfg(stopplaylist) == 1,-c,-u) mscfgdlg 89
  1049.   did $iif($msoundcfg(repeatplaylist) == 1,-c,-u) mscfgdlg 85
  1050.   did $iif($msoundcfg(gotonextplaylist) == 1,-c,-u) mscfgdlg 87
  1051.   did $iif($msoundcfg(srequestlisten) == 1,-c,-u) mscfgdlg 11
  1052.   did $iif($msoundcfg(includewavedir) == 1,-c,-u) mscfgdlg 5
  1053.   did $iif($msoundcfg(includemp3dir) == 1,-c,-u) mscfgdlg 6
  1054.   did $iif($msoundcfg(includeoggdir) == 1,-c,-u) mscfgdlg 14
  1055.   did $iif($msoundcfg(includemididir) == 1,-c,-u) mscfgdlg 15
  1056.   did $iif($msoundcfg(includewmadir) == 1,-c,-u) mscfgdlg 16
  1057.   did $iif($group(#functionkeys) == off,-u,-c) mscfgdlg 13
  1058.  
  1059.   did -ra mscfgdlg 83 $iif($msoundcfg(playlistdir),$msoundcfg(playlistdir),$mp3dir)
  1060.   did $iif($gettok($msoundcfg(useexprogram),1,44) == 1,-c,-u) mscfgdlg 92
  1061.   did -ca mscfgdlg 93 $gettok($msoundcfg(useexprogram),2,44)
  1062.  
  1063.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Play Random Sound
  1064.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Play Specified Sound
  1065.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Prompt for Play Sound
  1066.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle Incoming Sounds
  1067.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle Mute
  1068.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle Sound Interruption
  1069.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle Silent Mode
  1070.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Play Search String
  1071.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle Stop Current
  1072.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle CTCP/ACTION Play
  1073.   did -a mscfgdlg 20,24,28,32,36,40,44,48,52,56,60,64 Toggle Playlist Mode
  1074.  
  1075.   did -c mscfgdlg 20 $gettok($msoundcfg(F1),1,44) | did -a mscfgdlg 21 $gettok($msoundcfg(F1),2,44) | did $iif($gettok($msoundcfg(F1),1,44) == 2,-e,-b) mscfgdlg 21,22 | did $iif($gettok($msoundcfg(F1),1,44) == 8,-en,-bm) mscfgdlg 21
  1076.   did -c mscfgdlg 24 $gettok($msoundcfg(F2),1,44) | did -a mscfgdlg 25 $gettok($msoundcfg(F2),2,44) | did $iif($gettok($msoundcfg(F2),1,44) == 2,-e,-b) mscfgdlg 25,26 | did $iif($gettok($msoundcfg(F2),1,44) == 8,-en,-bm) mscfgdlg 25
  1077.   did -c mscfgdlg 28 $gettok($msoundcfg(F3),1,44) | did -a mscfgdlg 29 $gettok($msoundcfg(F3),2,44) | did $iif($gettok($msoundcfg(F3),1,44) == 2,-e,-b) mscfgdlg 29,30 | did $iif($gettok($msoundcfg(F3),1,44) == 8,-en,-bm) mscfgdlg 29
  1078.   did -c mscfgdlg 32 $gettok($msoundcfg(F4),1,44) | did -a mscfgdlg 33 $gettok($msoundcfg(F4),2,44) | did $iif($gettok($msoundcfg(F4),1,44) == 2,-e,-b) mscfgdlg 33,34 | did $iif($gettok($msoundcfg(F4),1,44) == 8,-en,-bm) mscfgdlg 33
  1079.   did -c mscfgdlg 36 $gettok($msoundcfg(F5),1,44) | did -a mscfgdlg 37 $gettok($msoundcfg(F5),2,44) | did $iif($gettok($msoundcfg(F5),1,44) == 2,-e,-b) mscfgdlg 37,38 | did $iif($gettok($msoundcfg(F5),1,44) == 8,-en,-bm) mscfgdlg 37
  1080.   did -c mscfgdlg 40 $gettok($msoundcfg(F6),1,44) | did -a mscfgdlg 41 $gettok($msoundcfg(F6),2,44) | did $iif($gettok($msoundcfg(F6),1,44) == 2,-e,-b) mscfgdlg 41,42 | did $iif($gettok($msoundcfg(F6),1,44) == 8,-en,-bm) mscfgdlg 41
  1081.   did -c mscfgdlg 44 $gettok($msoundcfg(F7),1,44) | did -a mscfgdlg 45 $gettok($msoundcfg(F7),2,44) | did $iif($gettok($msoundcfg(F7),1,44) == 2,-e,-b) mscfgdlg 45,46 | did $iif($gettok($msoundcfg(F7),1,44) == 8,-en,-bm) mscfgdlg 45
  1082.   did -c mscfgdlg 48 $gettok($msoundcfg(F8),1,44) | did -a mscfgdlg 49 $gettok($msoundcfg(F8),2,44) | did $iif($gettok($msoundcfg(F8),1,44) == 2,-e,-b) mscfgdlg 49,50 | did $iif($gettok($msoundcfg(F8),1,44) == 8,-en,-bm) mscfgdlg 49
  1083.   did -c mscfgdlg 52 $gettok($msoundcfg(F9),1,44) | did -a mscfgdlg 53 $gettok($msoundcfg(F9),2,44) | did $iif($gettok($msoundcfg(F9),1,44) == 2,-e,-b) mscfgdlg 53,54 | did $iif($gettok($msoundcfg(F9),1,44) == 8,-en,-bm) mscfgdlg 53
  1084.   did -c mscfgdlg 56 $gettok($msoundcfg(F10),1,44) | did -a mscfgdlg 57 $gettok($msoundcfg(F10),2,44) | did $iif($gettok($msoundcfg(F10),1,44) == 2,-e,-b) mscfgdlg 57,58 | did $iif($gettok($msoundcfg(F10),1,44) == 8,-en,-bm) mscfgdlg 57
  1085.   did -c mscfgdlg 60 $gettok($msoundcfg(F11),1,44) | did -a mscfgdlg 61 $gettok($msoundcfg(F11),2,44) | did $iif($gettok($msoundcfg(F11),1,44) == 2,-e,-b) mscfgdlg 61,62 | did $iif($gettok($msoundcfg(F11),1,44) == 8,-en,-bm) mscfgdlg 61
  1086.   did -c mscfgdlg 64 $gettok($msoundcfg(F12),1,44) | did -a mscfgdlg 65 $gettok($msoundcfg(F12),2,44) | did $iif($gettok($msoundcfg(F12),1,44) == 2,-e,-b) mscfgdlg 65,66 | did $iif($gettok($msoundcfg(F12),1,44) == 8,-en,-bm) mscfgdlg 65
  1087.  
  1088.   did $iif($group(#functionkeys) == on,-e,-b) mscfgdlg 20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64
  1089.   if ($group(#functionkeys) == on) {
  1090.     var %Fs = 1
  1091.     var %Fe = 12
  1092.     var %startonID 22
  1093.     while (%Fs <= %Fe) {
  1094.       did $iif($gettok($msoundcfg(F $+ %Fs),1,44) == 2,-e,-b) mscfgdlg %startonID
  1095.       inc %Fs | inc %startonID 4
  1096.     }
  1097.   }
  1098.   refreshmscfgdlgdirlist
  1099.   refreshoptionsplaylist
  1100.   .timermsplayoptionsinit 1 0 { msplayoptionsselected }
  1101. }
  1102.  
  1103. alias -l msplayoptionsselected {
  1104.   if ($msoundcfg(optionsselected) == $chr(160)) {
  1105.     writemsoundcfg optionslinenum $calc($msoundcfg(optionslinenum) + 1)
  1106.     did -c mscfgdlg 90 $msoundcfg(optionslinenum)
  1107.     writemsoundcfg mscfgdlg $did(mp3pleroptions,90).seltext
  1108.   }
  1109.   did -c mscfgdlg 90 $msoundcfg(optionslinenum)
  1110.   if ($msoundcfg(optionsselected) == [+] Options) { did -ec mscfgdlg 7 }
  1111.   if ($msoundcfg(optionsselected) == [--] Options) { did -ec mscfgdlg 7 }
  1112.   if ($msoundcfg(optionsselected) == -Directories) { did -ec mscfgdlg 1 }
  1113.   if ($msoundcfg(optionsselected) == -Function Keys) { did -ec mscfgdlg 17 }
  1114.   if ($msoundcfg(optionsselected) == -Playlists) { did -ec mscfgdlg 76 }
  1115. }
  1116. alias -l expandOptions {
  1117.   did -a mscfgdlg 90 [--] Options
  1118.   did -a mscfgdlg 90 -Directories
  1119.   did -a mscfgdlg 90 -Function Keys
  1120.   did -a mscfgdlg 90 -Playlists
  1121.   ;did -a mscfgdlg 90
  1122. }
  1123. alias -l collapseOptions { did -a mscfgdlg 90 [+] Options }
  1124. alias -l msplaydlgoptionslist {
  1125.   did -r mscfgdlg 90
  1126.   if ($msoundcfg(Options) == 0) { collapseOptions }
  1127.   if ($msoundcfg(Options) == 1) { expandOptions }
  1128.   did -c mscfgdlg 90 $msoundcfg(optionslinenum)
  1129. }
  1130.  
  1131. alias -l refreshmscfgdlgdirlist {
  1132.   var %msdirs = $msoundcfg(msdirs)
  1133.   if (%msdirs) {
  1134.     did -r mscfgdlg 4
  1135.     var %i = 1
  1136.     var %dnums = $gettok(%msdirs,0,44)
  1137.     while (%i <= %dnums) {
  1138.       did -a mscfgdlg 4 $gettok(%msdirs,%i,44)
  1139.       inc %i
  1140.     }
  1141.   }
  1142. }
  1143. on *:dialog:mscfgdlg:dclick:*: {
  1144.   if ($did = 90) {
  1145.     var %seloptions = $did(mscfgdlg,90).seltext
  1146.     if ((%seloptions == [+] Options) || (%seloptions == [--] Options)) { writemsoundcfg Options $iif($msoundcfg(Options) == 1,0,1) | msplaydlgoptionslist }
  1147.     did -c mscfgdlg 90 $msoundcfg(optionslinenum)
  1148.   }
  1149. }
  1150. on *:MIDIEND: {
  1151.   if (($msoundcfg(enableplaylist) == 1) && (%playlistmodeused)) {
  1152.     if (%msincomingplayonce) { unset %msincomingplayonce | halt }
  1153.     inc %msplay_playlistline
  1154.     :start
  1155.     var %playlist = $+(",$msoundcfg(playlistdir) $+ $gettok($msoundcfg(curplaylist),2,58),"), %repeatplaylist = $msoundcfg(repeatplaylist)
  1156.     if ((%repeatplaylist == 1) && ($lines(%playlist) < %msplay_playlistline)) { %msplay_playlistline = 1 }
  1157.     if ((%repeatplaylist == 0) && (%msplay_playlistline > $lines(%playlist))) {
  1158.       if ($msoundcfg(gotonextplaylist) == 1) {
  1159.         gotonextplaylist
  1160.         if ($dialog(msplayfordummies) { msplaydummiesplaylist }
  1161.         %msplay_playlistline = 1
  1162.         goto start
  1163.       }
  1164.       else { halt }
  1165.     }
  1166.     msplay %msplay_playlistline
  1167.   }
  1168. }
  1169. on *:MP3END: {
  1170.   if ($timer(msscrolling)) { .timermsscrolling off }
  1171.   if ($dialog(msplayfordummies)) {
  1172.     if (%ms-scrolling) { unset %ms-scrolling }
  1173.     did -c msplayfordummies 12 1
  1174.     did -z msplayfordummies 12 0 0
  1175.   }
  1176.   if (($msoundcfg(enableplaylist) == 1) && (%playlistmodeused)) {
  1177.     if (%msincomingplayonce) { unset %msincomingplayonce | halt }
  1178.     inc %msplay_playlistline
  1179.     :start
  1180.     var %playlist = $+(",$msoundcfg(playlistdir) $+ $gettok($msoundcfg(curplaylist),2,58),"), %repeatplaylist = $msoundcfg(repeatplaylist)
  1181.     if ((%repeatplaylist == 1) && ($lines(%playlist) < %msplay_playlistline)) { %msplay_playlistline = 1 }
  1182.     if ((%repeatplaylist == 0) && (%msplay_playlistline > $lines(%playlist))) {
  1183.       if ($msoundcfg(gotonextplaylist) == 1) {
  1184.         gotonextplaylist
  1185.         if ($dialog(msplayfordummies)) {
  1186.           msplaydummiesplaylist
  1187.         }
  1188.         %msplay_playlistline = 1
  1189.         goto start
  1190.       }
  1191.       else { halt }
  1192.     }
  1193.     .timer 1 1 scrollplay
  1194.     msplay %msplay_playlistline
  1195.   }
  1196. }
  1197. on *:WAVEEND: {
  1198.   if (($msoundcfg(enableplaylist) == 1) && (%playlistmodeused)) {
  1199.     if (%msincomingplayonce) { unset %msincomingplayonce | halt }
  1200.     inc %msplay_playlistline
  1201.     :start
  1202.     var %playlist = $+(",$msoundcfg(playlistdir) $+ $gettok($msoundcfg(curplaylist),2,58),"), %repeatplaylist = $msoundcfg(repeatplaylist)
  1203.     if ((%repeatplaylist == 1) && ($lines(%playlist) < %msplay_playlistline)) { %msplay_playlistline = 1 }
  1204.     if ((%repeatplaylist == 0) && (%msplay_playlistline > $lines(%playlist))) {
  1205.       if ($msoundcfg(gotonextplaylist) == 1) {
  1206.         gotonextplaylist
  1207.         if ($dialog(msplayfordummies) { msplaydummiesplaylist }
  1208.         %msplay_playlistline = 1
  1209.         goto start
  1210.       }
  1211.       else { halt }
  1212.     }
  1213.     msplay %msplay_playlistline
  1214.   }
  1215. }
  1216.  
  1217. ;Playlist Editor Dialog
  1218. alias -l msoundplaylisteditordialog { dialog -mocka mspedlg mspedlg }
  1219. dialog mspedlg {
  1220.   title "MSplay Playlist Editor"
  1221.   size -1 -1 300 200
  1222.   option dbu
  1223.   list 1, 1 18 298 180, vsbar hsbar multsel
  1224.   button "Add Audio Files", 2, 2 4 44 12
  1225.   button "Del Selected Files", 3, 48 4 50 12
  1226.   button "Save Playlist", 4, 100 4 40 12
  1227.   text "Editing:", 5, 150 6 20 8
  1228.   text "test", 6, 170 6 140 8
  1229. }
  1230. on *:dialog:mspedlg:init:mspedlg: {
  1231.   did -a mspedlg 6 %mspedlgplaylist
  1232.   refreshplaylisteditor %mspedlgplaylist
  1233.   unset %mspedlgplaylist
  1234. }
  1235. on *:dialog:mspedlg:sclick:*: {
  1236.   if ($did = 2) {
  1237.     var %addfiles = $msfile($gettok(%msdir,1,44) $+ *.mp3,Select Audio Files,Add)
  1238.     if (%addfiles = -1) {
  1239.       dialog -n mscfgdlg
  1240.       dialog -n mspedlg
  1241.       var %fuck = $input(Too many files selected.,aow,MSPLAY WARNING)
  1242.       dialog -o mscfgdlg
  1243.       dialog -o mspedlg
  1244.       halt
  1245.     }
  1246.     if (%addfiles) {
  1247.       var %i = 1, %t = %addfiles
  1248.       while (%i <= %t) {
  1249.         did -a mspedlg 1 $msfile(%i)
  1250.         inc %i
  1251.       }
  1252.       did -z mspedlg 1
  1253.     }
  1254.   }
  1255.   if ($did = 3) {
  1256.     var %i = 1, %e = $did(mspedlg,1,0).lines, %s = $did(mspedlg,1,0).sel, %selected
  1257.     while (%i <= %s) {
  1258.       %selected = %selected $+ : $+ $did(mspedlg,1,%i).sel $+ :
  1259.       inc %i
  1260.     }
  1261.     %i = 1
  1262.     hmake msplaytmpplaylistdel 100
  1263.     while (%i <= %e) {
  1264.       var %cursel = : $+ %i $+  :
  1265.       if (%cursel !isin %selected) { hadd msplaytmpplaylistdel %i $did(mspedlg,1,%i) }
  1266.       inc %i
  1267.     }
  1268.     if ($hget(msplaytmpplaylistdel)) {
  1269.       did -r mspedlg 1
  1270.       %i = 1
  1271.       while (%i <= %e) {
  1272.         var %curhget = $hget(msplaytmpplaylistdel,%i)
  1273.         if (%curhget) { did -a mspedlg 1 %curhget }
  1274.         inc %i
  1275.       }
  1276.       hfree msplaytmpplaylistdel
  1277.     }
  1278.     did -z mspedlg 1
  1279.   }
  1280.   if ($did = 4) {
  1281.     var %playlist = $+(",$msoundcfg(playlistdir) $+ $did(mspedlg,6),")
  1282.     var %playlistfsize = $file(%playlist).size
  1283.     write -c %playlist
  1284.     var %i = 1, %e = $did(mspedlg,1).lines
  1285.     while (%i <= %e) {
  1286.       write %playlist $did(mspedlg,1,%i)
  1287.       inc %i
  1288.     }
  1289.     if (%playlistfsize != $file(%playlist).size) {
  1290.       dialog -n mscfgdlg
  1291.       dialog -n mspedlg
  1292.       var %fuck = $input(Updated playlist: $crlf $nopath(%playlist),awo,MSPLAY)
  1293.       dialog -o mscfgdlg
  1294.       dialog -o mspedlg
  1295.     }
  1296.   }
  1297. }
  1298. alias -l refreshplaylisteditor {
  1299.   var %playlist = $+(",$msoundcfg(playlistdir) $+ $1-,")
  1300.   if ($exists(%playlist)) {
  1301.     var %i = 1, %e = $lines(%playlist)
  1302.     while (%i <= %e) {
  1303.       var %line = $read(%playlist, %i)
  1304.       did -z mspedlg 1
  1305.       ;if ($left(%line,1) != $chr(35)) {
  1306.       did -a mspedlg 1 %line
  1307.       ;}
  1308.       inc %i
  1309.     }
  1310.   }
  1311. }
  1312.  
  1313. alias refreshoptionsplaylist {
  1314.   did -r mscfgdlg 78
  1315.   var %playlistdir = $msoundcfg(playlistdir)
  1316.   var %i = 1, %e = $findfile(%playlistdir,*.m3u,0)
  1317.   while (%i <= %e) {
  1318.     var %playlist = $findfile(%playlistdir,*.m3u,%i)
  1319.     did -a mscfgdlg 78 $nopath(%playlist)
  1320.     inc %i
  1321.   }
  1322. }
  1323.  
  1324. alias gotoprevplaylist {
  1325.   var %curplaylist = $msoundcfg(curplaylist), %onplaylist, %nextplaylist
  1326.   if (%curplaylist == $null) { writemsoundcfg curplaylist $msoundcfg(playlist) | %curplaylist = $msoundcfg(playlist) }
  1327.   if (%curplaylist) {
  1328.     var %i = 1, %e = $findfile($msoundcfg(playlistdir),*.m3u,0)
  1329.     while (%i <= %e) {
  1330.       %onplaylist = %i $+ : $+ $nopath($findfile($msoundcfg(playlistdir),*.m3u,%i))
  1331.       if ($gettok(%curplaylist,1,58) == %i) {
  1332.         var %i2 = $calc(%i -1)
  1333.         if (%i2 > %e) { %i2 = 1 }
  1334.         if (%i2 == 0) { %i2 = %e }
  1335.         %nextplaylist = $findfile($msoundcfg(playlistdir),*.m3u,%i2)
  1336.         if ($exists(%nextplaylist)) {
  1337.           %nextplaylist = %i2 $+ : $+ $nopath(%nextplaylist)
  1338.           writemsoundcfg curplaylist %nextplaylist
  1339.           break
  1340.         }
  1341.       }
  1342.       inc %i
  1343.     }
  1344.   }
  1345.   if ($dialog(msplayfordummies)) { did -ar msplayfordummies 11 $gettok($msoundcfg(curplaylist),2,58) }
  1346. }
  1347.  
  1348. alias gotonextplaylist {
  1349.   var %curplaylist = $msoundcfg(curplaylist), %onplaylist, %nextplaylist
  1350.   if (%curplaylist == $null) { writemsoundcfg curplaylist $msoundcfg(playlist) | %curplaylist = $msoundcfg(playlist) }
  1351.   if (%curplaylist) {
  1352.     var %i = 1, %e = $findfile($msoundcfg(playlistdir),*.m3u,0)
  1353.     while (%i <= %e) {
  1354.       %onplaylist = %i $+ : $+ $nopath($findfile($msoundcfg(playlistdir),*.m3u,%i))
  1355.       if ($gettok(%curplaylist,1,58) == %i) {
  1356.         var %i2 = $calc(%i +1)
  1357.         if (%i2 > %e) { %i2 = 1 }
  1358.         %nextplaylist = $findfile($msoundcfg(playlistdir),*.m3u,%i2)
  1359.         if ($exists(%nextplaylist)) {
  1360.           %nextplaylist = %i2 $+ : $+ $nopath(%nextplaylist)
  1361.           writemsoundcfg curplaylist %nextplaylist
  1362.           break
  1363.         }
  1364.       }
  1365.       inc %i
  1366.     }
  1367.   }
  1368.   if ($dialog(msplayfordummies)) { did -ar msplayfordummies 11 $gettok($msoundcfg(curplaylist),2,58) }
  1369. }
  1370.  
  1371. alias -l msplayfordummies { dialog -dm msplayfordummies msplayfordummies }
  1372.  
  1373. dialog msplayfordummies {
  1374.   title "MSPLAY for Dummies"
  1375.   size -1 -1 200 105
  1376.   option dbu
  1377.   list 1, 0 13 200 70, size hsbar vsbar
  1378.   button "Search For", 2, 1 1 34 10
  1379.   edit "", 3, 38 1 80 11
  1380.   button "Play", 4, 1 94 20 10
  1381.   button "Play Random", 5, 45 94 40 10
  1382.   button "List Playlist", 6, 1 1 34 10
  1383.   button "<-", 7, 38 1 9 10
  1384.   button "->", 8, 47 1 9 10
  1385.   button "Stop", 9, 179 94 20 10
  1386.   text "Current Playlist:", 10, 60 3 40 8
  1387.   text "", 11, 102 3 110 8
  1388.   scroll "", 12, 23 82 153 10, horizontal range 0 0
  1389. }
  1390. on *:dialog:msplayfordummies:scroll:12: { if ($insong) { splay -p seek $did(msplayfordummies,12).sel $+ 000 } }
  1391. on *:dialog:msplayfordummies:init:*: {
  1392.   if ($msoundcfg(enableplaylist) == 1) { did -bh $dname 2,3,5 }
  1393.   if ($msoundcfg(enableplaylist) == 0) { did -bh $dname 6,7,8,10,11 }
  1394.   ;did -b $dname 4
  1395.   did -t $dname 2
  1396.   did -a $dname 11 $gettok($msoundcfg(curplaylist),2,58)
  1397.   if ($msoundcfg(enableplaylist) == 1) { msplaydummiesplaylist }
  1398.   if (($insong) || ($inwave) || ($inmidi)) { did -c $dname 1 %msplay_playlistline | .timermsscrolling 0 1 scrollplay }
  1399. }
  1400. on *:dialog:msplayfordummies:close:*: { if (%ms-scrolling) { unset %ms-scrolling } }
  1401. on *:dialog:msplayfordummies:sclick:*: {
  1402.   if ($msoundcfg(enableplaylist) == 1) { did -bh $dname 2,3,5 | did -ev $dname 6,7,8,10,11 }
  1403.   if ($msoundcfg(enableplaylist) == 0) { did -bh $dname 6,7,8,10,11 | did -ev $dname 2,3,5 }
  1404.   if ($did = 1) {
  1405.     if ($did($dname,1).seltext) { did -e $dname 4,5 }
  1406.   }
  1407.   if (($did = 2) && ($did($dname,3))) {
  1408.     if ($msoundcfg(enableplaylist) == 1) {
  1409.       ;did -bh $dname 2,3,5
  1410.       ;did -ev $dname 6,7,8,10,11
  1411.       msplaydummiesplaylist
  1412.       halt
  1413.     }
  1414.     var %searchfor = $replace($did($dname,3),$chr(32),$chr(42))
  1415.     if (%searchfor) {
  1416.       did -r $dname 1
  1417.       var %i = 1, %e = $easyfs(%searchfor,0)
  1418.       while (%i <= %e) {
  1419.         did -a $dname 1 $nopath($easyfs(%searchfor,%i))
  1420.         inc %i
  1421.       }
  1422.       did -z $dname 1
  1423.     }
  1424.   }
  1425.   if ($did = 4) {
  1426.     splay stop
  1427.     if ($timer(msscrolling)) { .timermsscrolling off }
  1428.     if (%ms-scrolling) { unset %ms-scrolling }
  1429.     did -c $dname 12 1
  1430.     did -z $dname 12 0 0
  1431.     .timer 1 1 scrollplay
  1432.     if ($msoundcfg(enableplaylist) == 1) { msplay $did($dname,1).sel }
  1433.     else { msplay $replace($did($dname,1).seltext,$chr(32),$chr(42)) }
  1434.   }
  1435.   if ($did = 5) { msplay }
  1436.   if ($did = 6) {
  1437.     if ($msoundcfg(enableplaylist) == 0) {
  1438.       did -bh $dname 6,7,8
  1439.       did -ev $dname 2,3,5
  1440.     }
  1441.     msplaydummiesplaylist
  1442.   }
  1443.   if ($did = 7) { did -r $dname 1 | gotoprevplaylist | msplaydummiesplaylist }
  1444.   if ($did = 8) { did -r $dname 1 | gotonextplaylist | msplaydummiesplaylist }
  1445.   if ($did = 9) {
  1446.     splay stop
  1447.     if ($timer(msscrolling)) { .timermsscrolling off }
  1448.     if (%ms-scrolling) { unset %ms-scrolling }
  1449.     did -c $dname 12 1
  1450.     did -z $dname 12 0 0
  1451.   }
  1452. }
  1453. on *:dialog:msplayfordummies:dclick:*: {
  1454.   if ($did = 1) {
  1455.     splay stop
  1456.     if ($timer(msscrolling)) { .timermsscrolling off }
  1457.     if (%ms-scrolling) { unset %ms-scrolling }
  1458.     did -c $dname 12 1
  1459.     did -z $dname 12 0 0
  1460.     .timer 1 1 scrollplay
  1461.     if ($msoundcfg(enableplaylist) == 1) { msplay $did($dname,1).sel }
  1462.     else { msplay $replace($did($dname,1).seltext,$chr(32),$chr(42)) }
  1463.   }
  1464. }
  1465. alias -l msplaydummiesplaylist {
  1466.   var %playlist = $msoundcfg(playlistdir) $+ $gettok($msoundcfg(curplaylist),2,58)
  1467.   var %i = 1, %e = $lines(%playlist)
  1468.   did -r msplayfordummies 1
  1469.   while (%i <= %e) {
  1470.     did -a msplayfordummies 1 $nopath($read(%playlist,%i))
  1471.     inc %i
  1472.   }
  1473. }
  1474. alias -l scrollplay {
  1475.   if ($dialog(msplayfordummies)) {
  1476.     if (($inmidi) || ($insong) || ($inwave)) {
  1477.       var %length, %pos, %seconds, %secpos
  1478.       if ($inmidi) { var %length = $inmidi.length, %pos = $inmidi.pos, %seconds = $int($calc($inmidi.length *0.001))), %secpos = $int($calc($inmidi.pos *0.001)) }
  1479.       if ($insong) { var %length = $insong.length, %pos = $insong.pos, %seconds = $int($calc($insong.length *0.001))), %secpos = $int($calc($insong.pos *0.001)) }
  1480.       if ($inwave) { var %length = $inwave.length, %pos = $inwave.pos, %seconds = $int($calc($inwave.length *0.001))), %secpos = $int($calc($inwave.pos *0.001)) }
  1481.       if (%ms-scrolling == $null) {
  1482.         set %ms-scrolling $true
  1483.         did -z msplayfordummies 12 1 %seconds
  1484.         did -c msplayfordummies 12 1
  1485.         .timermsscrolling 0 1 scrollplay
  1486.       }
  1487.       did -c msplayfordummies 12 %secpos
  1488.       if (%secpos >= $calc(%seconds -1)) { unset %ms-scrolling | .timermsscrollreset 1 1 did -z msplayfordummies 12 0 0 }
  1489.     }
  1490.   }
  1491. }
  1492. /*
  1493. %msrsnd
  1494. %msctcpig
  1495. %msvar
  1496. *\
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement