mIRC Home    About    Download    Register    News    Help

Print Thread
#167905 01/01/07 04:16 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
First problem solved!

meed help with this tho! i trying to make a "radom" funktion, when pressed it should read from the file i store the path to the mp3's, then pic a random line. and when that song played it pic a new mp3 on random. this is what i have when i pres "play"..
Code:
alias mp3.play {
  if (%mp3file != $null) { mp3.timepl }
  elseif (%mp3file == $null) { did -ra mp3player 3 No song chosen, please do so now.  | halt }
  if (!$dialog(playlist)) { .splay %mp3file | mp3tmp }
  else {
    echo -s $read($mircdir\mp3list.txt,nt,$did(playlist,1).sel))
    .splay $read($mircdir\mp3list.txt,nt,$did(playlist,1).sel))
    if ($dialog(playlist)) set %r.line $did(playlist,1).sel
    if ($dialog(playlist)) did -c playlist 1 %r.line
    mp3tmp
  }
}

someone that can figure this one out? i get errors when i try to solve it smirk

Last edited by sparta; 01/01/07 04:26 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Looking at that without the rest of the aliases, I see a couple of things. First, this will only work if the dialog is open. If you want it to randomly play songs in a playlist until you stop it, you might not want to always have the dialog open while the songs are playing. Of course, I don't know what you have as a dialog. Maybe you do want it to always be open.

Next, you're always reading from the file a specific line number (the line selected in the dialog). That's not random. You'd want to do something like:

Code:
    var %readline = $rand(1,$lines(mp3list.txt))
    echo -s $read($mircdir\mp3list.txt,nt,%readline)
    .splay $read($mircdir\mp3list.txt,nt,%readline)


or

Code:
    echo -s $read($mircdir\mp3list.txt,nt)
    .splay $read($mircdir\mp3list.txt,nt,$readn)


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
i just solved it befor i looked here smile but thnx for your time smile


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
Grr, more and more problems.. frown now i try make a slidebar "or what its called".. this is what i have:
Code:


on *:dialog:mp3player:*:*: {
  if ($devent == init) {
    $dllmdx SetControlMDX mp3player 48 ListView showsel report flatsb single grid rowselect > $mdx.views
    did -i mp3player 48 1 headerdims 130:1 55:2 100:3

alias dllmdx return dll " $+ $mircdirdll\mdx.dll $+ "
alias mdx.views return $mircdirdll\views.mdx

The id i try to change looks like:

list 48, 5 43 110 15, size

and the dll is stored in: C:\mIRC\dll\
same goes for views.mdx

But it wont work, any ideas on it?

Last edited by sparta; 01/01/07 06:28 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Sorry. I gave up on MDX a long time ago. It is still used in my Weather script (for the GUI version) because I didn't want to redo it, but now if I need a DLL for stuff like that, I stick to DCX.

One thing, tho... did you Mark the dialog? Both MDX and DCX require you to Mark any dialog that you want to use the DLL in before you do any DLL stuff with it.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
forgot to mark it, but it still looks wierd smirk so dunno whats wrong with it. looks like:

www.mindflow.mine.nu/~ut/mp3player.jpg

any ideas?

;--------- Edit

Tryed the DCX dll, but couldent get that one to work at all, i got many errors, and didnt mather how i edited the code, didnt return anything of the thing i looking for. and tested to copy some parts from the "demo", still no luck, so how do i use it?

Last edited by sparta; 01/01/07 07:55 PM.

if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
By "looks weird", are you referring to the scrollbar having extra height to it? If so, I don't know why it would do that.

For DCX, you're going to probably want at least these default aliases in your script:
Code:
;DCX Stuff
alias dcx {
  if ($isid) return $dll($scriptdirdcx\dcx.dll,$1,$2-)
  else dll " $+ $scriptdirdcx\dcx.dll" $1 $2-
}

alias udcx {
  $iif($menu, .timer 1 0) dll -u dcx.dll
}

alias xdid {
  if ($isid) {
    return $dcx(_xdid, $1 $2 $prop $3-)
  }
  else {
    dcx xdid $2 $3 $1 $4-
  }
}

alias xdialog {
  if ($isid) {
    return $dcx(_xdialog, $1 $prop $2-)
  }
  else {
    dcx xdialog $2 $1 $3-
  }
}



Also, all events are handled through callback aliases. For example, in one of my scripts:
Code:
;// The basic format of callback parameters are:
;// Parameter $1 = the dialog name (ie. very_basic)
;// Parameter $2 = the event name (ie. sclick) 
;// Parameter $3 = the ID of the control for which the event occurred (ie. ID #1)
alias scatter {
  if ($2 == keyup && $3 == 54 && $4 == 13) {
    if (%sopponent != $null) {
      if ($len(< $+ $me $+ > $did($1,54).text) > 300) { xdid -i $1 55 $xdid($1,55).num  $+ $color(info) $+ * ERROR: Line too long. }
      else {
        xdid -i $1 55 $xdid($1,55).num  $+ $color(own) $+ < $+ $me $+ > $did($1,54).text
        .ctcp %sopponent Scattergories Chat $did($1,54).text
      }
    }
    elseif (%sopponent == $null) { xdid -i $1 55 $xdid($1,55).num  $+ $color(info) $+ * ERROR: No opponent to chat with. }
    xdid -Z $1 55 100
    xdid -r $1 54
  }
}


That handled when Enter was pressed in ID 54.

And here is the mark command:
Code:
  dcx Mark $dname scatter


Note that "scatter" is my callback alias (above).

I know it took me some work to get it working with DCX, but once I figured out how callback aliases worked, it was pretty easy to do.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard