| View previous topic :: View next topic |
| Author |
Message |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Sun Oct 05, 2008 12:04 pm Post subject: !topic & !status commands |
|
|
I currently have an mirc bot, but i am trying to change everything over to eggdrop but i don't really understand the tcl scripting, i am learning though. On my mIRC bot i have a topic script, with two commands !topic and !status. !topic will change one part of the topic and !status changes the other. It looks like this:
| Code: |
on 1:TEXT:!topic *:#:{
if ( $nick !isop $chan) { msg $chan Command Ignored (Must be OP) }
else {
/set %topic $2- | /topic $chan Topic: %topic / SL0RD %status
}
}
on *:TEXT:!status *:#:{
if ( $nick !isop $chan) { msg $chan Command Ignored (Must be OP) }
else {
/set %status $2- | /topic $chan Topic: %topic / SL0RD %status
}
}
|
I was wondering if there is anyway to do this in eggdrop. I have searched for hours and haven't came up with anything close. Any help would be muchly appreciated. |
|
| Back to top |
|
 |
Furbs Voice
Joined: 01 Oct 2008 Posts: 7 Location: Adealide, South Australia, Australia
|
Posted: Mon Oct 06, 2008 2:31 am Post subject: Re: !topic & !status commands |
|
|
| SL0RD wrote: | I currently have an mirc bot, but i am trying to change everything over to eggdrop but i don't really understand the tcl scripting, i am learning though. On my mIRC bot i have a topic script, with two commands !topic and !status. !topic will change one part of the topic and !status changes the other. It looks like this:
| Code: |
on 1:TEXT:!topic *:#:{
if ( $nick !isop $chan) { msg $chan Command Ignored (Must be OP) }
else {
/set %topic $2- | /topic $chan Topic: %topic / SL0RD %status
}
}
on *:TEXT:!status *:#:{
if ( $nick !isop $chan) { msg $chan Command Ignored (Must be OP) }
else {
/set %status $2- | /topic $chan Topic: %topic / SL0RD %status
}
}
|
I was wondering if there is anyway to do this in eggdrop. I have searched for hours and haven't came up with anything close. Any help would be muchly appreciated. |
I'll get you startedish....
| Code: |
# Here are our on *:TEXT.... basically, we need bind which is equivilent to on. then we have the flags.. so if we want to restrict it to friends on the bot we would have f then we have what it triggers on.. so "!topic" then we have the alias name it will run. which is topic:proc
bind - "!topic" topic:proc
bind - "!status" status:proc
# Just set the two things to nothing atm.
set topic ""
set status ""
# Have our aliases.....
proc topic:proc { nick host hand chan text } {
global topic status
if {[$nick isop $chan]} {
set topic $text
putserv "TOPIC $chan :$text / SL0RD $status"
}
}
proc status:proc { nick host hand chan text } {
global status topic
if {[$nick isop $chan]} {
set status $text
putserv "TOPIC $chan :$topic / SL0RD $status"
}
}
|
UNTESTED
Not the best, but it should work |
|
| Back to top |
|
 |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Tue Oct 07, 2008 3:12 pm Post subject: |
|
|
Ok this is starting to make sense to me but I am getting an error could anyone help right it?
| Code: |
# Here are our on *:TEXT.... basically, we need bind which is equivilent to on. then we have the flags.. so if we want to restrict it to friends on the bot we would have f then we have what it triggers on.. so "!topic" then we have the alias name it will run. which is topic:proc
bind pub m|m "!topic" topic:cmd
bind pub m|m "!status" status:cmd
# Have our aliases.....
proc topic:cmd { nick host hand chan text } {
global topic status
if {[$nick isop $chan]} {
set topic $text
putserv "TOPIC $chan :$text / SL0RD $status"
}
}
proc status:cmd { nick host hand chan text } {
global status topic
if {[$nick isop $chan]} {
set status $text
putserv "TOPIC $chan :$topic / SL0RD $status"
}
}
|
Now when i do "!topic testing" for example in the channel i get this error in the terminal that i am running the bot it (my nick on irc is SL0RD)
| Code: |
Tcl error [topic:cmd]: invalid command name "SL0RD"
|
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Oct 07, 2008 3:24 pm Post subject: |
|
|
There is a slight flaw in both procs..
In tcl, the command always comes first followed by the parameter lines; hence the following line is incorrect:
| Code: | | if {[$nick isop $chan]} { |
The proper way of doing it is this way:
| Code: | | if {[isop $nick $chan]} { |
_________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Tue Oct 07, 2008 4:17 pm Post subject: |
|
|
| ok thanks a lot it works now W00T! |
|
| Back to top |
|
 |
SL0RD Voice
Joined: 05 Oct 2008 Posts: 19
|
Posted: Tue Oct 07, 2008 5:10 pm Post subject: |
|
|
| Ok now i have another question lol. Is there a way to make it so the commands only work on one channel? |
|
| Back to top |
|
 |
Dark_Aaron Voice
Joined: 16 Mar 2009 Posts: 10
|
Posted: Mon Mar 16, 2009 5:00 pm Post subject: |
|
|
| SL0RD wrote: | | Ok now i have another question lol. Is there a way to make it so the commands only work on one channel? |
| Code: |
proc status:proc { nick host hand chan text } {
global status topic
if {[$nick isop $chan]} {
if {[$chan == <yourchan>]} {
set status $text
putserv "TOPIC $chan :$topic / SL0RD $status"
}
}
|
UNTESTED
im guessing that how u do it idk
have i seen u b4 on WR |
|
| Back to top |
|
 |
|