mIRC Home    About    Download    Register    News    Help

Print Thread
put an event in aliases it's possible? #257388 03/04/16 09:56 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
It requires that at the time that the BoT ChanServ send me a private with the text "Permission denied!", continue the loop.
Quote:
/joinall {
echo -s Joining all channels.....
var %counter = 1
while (%counter <= $numtok(%recan,44)) {
if ( $comchan($me,%counter) == $gettok(%recan,%counter,44)) { .timer 1 $calc(%counter + 3) echo -s you already are in $comchan($me,%counter)
inc %counter
}
else {
.timer 1 $calc(%counter + 3) .msg chan invite $gettok(%recan,%counter,44)
inc %counter
on *:text:*Permission denied!*:?:{ continue }
}
}


Doing it the way I do not work.
Is there any other way?
Edit:
For the case could not solve, is there any way that the alias detects that message and ignore it, continuing the loop ?

Last edited by JuanAm; 03/04/16 10:21 PM. Reason: more data
Re: put an event in aliases it's possible? [Re: JuanAm] #257399 04/04/16 11:59 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
You can't use any event into an alias.

You can call the alias from the event:

Code:
ON *:TEXT:*:#: { call_alias $$1- }
alias -l call_alias { echo -a The message from the $event event into the $chan channel said from $nick nickname is $1- }

Re: put an event in aliases it's possible? [Re: westor] #257404 04/04/16 08:55 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: westor
You can't use any event into an alias.

You can call the alias from the event:

Code:
ON *:TEXT:*:#: { call_alias $$1- }
alias -l call_alias { echo -a The message from the $event event into the $chan channel said from $nick nickname is $1- }


Thus. How it is implemented in my aliases ?
At the event ( BoT private message CHAN " permission denied" ) occur should continue the loop ( while)
Quote:
on *:text:*Permission denied!*:?:.......

How would you do to coordinate the alias and the event in the right place to continue the loop ?
Please look at my code , to know where the event should work. Thank you

Re: put an event in aliases it's possible? [Re: JuanAm] #257413 05/04/16 12:47 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
I cannot really understand what you wanna do at this case, but you have to explain more about it, describe what you wanna do by steps and examples.

Re: put an event in aliases it's possible? [Re: westor] #257415 05/04/16 09:22 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Originally Posted By: westor
I cannot really understand what you wanna do at this case, but you have to explain more about it, describe what you wanna do by steps and examples.

Dear westor, I apologize for not having explained above code. blush
Purpose: Join the channels through my IRC client, after having connected a ZNC, sometimes disconnects from the 40 channels that I am and get all reentry.
Where I run the alias: status window

I 'll explain the code:
Code:
/joinall {
echo -s Joining all channels.....
var %counter = 1

*** Run the alias and put the counter variable to 1.****

Code:
while (%counter <= $numtok(%recan,44)) {

*** I make a loop, while the counter variable is less than or equal to the number of tokens that contains the variable recan, in this variable are stored all channels that joined in my last session of IRC.*****


Code:
if ($comchan($me,%counter) == $gettok(%recan,%counter,44)) { .timer 1 $calc(%counter + 3) echo -s you already are in $comchan($me,%counter)
inc %counter
}

***I compare if I'm on the channel "n " and if that channel is contained in the variable that stores the channels. If I am in any of the channels, it shows me the status window text "you already are in #channel" ....***


Code:
else {
.timer 1 $calc(%counter + 3) .msg chan invite $gettok(%recan,%counter,44)
inc %counter


***To the contrary case ( "else" ) invited me to channel that I am not.***

This is where fault code for a bug in the network.
The network understands through its BoT Chan I have no permits and code or stops or continues to invite me to other channels in which I'm already inside.
For that reason , I tried to solve the problem , pointing to the code if you find that error continue with the loop.
So I used the on *:text:*Permission denied!*:?:{ continue } event, now that can not be used there.

How can you fix that ?

I hope you were able to understand my idea, my English is not good. blush

Re: put an event in aliases it's possible? [Re: JuanAm] #257428 06/04/16 01:57 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
First of all, why you want to invite your self into the channel and not just use /join to join? btw i created this alias (using /JOIN, but you can change it with anything else you want), your English made me understand that you want an alias to join into all your %recan variable channels that is stored from yours previously connection, with this method (/JOIN) you will not need to care about permition denied message, if you still need the method to invite your nickname into a channel and pause the loop and continue it in the location that was stopped then its too mess to do this (if i can) and i also cannot test it to be sure, i hope this helps out:

Code:
alias joinall {
  if (!%recan) { echo -s There is is not any channel saved before! | return }
  if ($status !== connected) { echo -s Error: You must be connected into a server! | return }
  echo -s Joining all channels.....
  var %t = $numtok(%recan,44)
  var %i = 1
  while (%i <= %t) {
    var %c = $gettok(%recan,%i,44)
    if (!%c) { goto next }
    if ($me ison %c) { echo -s You already are into the %c channel! }
    elseif ($me !ison %c) { echo -s Trying to join into %c channel.. | join -n %c }
    :next
    inc %i
  }
  echo -s End of joining all channels!
}

Re: put an event in aliases it's possible? [Re: westor] #257429 06/04/16 05:45 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Dear westor, worked perfect for my purposes. smile
You can put a conditional in the case that the channel I try to enter are in invite mode (+ i) and in this case it myself to invite me?
Thanks a lot!

Re: put an event in aliases it's possible? [Re: JuanAm] #257430 06/04/16 05:49 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Just add this RAW in your script editor.

Code:
; $1 = your-nick
; $2 = the channnel
raw 473:*: { .msg ChanServ invite $2 }

Re: put an event in aliases it's possible? [Re: westor] #257432 06/04/16 05:54 PM
Joined: Nov 2014
Posts: 149
J
JuanAm Offline OP
Vogon poet
OP Offline
Vogon poet
J
Joined: Nov 2014
Posts: 149
Work perfect!!!!
Thank you! smile