mIRC Homepage
Posted By: mIRCd MP3 Player - 11/12/02 01:09 PM
I have started to make an mp3 player with a difference. I have obtained a "player" interface jpg for using as a background and have cut the relevant parts out and saved them as jpg's also

My plan was to make a dialog and have the whole interface as a background using: icon 1, 0 0 200 300, bg.jpg, noborder
and placing the button jpg's ontop of this as icons also. but when i try: on *:dialog:player:2:sclick: { ...
with the select mp3 commands and play etc, nothing happens. i aslo tried doing a simple echo instead to see if anything was happening and it wasnt just my code, but alas nothing at all.... so could anyone point me in the right direction or solve this problem. thanks
Posted By: Nimue Re: MP3 Player - 11/12/02 01:17 PM
You have
on *:dialog:name:id:event:{

which should be
on *:dialog:name:event:id:{
Posted By: Merlin Re: MP3 Player - 11/12/02 03:18 PM
Use the mouse option in the dialog event smile
Code:
  
ON 1:DIALOG:MyDialog:Mouse:*: {
  ; The next line is for displaying the mouse position over the whole dialog (or the image size)
  ; where 5,9,288,291 is the area of the dialog ( size parameter) or the image
  ; echo 10 -s Global Position at13 $mouse.x $mouse.y - $inrect($mouse.x,$mouse.y,5,9,228,291)
  ;
  ; The next line checks if we are still inside the dialog/image
  IF ($inrect($mouse.x,$mouse.y,5,9,230,299) == $true) {
    ;
    IF ($inrect($mouse.x,$mouse.y,5,10,105,52) == $true) {
      ;
      ; Now for each area like a play button (area) at 5,19,105,52 
      ; here we do the commands for that area
      ;
    }
    ; Next areas like Pause, Stop etc follows here - like in the above example
  }
}

NOTE: This works only on mIRC version 6.02 and higher see versions.txt item below:
107.The on DIALOG mouse event now triggers over controls in a dialog and $did is set to the control id value.
This means the $did value is always the id of the image of your MP3 Player graphic.

For more info read /help /dialog and /help $mouse - I hope this example helps you a step further smile
Posted By: mIRCd Re: MP3 Player - 11/12/02 07:16 PM
Cheers for that. i ended up playing about with it alla bit and found the the normal on dialog... sclick thing wasnt working because of having one graphic ontop of another so being of a simplified mind i simply cut up the background into lots of smaller sections and aligned all together so it appears to be the one image and that seems to be working alright, so thanks for that.. ive saved that mose positioning thing incase it pops up somewhere else along my scripting journey.

i'll post a screenshot up once i get it all working anyway.
--------------------------------------------------------
Another thing i just happened to start upon today was a whois dialog. i so far have got a list box on one side which displays all the nicks in an active channel and changes when the active channel changes, and when a nick is double clicked sets that nick as %name

my plan was to have a text area beside this that displays all the whois info there but was having some problems, i tired setting a few %variables which didnt work and a friend suggested raw commands, but after having tried raw $311 it was working fine when typing the raw command normally, but i cannout get a $did command to print the information in the text area.... ?
this is what ive done so far:

dialog who {
title who
size 100 100 200 100
option dbu

list 2, 2 2 50 98, autohs
text "WHOIS", 1, 52 2 50 98, center
}

on *:ACTIVE:*: {
if ($dialog(who) == $null) { halt }
else { did -r who 2
var %i 1
while (%i <= $nick($active,0)) {
did -a who 2 $nick($active,%i)
inc %i
}
}
dialog -t who #
}
on *:dialog:who:init:*: {
did -r who 2
var %i 1
while (%i <= $nick($active,0)) {
did -a who 2 $nick($active,%i)
inc %i
}
}
on *:dialog:who:dclick:2: {
set %name $did(2).seltext
did -a who 1 Whois: %name
}

alias who {
dialog -m who who
}
Posted By: Hammer Re: MP3 Player - 12/12/02 06:09 PM
A couple of things spring immediately to mind. If you're going to be writing multiple lines to a textbox, you'll need it to be able to handle multiple lines, so use: text "WHOIS", 1, 52 2 50 98, [color:#006600]multi center[/color]
Code:

on *:DIALOG:who:dclick:2:{
  set %name $did(2).seltext
  did -a who 1 Whois: 
}
raw *:*: if ($istok(311:319:312:307:301:313:317:318,$numeric,58) &amp;&amp; ($dialog(who)) &amp;&amp; ($2 == %name)) did -a who 1 $3-

$1 is $me, and $2 is whoever it is you're /whois-ing
Posted By: mIRCd Re: MP3 Player - 12/12/02 09:05 PM
Cheers for that. finally got it working, much appreciated grin smile

Heres the promised screenshot of the mp3 player so far. still more to do. at the min it has:
- File list, with change and set dir option
- Scrolling title, artist and length info at the top
- All buttons working (play, stop, setup, close, volume)
- Tracking progress bar for song length
- Public display of song info
and i plan to fire in some more stuff soon and release it all once i get rid of all the bugs and add more features to it.
Thanks for all the help anyone that did!!!

Screenshot:
© mIRC Discussion Forums