mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
I have started to learn to script and in my learning I have decided to make an MP3 player, now I have a few questions regarding the script and was wondering if anyone would mind helping me out.

First heres the dialog code:
Code:
 dialog ntoxamp {
  title "nT0xAmP"
  size -1 -1 174 180
  option dbu
  edit "", 1, 2 11 170 10, read center
  box "", 2, 1 7 172 24
  scroll "", 3, 3 21 167 8, horizontal bottom
  button "<<", 4, 3 45 13 12, flat
  button "|<", 5, 17 45 13 12, flat
  button "[>", 6, 31 45 13 12, flat
  button "[ ]", 7, 45 45 13 12, flat
  button "| |", 8, 59 45 13 12, flat
  button ">|", 9, 73 45 13 12, flat
  button ">>", 10, 87 45 13 12, flat
  edit "", 11, 3 32 26 10, read center
  box "", 12, 1 27 172 17
  edit "", 13, 107 32 64 10, read center
  edit "", 14, 29 32 26 10, read center
  edit "", 15, 55 32 26 10, read center
  edit "", 16, 81 32 26 10, read center
  box "", 17, 1 40 172 19
  box "", 18, 1 66 172 68
  list 19, 3 71 168 50, sort size
  button "Add Mp³", 20, 4 122 26 10, flat
  button "Remove Mp³", 21, 32 122 35 10, flat
  button "Generate Playlst Text File", 22, 102 122 68 10, flat
  box "", 23, 1 130 172 25
  combo 24, 3 142 144 37, size drop
  button "+", 25, 149 142 10 10, flat
  button "-", 26, 160 142 10 10, flat
  text "[ Mp³ Directories ]", 27, 4 134 166 8, center
  button "x", 28, 163 1 9 8, flat 
  button "_", 29, 153 1 9 8, flat 
  text "«~'|| ntoXic8dAmP ||'~»                                           (v)1.0.0b", 30, 1 2 151 8, center
  check "Shuffle", 31, 145 45 25 12, flat push
  check "Repeat", 32, 119 45 25 12, flat push
  box "", 33, 85 151 88 16
  box "", 34, 1 151 85 16
  check "Announce to Channel", 35, 12 156 66 10
  check "Disable Announce on Away", 36, 91 156 76 10
  box "", 37, 1 163 172 16
  button "« « ~ finished ~ » »", 38, 3 168 168 9, flat ok
  box "", 39, 1 55 172 15
  text "« vol »", 40, 3 60 17 8
  button "+", 41, 21 60 9 8, flat
  button "-", 42, 31 60 9 8, flat
  button "X", 43, 41 60 9 8, flat
  edit "", 44, 51 59 22 10, read center
  edit "", 45, 73 59 97 10, read center
}
 


( fulls cript below )

1- Now, if you are looking at it, you will see the scroll bar under the top edit box, I want to make this a progress bar without using any dll's, and also use the < and > scroll buttons as seek like seen in many mp3 scripts.

2- Another thing is How do I retreive the total mb's from a dir?

3- Multiple sclick events going to one alias? How? I tried $iif(did(id)) and if ($did(id1)) { then } if ($did(id2)) { then } but nothing seems to work.

Also any concerns, comments, or improvments will be greatly appreciated, also please provide, Why? and How its done, remember I am new to this. Thanks in advance.

Heres the complete code:
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;#  Script: «~- nToXIc8d AmP -~»    |||       Version:   v.1.0.1      #;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;#  Coding: sheyz (sheyz@sheyz.net)                                   #;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias mp3 { dialog -am ntoxamp ntoxamp }
alias load.settings {
  vol -v %vol
  .timer1 1 1 did -a ntoxamp 44 %vol.pos
  .timer3 1 2 list
}
alias exit {
  unset %mp3 %mp3.song %nub %file %mp3.stat.*
}
alias list {
  if (%mp3.dir == $null) { set %mp3.dir $dir "Where are your Mp3's?" }
  did -r ntoxamp 19
  var %r 1
  while ( %r &lt;= $findfile(%mp3.dir,*.mp3,0) ) {
    did -a ntoxamp 19 $nopath($findfile(%mp3.dir,*.mp3,%r))
  inc %r }
  unset %r
  did -a ntoxamp 45 $findfile(%mp3.dir,*.mp3,0,999) mp3's,totaling: mb 
  did -ra ntoxamp 24 %mp3.dir
}
alias mp3.vol {
  if ($did(41)) {
    if (%vol &gt;= 65535) { halt }
    else { 
      inc %vol $calc(65535/100*10)
      vol -v %vol
      set %vol.pos $calc(%vol / 6553.5) $+ 0 $+ %
      if (%vol.pos == 100%) { did -ra ntoxamp 44 MAX }
      else { did -ra ntoxamp 44 %vol.pos }
      halt
    }
  }
  if ($did(42)) {
    if (%vol &lt;= 0) { halt }
    else { 
      dec %vol $calc(65535/100*10)
      vol -v %vol
      set %vol.pos $calc(%vol/6553.5) $+ 0 $+ %
      if (%vol.pos == 00%) { did -ra ntoxamp 44 MIN }
      else { did -ra ntoxamp 44 %vol.pos }
      halt
    } 
  }
  if ($did(43)) {
    if (%mp3.mute == 0) { 
      set %mute 1
      set %un.mute %vol
      vol -v 0
      did -ra ntoxamp 44 Mute
      halt
    }
    else { 
      set %mute 0
      vol -v %un.mute
      did -ra ntoxamp 44 $calc(%vol / 6553.5) $+ 0 $+ %
      unset %un.mute
      halt
    }
  }
}
alias mp3.stop { splay stop }
alias mp3.say {
  if ($did(35).state) { ame is playing: %mp3.song $mp3.stats }
  elseif ($did(35).state) { echo -a On but off }
  else { did -b ntoxamp 36 }
}
alias mp3.play {
  mp3.stats
  did -ra ntoxamp 1 %mp3.song
  did -ra ntoxamp 11 %mp3.stats.kbps
  did -ra ntoxamp 16 %mp3.stats.len
  did -ra ntoxamp 14 %mp3.stats.mode
  did -ra ntoxamp 15 %mp3.stats.size
  did -r ntoxamp 13
  splay -pq %mp3.dir $+ \ $+ %mp3
  $mp3.say
  unset %say*
}
alias mp3.stats {
  set %mp3.stats.size $round($calc($lof(%file) / 1048576),2) $+ mb
  set %mp3.stats.len $remove($duration($calc(($mp3(%file).length - $inmp3.pos) / 1000)),rs,ins,ecs)
  set %mp3.stats.kbps $mp3($iif(file,%file,$inmp3.fname)).bitrate
  set %mp3.stats.mode $lower($replace($remove($mp3($iif(%file,%file,$inmp3.fname)).mode,joint,$chr(32),channel),single,mono))  
  return 10(11size:15 $+ %mp3.size $+ 10) (11length:15 $+ %mp3.len $+ 10) (11kbps:15 $+ %mp3.kbps $+ 10) (11mode:15 $+ %mp3.mode $+ 10) 
}

dialog ntoxamp {
  title "nT0xAmP"
  size -1 -1 174 180
  option dbu
  edit "", 1, 2 11 170 10, read center
  box "", 2, 1 7 172 24
  scroll "", 3, 3 21 167 8, horizontal bottom
  button "&lt;&lt;", 4, 3 45 13 12, flat
  button "|&lt;", 5, 17 45 13 12, flat
  button "[&gt;", 6, 31 45 13 12, flat
  button "[ ]", 7, 45 45 13 12, flat
  button "| |", 8, 59 45 13 12, flat
  button "&gt;|", 9, 73 45 13 12, flat
  button "&gt;&gt;", 10, 87 45 13 12, flat
  edit "", 11, 3 32 26 10, read center
  box "", 12, 1 27 172 17
  edit "", 13, 107 32 64 10, read center
  edit "", 14, 29 32 26 10, read center
  edit "", 15, 55 32 26 10, read center
  edit "", 16, 81 32 26 10, read center
  box "", 17, 1 40 172 19
  box "", 18, 1 66 172 68
  list 19, 3 71 168 50, sort size
  button "Add Mp³", 20, 4 122 26 10, flat
  button "Remove Mp³", 21, 32 122 35 10, flat
  button "Generate Playlst Text File", 22, 102 122 68 10, flat
  box "", 23, 1 130 172 25
  combo 24, 3 142 144 37, size drop
  button "+", 25, 149 142 10 10, flat
  button "-", 26, 160 142 10 10, flat
  text "[ Mp³ Directories ]", 27, 4 134 166 8, center
  button "x", 28, 163 1 9 8, flat 
  button "_", 29, 153 1 9 8, flat 
  text "«~'|| ntoXic8dAmP ||'~»                                           (v)1.0.0b", 30, 1 2 151 8, center
  check "Shuffle", 31, 145 45 25 12, flat push
  check "Repeat", 32, 119 45 25 12, flat push
  box "", 33, 85 151 88 16
  box "", 34, 1 151 85 16
  check "Announce to Channel", 35, 12 156 66 10
  check "Disable Announce on Away", 36, 91 156 76 10
  box "", 37, 1 163 172 16
  button "« « ~ finished ~ » »", 38, 3 168 168 9, flat ok
  box "", 39, 1 55 172 15
  text "« vol »", 40, 3 60 17 8
  button "+", 41, 21 60 9 8, flat
  button "-", 42, 31 60 9 8, flat
  button "X", 43, 41 60 9 8, flat
  edit "", 44, 51 59 22 10, read center
  edit "", 45, 73 59 97 10, read center
}
on *:dialog:ntoxamp:init:0 { load.settings }
on *:dialog:ntoxamp:dclick:19: { 
  set %file %mp3.dir $+ $did(19).seltext
  set %mp3 $did(19).seltext
  set %mp3.song $replace($remove(%mp3,.mp3),_,$chr(32))
  if ($insong == $true) { splay -c stop }
  mp3.play
}
on *:dialog:ntoxamp:sclick:*: { 
  if ($devent == 4) { mp3.prev }
  if ($devent == 5) { mp3.rev }
  if ($devent == 6) {
    set %file %mp3.dir $+ $did(19).seltext
    set %mp3 $did(19).seltext 
    set %mp3.song $replace($remove(%mp3,.mp3),_,$chr(32))
    if ($insong == $true) { splay -c stop }
    mp3.play
  }
  if ($devent == 7) { mp3.stop }
  if ($devent == 8) { mp3.pause }
  if ($devent == 9) { mp3.forw }
  if ($devent == 10) { mp3.next }
  if ($devent == 25) { set %mp3.dir $sdir(c:\,"Where is your Mp3 directory located?") | list }
  if ($devent == 41) { mp3.vol }
  if ($devent == 42) { mp3.vol }
  if ($devent == 43) { mp3.vol }
  if ($devent == 35) { mp3.say }
  if ($devent == 36) { return $did(36,1,0) }
  if ($devent == 28) { exit }
  if ($devent == 29) { dialog -ie ntoxamp ntoxamp }
}
 


« «~ nT0x ~» »
Joined: Jan 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
well.. first of all, making a trackbar is not possible without using dll (e.g mdx.dll - i use it very easy!).

For the progress bar (also in mdx) you can make a @window thing but thats not my field.. :P

Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
ok then so be it, but where do I get some info on making a trackbar with mdx ?


« «~ nT0x ~» »
Joined: Jan 2003
Posts: 148
K
Vogon poet
Offline
Vogon poet
K
Joined: Jan 2003
Posts: 148
if you dowload mdx there is a help file that will tell you how inside

Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
he wanted his scrollbar to go along as the song progresses, that is possible.

Code:
.did -z &lt;dialog name&gt; &lt;id of bar&gt; $inmp3.length
.timerprog -m 0 1 did -c &lt;dialog name&gt; &lt;id of bar&gt; $!inmp3.pos

just add that after you play the song smile
then for the seek thing
Code:
on *:dialog:name:scroll:id:{
.splay seek $did(id).sel
}

also make sure you turn of the timer when you close the dialog
Code:
on *:dialog:name:close:0:{ .timerprog off }


just change all the id's and name's to your dialog name and the id of the scrollbar.


new username: tidy_trax
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
well I have added those lines but am getting the following error:
* /did: insufficient parameters (line 82, ntox_mp3.mrc)

Also the scrollbar has the follwing code:
scroll "", 3, 3 21 167 8, horizontal bottom 0 1000

Right now my Play alias looks like ( with your lines included )
alias mp3.play {
mp3.stats
did -ra ntoxamp 1 %mp3.song
did -ra ntoxamp 11 %mp3.stats.kbps
did -ra ntoxamp 16 %mp3.stats.len
did -ra ntoxamp 14 %mp3.stats.mode
did -ra ntoxamp 15 %mp3.stats.size
did -r ntoxamp 13
splay -pq %mp3.dir $+ \ $+ %mp3
did -z ntoxamp 3 $inmp3.length
.timer.seek.bar -m 0 1 did -c ntoxamp 3 $!inmp3.pos
$mp3.say
unset %say*
}

thanks again


« «~ nT0x ~» »
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
whats line 82?


new username: tidy_trax
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
did -z ntoxamp 3 $inmp3.length


« «~ nT0x ~» »
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
I got the same error here.. and have been testing a while, cant make it to work as it should, but will post here if i get whats wrong smile


*edit*
i found out that if i dont use the first line, then i can get it to work if i change the line to:

scroll "", 3, 3 21 167 8,, horizontal range 0 1000

but it scrolls it fast as h*ll, so i will try som more smile

*Edited again--------------

this line works:

scroll "", 3, 3 160 100 8, horizontal range 0 69000

if the mp3 length is 1min and 10 sec .. dont know how you can calc that value tho

Last edited by sparta; 21/09/03 02:06 AM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
hmmm. well I added what you said to teh scroll line, but now its working kinda funny, I guess we need to know where to set the range too? Also, still getting that did error.


« «~ nT0x ~» »
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
remove the line:

did -z ntoxamp 3 $inmp3.length

no use for it.. not what i can see.. and yes, it moves a bit funny. it depends on how long in minutse/seconds the mp3 are.. my example was for a mp3 that was 1min and 10 sec long.. and it worked fine.. but i cant figure out how to get the values.. crazy


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
ok your right, now its moving, like I said before I think we just need to figure out how to get the range
Ill let you know if I find out, and please do the same if you find out as well

Another problem which may be kinda dumb or easy fix is well Ill have to show you. I have three different sclick events which all lead to the same alias ( mp3.vol ) but I do not know how to seperate the $did's.... heres the code, youll see what I am talking about ....

Code:
alias mp3.vol {
  if ($did(41)) {
    if (%vol &gt;= 65535) { halt }
    else { 
      inc %vol $calc(65535/100*10)
      vol -v %vol
      set %vol.pos $calc(%vol / 6553.5) $+ 0 $+ %
      if (%vol.pos == 100%) { did -ra ntoxamp 44 MAX }
      else { did -ra ntoxamp 44 %vol.pos }
      halt
    }
  }
  if ($did(42)) {
    if (%vol &lt;= 0) { halt }
    else { 
      dec %vol $calc(65535/100*10)
      vol -v %vol
      set %vol.pos $calc(%vol/6553.5) $+ 0 $+ %
      if (%vol.pos == 00%) { did -ra ntoxamp 44 MIN }
      else { did -ra ntoxamp 44 %vol.pos }
      halt
    } 
  }
  if ($did(43)) {
    if (%mp3.mute == 0) { 
      set %mute 1
      set %un.mute %vol
      vol -v 0
      did -ra ntoxamp 44 Mute
      halt
    }
    else { 
      set %mute 0
      vol -v %un.mute
      did -ra ntoxamp 44 $calc(%vol / 6553.5) $+ 0 $+ %
      unset %un.mute
      halt
    }
  }
}
on *:dialog:ntoxamp:sclick:*: {
  if ($devent == 41) { mp3.vol }
  if ($devent == 42) { mp3.vol }
  if ($devent == 43) { mp3.vol }
}

Last edited by nt0x; 21/09/03 04:45 AM.

« «~ nT0x ~» »
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
dont remove: did -z ntoxamp 3 $inmp3.length
i forgot you have to provide a start range and a stop range:
change it to did -z ntoxamp 3 0 $inmp3.length


new username: tidy_trax
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
ok now the scroll works, but the seek doesnt, whether I move it or with the '<' '>' buttons. If I move it it looks like it moves a little bit but eventually jumps back to the beginning. Also Please if anyone knows my issue with the alias problem I am having with mp3.vol (scroll up) Thats my pain in the ass right now, I cant seem to figure it out !!!!!

(banging head against wall)


« «~ nT0x ~» »
Joined: May 2003
Posts: 2,265
P
Hoopy frood
Offline
Hoopy frood
P
Joined: May 2003
Posts: 2,265
seek:

Code:
on *:dialog:ntoxamp:scroll:3:{
.timerprog off
.splay seek $did(3).sel
.timerprog -m 0 1 did -c ntoxamp 3 $!inmp3.pos
}


new username: tidy_trax
Joined: Feb 2003
Posts: 3,432
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Code:
on *:dialog:Volcontrol:*:*: {
  if ($devent == init) {
    did -c volcontrol 12 $calc(65536 - %curvol)
    did -ra volcontrol 13 %curvol
  }
  if ($devent == sclick) {
    if ($did == 14) { vol.checks }
  }
  if ($devent == scroll) {
    did -ra volcontrol $calc($did + 1 ) $calc(65535 - $did($did).sel) | set %curvol $calc(65535 - $did($did).sel)
    vol -v $+ $vc.abbr($int($calc($did / 10))) $calc(65535 - $did($did).sel) | set %curvol $vc.abbr($int($calc($did / 10))) $calc(65535 - $did($did).sel)
  }
}


there you have my code, and it works great for me, maybe you can do somthing out of it so it work as u want? smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
You guys are the best, thanks for all your help. I had teh volume working before when I orginally had it in the events, then I moved them to alias's, but I think I am going to switch them back. Ill keep you guys informed of any progresses/changes/problems.

=/ Seek still doing same thing, it wont go more than a bit halfway before it returns to the beginning.

Last edited by nt0x; 21/09/03 05:15 PM.

« «~ nT0x ~» »
Joined: Sep 2003
Posts: 11
N
nt0x Offline OP
Pikka bird
OP Offline
Pikka bird
N
Joined: Sep 2003
Posts: 11
bahhh, Seek!!! It wontt work right !!!!! if you drag the bar it only goes about 1/4 of the way then jumps to the beginning! grrrrr
aggravating!


« «~ nT0x ~» »

Link Copied to Clipboard