mIRC Home    About    Download    Register    News    Help

Print Thread
#224622 15/08/10 09:36 AM
Joined: Aug 2010
Posts: 69
N
N3M3S1S Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Aug 2010
Posts: 69
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?

Last edited by N3M3S1S; 15/08/10 09:56 AM.

"There is no theory of evolution, only a list of creatures Chuck Norris allows to live."
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
Quote:
msg $actice

Is actice an alias you use or do you mean to use $active ?

5618 #224626 15/08/10 09:52 AM
Joined: Aug 2010
Posts: 69
N
N3M3S1S Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Aug 2010
Posts: 69
Ooh no! That's typo I made in the code when placing it in this thread >_< edited.


"There is no theory of evolution, only a list of creatures Chuck Norris allows to live."
Joined: Jun 2007
Posts: 933
5
Hoopy frood
Offline
Hoopy frood
5
Joined: Jun 2007
Posts: 933
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.

5618 #224629 15/08/10 10:58 AM
Joined: Feb 2006
Posts: 546
J
Fjord artisan
Offline
Fjord artisan
J
Joined: Feb 2006
Posts: 546
$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


"The only excuse for making a useless script is that one admires it intensely" - Oscar Wilde
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
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.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2010
Posts: 69
N
N3M3S1S Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Aug 2010
Posts: 69
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!


"There is no theory of evolution, only a list of creatures Chuck Norris allows to live."
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
It sounds like you're losing $chan info in your alias, which would be caused by something else in your script.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2010
Posts: 69
N
N3M3S1S Offline OP
Babel fish
OP Offline
Babel fish
N
Joined: Aug 2010
Posts: 69
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.


"There is no theory of evolution, only a list of creatures Chuck Norris allows to live."

Link Copied to Clipboard