egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Chattr MSG Command - not working properly

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
vigilant
Halfop


Joined: 05 Jan 2006
Posts: 48

PostPosted: Thu May 21, 2015 5:41 pm    Post subject: Chattr MSG Command - not working properly Reply with quote

Okay so I have modified my script a bit with the help of Mr Spike^^.
Quote:

[10:32:15 pm] -> *leet* chattr who
[10:32:17 pm] -leet- No channel
[10:32:19 pm] -leet- Ljubljana.SI.EU.irchaven.org 401 leet who :No such nick
[10:32:21 pm] -leet- Ljubljana.SI.EU.irchaven.org 318 leet who :End of /WHOIS list.
[10:32:23 pm] -leet- User is offline
[10:32:25 pm] -leet- Changed nonglobal flags for who from * to * in
[10:37:55 pm] -> *leet* chattr
[10:37:57 pm] -leet- No nickname
[10:38:00 pm] -> *leet* chattr vigilant
[10:38:07 pm] -> *leet* chattr vigilant #woot
[10:38:11 pm] -leet- Ljubljana.SI.EU.irchaven.org 318 leet leet :End of /WHOIS list.
[10:38:13 pm] -leet- Changed nonglobal flags for vigilant from fjlmnoptx to * in
[10:38:15 pm] -leet- No flags
[10:38:17 pm] -leet- Ljubljana.SI.EU.irchaven.org 318 leet vigilant :End of /WHOIS list.
[10:38:19 pm] -leet- Changed nonglobal flags for vigilant from fjlmnoptx|almno to fjlmnoptx|almno in #woot
[10:38:27 pm] -> *leet* chattr vigilant #woot +f
[10:38:29 pm] -leet- Ljubljana.SI.EU.irchaven.org 318 leet vigilant :End of /WHOIS list.
[10:38:31 pm] -leet- Changed nonglobal flags for vigilant from fjlmnoptx|almno to fjlmnoptx|aflmno in #woot

There are some errors still
As seen above
It changes the flags for people who are offline as well
It lists flags for people when there are no flags specified
It does not say, you did not enter a channel, after typing /msg botnick chattr vigilant

Code:
bind msg - chattr chattrFirstProc

proc chattrFirstProc { n u h t } {
   # using [lindex $t 0] for non global
   set nick [lindex $t 0]
   set channel [lindex $t 1]
   set flags [lindex $t 2]

# some global variables
   set ::chattrUser $n
   set ::chattrWho [lindex $t 0]
   set ::chattrNonGlobalChannel [lindex $t 1]
   set ::chattrOldFlags [chattr [nick2hand [lindex $t 0]] $channel]
   set ::chattrNewFlags [chattr [nick2hand [lindex $t 0]] -|[lindex $t 2] $channel]


   bind raw - 318 chattrSecondProc
   bind raw - 401 chattrSecondProc
   unset -nocomplain ::chattrOffline
   putquick "WHOIS $nick"

# put input verification in the first proc
   
   if {[lindex $t 0] == "-global" && [lindex $t 1] == ""} {
      putnotc $n "No nickname when -global is provided"
      return 1
   }
   
   if {[lindex $t 0] == "-global" && [lindex $t 2] == ""} {
      putnotc $n "No flags provided"
      return 1
   }
   
   if { $nick == "" } {
      putnotc $n "No nickname"
      return 1
   }
   
   if { $channel == "" } {
      putnotc $n "No channel"
      return 1
   }
   
   if { $flags == "" } {
      putnotc $n "No flags"
      return 1
   }   
}

proc chattrSecondProc { from key text } {
#  receiving a 401 reply will probably require setting another global variable so when we get the 318, we know how to reply as online or offline
   putnotc $::chattrUser "$from $key $text"
   if {$key == "401"} {
      set ::chattrOffline "1"
      return
   }
   unbind raw - "318" chattrSecondProc
   unbind raw - "401" chattrSecondProc
   if [info exists ::chattrOffline] {
      putnotc $::chattrUser "User is offline"
   }
# [07:40:13 pm] <SpiKe^^> then we add the user and/or flags to the user, or what ever we want to do if the user is online as we just proved or disproved   
   putnotc $::chattrUser "Changed nonglobal flags for $::chattrWho from $::chattrOldFlags to $::chattrNewFlags in $::chattrNonGlobalChannel"
   unset -nocomplain ::chattrOffline
}


This is an unfinished script.
It should do more input verification.
I hope you all can help with that.
_________________
Anser Quraishi
Website: http://www.anserq.com
Back to top
View user's profile Send private message
vigilant
Halfop


Joined: 05 Jan 2006
Posts: 48

PostPosted: Fri May 22, 2015 1:47 pm    Post subject: Reply with quote

Hello all,

I have recoded the command, and it works now. I am using the onchan command. It works fine.
If you want to still reply to the above code, and tell me how to make it work that's good, otherwise it's okay.

Thanks to spike^^ for his help
_________________
Anser Quraishi
Website: http://www.anserq.com
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber