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 

Reply to the command

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


Joined: 10 Feb 2013
Posts: 5

PostPosted: Sun Feb 10, 2013 5:22 am    Post subject: Reply to the command Reply with quote

OK so I have the following code, How can I make it reply to say !getaops #ChaNneL2 when its set as #channel2 in the script

And if its not set to #Channel3 and someone does !getaops #channel3 can it return a error?


Quote:
bind pub n !getaops get_aops
proc get_aops {nick uhost hand chan text} {
global botnick

set aop [lindex $text 0]
if {$aop == "#channel2"} {
putserv "privmsg $chan :omg the ops for this channel are name name2"
}
}
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Sun Feb 10, 2013 5:26 am    Post subject: Reply with quote

Ok so every use can use !getaops #channel2 (if any user uses this command but instead of #channel2 he add something else he will receive another message)

Removed the part where only admins can use this command

Code:

bind pub - !getaops get_aops

proc get_aops {nick uhost hand chan text} {


   set aop [lindex [split $text] 0]
   if {$aop == "#channel2"} {
      putserv "PRIVMSG$chan :omg the ops for this channel are name name2"
   } else {
      putserv "PRIVMSG $chan :valid command !getaops #channel2"
   }
}

_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
slowpoke23
Voice


Joined: 10 Feb 2013
Posts: 5

PostPosted: Sun Feb 10, 2013 5:31 am    Post subject: Reply with quote

Hi, Thanks.

I plan on having a few channels on this script like #chan1 #chan2 #lobby #help #network etc so I'm not sure how it'd be done that way?
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Sun Feb 10, 2013 5:37 am    Post subject: Reply with quote

Well if you want different messages for every !getaops i recommand this script http://forum.egghelp.org/viewtopic.php?t=19313
It allows you to create !getaops for every channel but with different reply messages
So you would do something like this

First activate the script on every channel you want it working
Quote:
!trigger activate


Then create teh !getaops command
Quote:
!trigger getaops Aops are: .. .. ..


And now any user could use in the channel command
Quote:
!getaops


I think its simple beside what you have. But if you prefer i can modify that script to work on more channel yet it will be harder for you to look at the code and modify the text later or add other channels
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
slowpoke23
Voice


Joined: 10 Feb 2013
Posts: 5

PostPosted: Sun Feb 10, 2013 5:42 am    Post subject: Reply with quote

Hmm that script could become handy but !getaops will only be available in one channel which will be a chanops channel.. so i don't think !trigger etc will be any help Sad

I appreciate your help!
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Sun Feb 10, 2013 5:53 am    Post subject: Reply with quote

Ok well the code should look like
So if you want something more please reply

Code:

bind PUB - !getaops getaops:pub

set temp(#channel1) "text text text"
set temp(#channel2) "some other text"

proc getaops:pub {nick uhost hand chan arg} {
   global temp

   set who [lindex [split $arg] 0]

   if {[string match "#*" $who] && [info exists temp($who)]} {
      putserv "PRIVMSG $chan :$temp($who)"
   } else {
      set list ""
      foreach a [array names temp] { lappend list $a }

      putserv "PRIVMSG $chan :Valid channels are: [join $list ", "]"
   }
}

_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
slowpoke23
Voice


Joined: 10 Feb 2013
Posts: 5

PostPosted: Sun Feb 10, 2013 6:02 am    Post subject: Reply with quote

Thank you!! That is what I'm after pretty much ! Smile

Just one minor problem if you don't mind helping just a little bit more..

[20:00:58] <%SUme> !getaops #ChaNnel2
[20:01:00] <&Botes> Valid channels are: #channel1, #channel2
[20:01:04] <%SUme> lulz


Is there any way it if someone did say #ChaNnel2 it will reply back with #channel2 info?
Back to top
View user's profile Send private message
Madalin
Master


Joined: 24 Jun 2005
Posts: 310
Location: Constanta, Romania

PostPosted: Sun Feb 10, 2013 6:05 am    Post subject: Reply with quote

Ok this should work.
Yet i tell you to keep

set temp(#channel-name) with lowercases then after on the channel users can use whatever they want like #ChaNNel-Name it would still work

Code:

bind PUB - !getaops getaops:pub

set temp(#channel1) "text text text"
set temp(#channel2) "some other text"

proc getaops:pub {nick uhost hand chan arg} {
   global temp

   set who [lindex [split $arg] 0]

   if {[string match "#*" $who] && [info exists temp([string tolower $who])]} {
      putserv "PRIVMSG $chan :$temp($who)"
   } else {
      set list ""
      foreach a [array names temp] { lappend list $a }

      putserv "PRIVMSG $chan :Valid channels are: [join $list ", "]"
   }
}


Test it and tell me if its working
_________________
https://github.com/MadaliNTCL - To chat with me: https://tawk.to/MadaliNTCL
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
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