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 

!topic & !status commands

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Sun Oct 05, 2008 12:04 pm    Post subject: !topic & !status commands Reply with quote

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
View user's profile Send private message
Furbs
Voice


Joined: 01 Oct 2008
Posts: 7
Location: Adealide, South Australia, Australia

PostPosted: Mon Oct 06, 2008 2:31 am    Post subject: Re: !topic & !status commands Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Tue Oct 07, 2008 3:12 pm    Post subject: Reply with quote

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
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Oct 07, 2008 3:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Tue Oct 07, 2008 4:17 pm    Post subject: Reply with quote

ok thanks a lot it works now W00T!
Back to top
View user's profile Send private message
SL0RD
Voice


Joined: 05 Oct 2008
Posts: 19

PostPosted: Tue Oct 07, 2008 5:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
Dark_Aaron
Voice


Joined: 16 Mar 2009
Posts: 10

PostPosted: Mon Mar 16, 2009 5:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests 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