|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Another question, and this one should be easy. Just doesn't seem to get it working
on *:JOIN:%priv-chan:{
if ($nick == $me) && (botname ison $chan) && (*!*@botname.hostmask.org iswm $address($nick,2)) {
.msg botname login nickname password
}
}
%priv-chan is a variable that holds certain channelnames (like home channels). What I'm trying to do: - When I join a 'home channel' (%priv-chan) - Check if botname is there - Check if the address matches - Login with bot Also, it should try to login only once, the bot will be on many 'home-channels' so I don't want it logging in like 8 times. Can anyone help with a good script for this? Thx
|
|
|
|
Joined: Apr 2006
Posts: 400
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 400 |
I'm not understanding why you did what you did on this part
if ($nick == $me) && (botname ison $chan) && (*!*@botname.hostmask.org iswm $address($nick,2)) {
if $nick equals you, then, how would you use && with $address($nick,2)? /me may not be sounding clear, but, i think u understand :P
Last edited by Kurdish_Assass1n; 18/06/06 01:38 AM.
-Kurdish_Assass1n
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Erm, yes you're right there indead. Took parts of this code, from other scripts I have Now its modified it to: if ($nick == $me) && (botname ison $chan) && (*!*@botname.hostmask.org iswm $address(botname,2)) { Still doesn't perform the login though
Last edited by OrionsBelt; 18/06/06 01:44 AM.
|
|
|
|
Joined: Apr 2006
Posts: 400
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 400 |
on *:JOIN:#: {
if ($wildtok(%priv-chan, $chan, 0, 32) > 0) {
if ($nick == $me) && (botname ison $chan) && (*!*@botname.hostmask.org iswm $address(botname,2)) {
.msg botname login nickname password
}
}
}
-untested, should work though
-Kurdish_Assass1n
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
I modified the 32 to 44: if ($wildtok(%priv-chan, $chan, 0, 44) > 0) { Since I used the comma as a seperator in that variable, but still no luck. When I echo that wildtok part, it does return a 1 so the code should execute.
|
|
|
|
Joined: Apr 2006
Posts: 400
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 400 |
hmm, idk why it isn't working, but, can't you use this:
on *:JOIN:#chan1,#chan2,#chan3,#etc.: {
-Kurdish_Assass1n
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Even then it doesn't work. I also tried using just #channelname in the on JOIN event, but then also not. I think the problem is in this line: if ($nick == $me) && (botname ison $chan) && (*!*@botname.hostmask.org iswm $address(botname,2)) { Or perhaps it needs timer or summin
Last edited by OrionsBelt; 18/06/06 02:48 AM.
|
|
|
|
Joined: Apr 2006
Posts: 400
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 400 |
if using on *:JOIN:#chan1,#chan2,#etc: { doesn't work, then, the problem is on that line, you might want to try and put it in a new file, if it already isn't, and, are you sure that you got the address right? try to do this, and copy/paste it in remotes: //echo -a $address(botname,2) and another thing, It doesn't need a timer, I'm pretty sure about that
-Kurdish_Assass1n
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
At the moment, this is the code I have:
on *:JOIN:#:{
if ($wildtok(%priv-chan, $chan, 0, 44) > 0) {
if ($nick == $me) && (botname ison $chan) && (*!*@botname.hostmask.org iswm $address(botname,2)) {
.msg botname login username password
}
if ($nick == botname) && (*!*@botname.hostmask.org iswm $address($nick,2)) {
.msg botname login username password
}
}
}
When I experiment with the code using //echo -a - I can return the (botname ison $chan) so it should be correct - I can return the ($address) part, it matches, should be correct - I can return the ($wildtok) part, it returns 1 when it is a %priv-chan and 0 when it's not. In the remote file that I have it, there is no other on JOIN event. When I replace the code to a new remote file, it doesn't work also. When I use on *:JOIN:#channelname:{ it also doesn't work. The second if (when the bot joins a channel), it does work. So, the on JOIN is correct, the $wildtok is correct and the $address is correct. No idea, what the problem is here tbh.
Last edited by OrionsBelt; 18/06/06 10:03 AM.
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Ok, well I found the problem, still don't know how to solve it though.
When I join the channel: if (botname ison $chan) { actually returns false (=bot is NOT on the channel).
When I wait in the channel, and perform the same command again (by using echo), it returns true.
I think the command is executed, before I actually joined the channel. Also adding a timer, returns the same. I think the timer is eveluated immediately, but only executed after the delay. So that also doesn't help.
Anyone with idea's??
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
when working with timers and identifiers you can escape the identifier with a !
testing this: //.echo $time | .timertime-a 1 2 echo -a $time you will see that $time is evaluated at the time the timer is SET
//.echo $time | .timertime-a 1 2 echo -a $!time you will see on this one the identifier is not evaluated untill the timer expires.
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Hmm, yh I see the difference, although the result in my case doesn't change. It still tells me the bot is not on the channel. While it definately is.
I tried (on join, if $nick == $me): timerauth 1 5 $iif(botnick ison $!chan, echo 9 -a Bot IS on $chan, echo 4 -a Bot is NOT on $chan) Result: Bot is NOT on $chan
Tried also: timerauth 1 5 $!iif(botnick ison $chan, echo 9 -a Bot IS on $chan, echo 4 -a Bot is NOT on $chan) Result: * Invalid format: $iif
And with the default: timerauth 1 5 $iif(botnick ison $chan, echo 9 -a Bot IS on $chan, echo 4 -a Bot is NOT on $chan) Result: Bot is NOT on $chan
But, when I'm in the channel: //timerauth 1 5 $iif(botnick ison $chan, echo 9 -a Bot IS on $chan, echo 4 -a Bot is NOT on $chan) Result: Bot IS on $chan
Any idea's?
|
|
|
|
Joined: Dec 2002
Posts: 1,245
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 1,245 |
use an alias for the $iif with the timer in the on join
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Unbelieveble, didn't expect to get it working anymore. Thx a lot for that MikeChat. Ok, so now I have this
on *:JOIN:#:{
if ($wildtok(%priv-chan, $chan, 0, 44) > 0) {
if ($nick == $me) {
set %temp.chan $chan
.timerauth 1 2 auth-with-bot
}
if ($nick == Botname) && (*!*@Botname.hostmask.org iswm $address($nick,2)) {
.msg Botname login username password
}
}
}
alias auth-with-bot {
if (Botname ison %temp.chan) && (*!*@Botname.hostmask.org iswm $address(Botname,2)) {
.msg Botname login username password
unset %temp.chan
}
}
This code works like a charm, so no problems there. But, I have one more problem. %priv-chan actually contains 7 channels. I do want this script to work with all of these, but not when I connect/start mIRC. At the moment, when I start I get 7 notices (I join them automaticly). The first one tells me I'm authenticated, the other 6 tell me I'm already authenticated :tongue: Do you know a way to execute this script only once when I'm connecting. Perhaps with a timer of like 3 minutes, so I can peacefully connect to all %priv-chans without being spammed And if you guys have any other idea's to make this script more failsafe etc, or improvements, please help me out. It's mucho appreciato
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
OP
Fjord artisan
Joined: Apr 2006
Posts: 464 |
|
|
|
|
|