This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Windrop problem with the command newchaninvite

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Windrop problem with the command newchaninvite

Post by juanamores »

complete script here by Johannes13 last post

Code: Select all

bind pub o|o +autoinvite pub:addinvite 
proc pub:addinvite {n u h c a} {
   if {![isinvite $a $c]} {
      newchaninvite $c $a invite 0 sticky
      putnotc $n "$a has been added to the autoinvite database"
   } {
      putnotc $n "$a is already in the autoinvite database"
   }
} 
When I add a new guest, the bot change channel modes depending on the letters of nick: S

Examples:

<owner> +autoinvite mary
<bot> mary has been added to the autoinvite database
<bot> bot puts mode +m


<owner> +autoinvite maria
<bot> maria has been added to the autoinvite database
<bot> bot puts mode +mi


<owner> +autoinvite CcmjhMgf
<bot> mary has been added to the autoinvite database
<bot> bot puts mode +CcmM


<owner> +autoinvite vbjp
<bot> vbjp has been added to the autoinvite database
<owner> +autoinvite jhgf
<bot> jhgf has been added to the autoinvite database

Conclusion:
If within nick characters are letters that correspond to channel modes, the bot puts these modes: S

I use windrop eggdrop v1.6.21, on CYGWIN_NT-5.1 1.7.15(0.260/5/3).

I do not understand the reasons for such behavior it has the bot.
Can someone help me at least unsettime who putting bot?

Sorry for my bad english :S

Edit:
I installed another clean version of Windrop - eggdrop v1.6.19+ctcpfix, on CYGWIN_NT-5.1 1.5.25(0.156/4/2)., to which only I added this TCL.

Code: Select all

bind pub o|o !addinvite invited

proc invited {n u h c t} {
      newchaninvite $c $t invite 0 sticky
puthelp "PRIVMSG $c :$t has been added to the autoinvite database"   
   }
The bot is still behaving the same way.
New Conclusion:
The problem is in the invoked command or Windrop, really do not understand and I am a newbie in TCL.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

On what IRC Network are you? Dose it support channel invites?
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

[SOLVED]

Post by juanamores »

caesar wrote:On what IRC Network are you? Dose it support channel invites?
I'm chathispano IRC network.
The mode "+I" for channels is not a valid mode for that network.
Anyway, the bot works well with the invite, invites all channels (although these channels do not have the "+I" mode.).
The problem is that the bot adds the previously mentioned modes in the channel where I execute the command (!addinvite) if in the nick's characters (letters) is one of the modes supported by the network for channels (CcikmMRstu).

I came up with an idea to remove these modes, but as I am newbie I not doing the work well with variables and timers.
The idea is that I had the channel modes are compared (before executing the command newchaninvite) and then executed the same, whith [getchanmode $chan].
The next step would be to compare the variables which channel modes were saved, and remove the mode that is different from the first list.

The issue is that I have to wait at least 5 seconds to check again [getchanmode $chan] for the list is refreshed with the new mode added by the bot (network lag).
Another problem that I have is that the variable $mode2 give error until is not yet set will by the timer.
I do not know, if the comparison of the variables is well in the 'While'.

Code: Select all

bind pub o|o !addinvite pub:addinvite

proc pub:addinvite {n u h c t} {
###### I store channel modes in the variable modes1 #####	 
	 set modes1 [getchanmode $c]
###### Show values on channel ######
	putmsg $chan "The channel current modes are: $modes1"
##### Add mask to nick ($t)#####
	set t "$t[join !*@*]"
##### Consults if the nick is on the invite list Channel ($t)#####	
   if {![isinvite $t $chan]} {
	  newchaninvite $chan $t invite 0 sticky
##### I add this timer for 5 seconds to allow time for the list to refresh (Has the correct syntax the next line, utimer command?)#####
	  utimer 5 [list set modes2 [getchanmode $chan]]
	  utimer 4 [list putmsg $chan "Now the channel current modes are: $modes2"]
##### HERE is where the problems begin, because the variable $modes2 is not yet set will by the timer 5 seconds!#####
#### No how to make the code stop here, until $modes2 variable is not set, and then continue to the next line when variable $modes2 be set. ####
	  set large [string length $modes2]
	  set x 0
	  while  {$x < $large} {
#####  Not know if the comparison of the variables $mode2 and $mode1 is is performed in this way. #####	
	      if {[string index $modes2 $x] != [string index $modes1 $x]} {
		    set modchange [string index $modes2 $x]
	       pushmode $chan "-[join $modchange]"
          unset modchange
         }
     incr $x
     }
	 putmsg $chan "$t has been added to the autoinvite database $c"
	 return 
   } else { 
 putmsg $chan "$t is already in the autoinvite database $c"
     }
}
Could help me fix this code?

Edit: Fixed, to see solution in this thread.
Post Reply