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.

!topic & !status commands

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

!topic & !status commands

Post by SL0RD »

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: Select all

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.
F
Furbs
Voice
Posts: 7
Joined: Wed Oct 01, 2008 9:16 pm
Location: Adealide, South Australia, Australia
Contact:

Re: !topic & !status commands

Post by Furbs »

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: Select all

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: Select all

# 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
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

Post by SL0RD »

Ok this is starting to make sense to me but I am getting an error could anyone help right it?

Code: Select all

# 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: Select all

Tcl error [topic:cmd]: invalid command name "SL0RD"
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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: Select all

if {[$nick isop $chan]} {
The proper way of doing it is this way:

Code: Select all

if {[isop $nick $chan]} {
NML_375
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

Post by SL0RD »

ok thanks a lot it works now W00T!
S
SL0RD
Voice
Posts: 19
Joined: Sun Oct 05, 2008 11:44 am

Post by SL0RD »

Ok now i have another question lol. Is there a way to make it so the commands only work on one channel?
D
Dark_Aaron
Voice
Posts: 10
Joined: Mon Mar 16, 2009 4:55 pm

Post by Dark_Aaron »

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: Select all

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
Post Reply