mIRC Home    About    Download    Register    News    Help

Print Thread
What's wrong with this little script? #140274 23/01/06 06:11 PM
Joined: Oct 2003
Posts: 68
Y
yamaz Offline OP
Babel fish
OP Offline
Babel fish
Y
Joined: Oct 2003
Posts: 68
Hi there, I have this alias (it resends the last file sent):

/resend {
if (%ultimofile == $null) { echo -a Non hai inviato nessun file. Idiota. | return }
if ($?!="Inviare %ultimofile a $active $+ ?" == $true) {
if ($left($active,1) == #) {
var %sendnick = $?="Invio a che nick?"
}
else var %sendnick = $active
if (%sendnick == $null) { echo -a Specifica un nick. | return }
dcc send %sendnick %ultimofile
}
}

it works almost perfectly, there's only a problem: if you type /resend in a channel window, it seems that the script can't detect that it's a channel ( if ($left($active,1) == #) )and does not ask for a nick to send. How can I fix it?

Thanks alot

Re: What's wrong with this little script? #140275 23/01/06 07:24 PM
Joined: Mar 2004
Posts: 21
CoolWave Offline
Ameglian cow
Offline
Ameglian cow
Joined: Mar 2004
Posts: 21
Hello yamaz,

mIRC replaces each single # caracter (not affixed to a word, so) by the channel name associated to the event.

For example, in a ON *:TEXT:#:, # returns $chan, the channel where the event was triggered (e.g. #Scripts)

In an 'manual' alias on a channel, or an alias called via your popups menu, # returns the value of $active, the channel name so. For example, if you put an /echo > # in your alias, you will see the replacement.

So, with that, you understand that your comparaison looks like..
IF (a caracter == a channel name)
For example, if you are on #Scripts: $left($active,1) = # et # = #Scripts, which finally look like :
IF (# == #Scripts)
.. and that, that can not work !


Two solutions so:

* The better way, i think, is to use if ($active ischan), no problem here, or simply if ($chan), which check if we are on a channel.

* I you want to use # like a caracter, you can use $chr(35) ou $(#,0) so that mIRC does not replace it by a channel or no-value. Like that, mIRC does not evaluate this caracter.

I hope that will help you.


-Be cool with my English-
irc.EpiKnet.org:#scripts
Re: What's wrong with this little script? #140276 24/01/06 07:59 PM
Joined: Oct 2003
Posts: 68
Y
yamaz Offline OP
Babel fish
OP Offline
Babel fish
Y
Joined: Oct 2003
Posts: 68
Quote:
Hello yamaz,

Two solutions so:

* The better way, i think, is to use if ($active ischan), no problem here, or simply if ($chan), which check if we are on a channel.

* I you want to use # like a caracter, you can use $chr(35) ou $(#,0) so that mIRC does not replace it by a channel or no-value. Like that, mIRC does not evaluate this caracter.

I hope that will help you.


The second solution is the quickest and the less painful smile I used it and it worked smile Merci beaucoup