mIRC Homepage
Posted By: N3M3S1S $active, and /scid - 15/08/10 09:36 AM
Okay so I am making a MP3 player for my mIRC. I am in the final testing stages and I've come across a bug that I can't seem to squash. Everything works fine so far except for this one little bug. :\

Code:
alias mp3echo {
  %title = $iif($sound($2-).title == $null,N/A,$sound($2-).title)
  %artist = $iif($sound($2-).artist == $null,N/A,$sound($2-).artist)
  if ($1 == -a) { msg $active Now Playing: %title By: %artist }
  elseif ($1 == -b) { echo -a Now Playing: %title By: %artist }
}


Syntax: /mp3echo -ab <mp3filename>

-a Displays song info to active channel/query window.
-b Echos song info to active channel/query window.

When the MP3 player plays a song, at the beginning of it (depending on the settings) it will display the song information to the active window. Now it has three settings 1) Display to active channel 2) Echo to active window 3) No display. Options 2 and 3 work fine, its option 1 I am having the problem with.

So lets say I have two server connections. One on irc.server1.com and one on irc.server2.com and I initiate the MP3 player on irc.server2.com but then switch over to irc.server1.com and click play on active channel #channel. I will get a message saying "#channel no such nick/channel."

EDIT: Also! If I click the play button on the server that the MP3 player was initiated on, it will display the text to the active channel/query window without error. Its only when I try to use the Display to active channel/query setting on the other server.

Now if I use this:
Code:
alias mp3echo {
  %title = $iif($sound($2-).title == $null,N/A,$sound($2-).title)
  %artist = $iif($sound($2-).artist == $null,N/A,$sound($2-).artist)
  if ($1 == -a) { scid -a msg $active Now Playing: %title By: %artist }
  elseif ($1 == -b) { echo -a Now Playing: %title By: %artist }
}


It will show in the active channel/query on either of the servers but on the server that isn't active I -still- get the "#channel no such nick/channel" message.

What my question is: How do I get /mp3echo -a <mp3filename> to display in the active channel/query regardless of the server connection without getting the "no such nick/channel" message?
Posted By: 5618 Re: $active, and /scid - 15/08/10 09:51 AM
Quote:
msg $actice

Is actice an alias you use or do you mean to use $active ?
Posted By: N3M3S1S Re: $active, and /scid - 15/08/10 09:52 AM
Ooh no! That's typo I made in the code when placing it in this thread >_< edited.
Posted By: 5618 Re: $active, and /scid - 15/08/10 10:24 AM
The problem is that you're using the -a switch, which makes the command perform on ALL connection IDs.
If you use...
Code:
scid $scid($cid)
...to set the connection ID to that of the active window it should work as desired.
Posted By: jaytea Re: $active, and /scid - 15/08/10 10:58 AM
$scid($cid) is the same as $cid but that ID would still be incorrect according to the OP's description. he could use:

Code:
scid $activecid


or even the connection independent /say if we're just dealing with the alias mentioned in the first post
Posted By: Riamus2 Re: $active, and /scid - 15/08/10 12:55 PM
Originally Posted By: jaytea
or even the connection independent /say if we're just dealing with the alias mentioned in the first post


Yeah, I'd just use /say instead of /msg $active.
Posted By: N3M3S1S Re: $active, and /scid - 15/08/10 11:48 PM
Code:
scid $scid($cid)


Using that still returned the #channel no such nick/channel message.

/say would give me this message: "Your not on a channel (line 152 mp3.mrc)" on both servers.

Code:
scid $activecid


This is the money maker! This one makes it work as desired. Thanks alot laugh

I will add everyone's name in this thread to the "Special Thanks To:" section in the readme file. Thanks alot guys!
Posted By: Riamus2 Re: $active, and /scid - 16/08/10 10:12 AM
It sounds like you're losing $chan info in your alias, which would be caused by something else in your script.
Posted By: N3M3S1S Re: $active, and /scid - 18/08/10 07:44 AM
Originally Posted By: "Riamus2"

It sounds like you're losing $chan info in your alias, which would be caused by something else in your script.


Well when I changed it from
Code:
msg $active

to
Code:
scid $activecid msg $active

The problem stopped completely.

http://www.hawkee.com/scripts/14030127/

Here is where you can find the finished product if you'd like to check it out for yourself. It works fine for me, although with the previous version there were problems with Windows Vista. :\ But on my OS (XP) It works perfectly.
© mIRC Discussion Forums