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 

How do i fix my reply on word script ?

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


Joined: 25 Apr 2006
Posts: 18

PostPosted: Tue Apr 25, 2006 1:50 pm    Post subject: How do i fix my reply on word script ? Reply with quote

I got this simple reply script written out so if somone says brb my bot says $nick says Be Right Back


Code:
bind pub - brb pub_brb
proc pub_brb {nick uhost hand chan $brb_msg} {
putchan $chan "\002$nick\002 says Be Right Back"
}


My question is, how can i make the bot not reply to anything after the brb ?

Quote:
<FoX> brb
<testbot> FoX says Be Right Back
<FoX> brb im going out
<testbot> FoX says Be Right Back
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Tue Apr 25, 2006 2:03 pm    Post subject: Re: How do i fix my reply on word script ? Reply with quote

chaokusc wrote:

My question is, how can i make the bot not reply to anything after the brb ?

Quote:
<FoX> brb
<testbot> FoX says Be Right Back
<FoX> brb im going out
<testbot> FoX says Be Right Back


Try this:
Code:

bind pub - brb pub_brb
proc pub_brb {nick uhost hand chan args} {
  if {$args == ""} {
    putchan $chan "\002$nick\002 says Be Right Back"
  }
}
Back to top
View user's profile Send private message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Tue Apr 25, 2006 3:24 pm    Post subject: Reply with quote

It still does it DragnLord, is there any other way ?
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Apr 25, 2006 4:03 pm    Post subject: Reply with quote

You shouldn't use args, instead use arg.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Tue Apr 25, 2006 4:43 pm    Post subject: Reply with quote

oops, that's why I usually use the simpler variable form
Code:

bind pub - brb pub_brb
proc pub_brb {n u h c t} {
  if {$t == ""} {
    putchan $c "\002$n\002 says Be Right Back"
  }
}
Back to top
View user's profile Send private message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Wed Apr 26, 2006 11:59 am    Post subject: Reply with quote

^^ Thank You
Back to top
View user's profile Send private message
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Wed Apr 26, 2006 1:47 pm    Post subject: Reply with quote

Sorry for the double post but can anyone help me with the reply on this?
I just wish to know why $nick is not replaced with the nick of the person who typed superm4n

Code:
set superm4nreply {
"Its a Bird, Its a Plane, No Its \0024Superm4n\002"
"\0024Superm4n\002 i think \002$nick\002 wants you"
"\002$nick\002 do you know why \0024Superm4n\002 wears his underwear on the outside ?"
"\002$nick\002 do you know why \0024Superm4n\002 wears \002red\002 underwear ?"
}

bind pub - superm4n pub_superm4n
proc pub_superm4n {nick u h chan t} {
global superm4nreply
if {$t == ""} {
set output [lindex $superm4nreply [rand [llength $superm4nreply]]]
putchan $chan "$output"
  }
}


If your not interested in giving me the full help thats fine, clues are welcome Very Happy
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Wed Apr 26, 2006 2:31 pm    Post subject: Reply with quote

1) use putlog to show variables in dcc as the script runs
Code:

proc pub_superm4n {nick u h chan t} {
putlog "got $nick in $chan"
global superm4nreply
if {$t == ""} {
set output [lindex $superm4nreply [rand [llength $superm4nreply]]]
putlog "output: $output"
putchan $chan "$output"
  }
}

(btw, for this to work as written "superm4n" has to be the only word said)

2) search a lot more about rand and expr
Back to top
View user's profile Send private message
De Kus
Revered One


Joined: 15 Dec 2002
Posts: 1361
Location: Germany

PostPosted: Fri Apr 28, 2006 3:46 am    Post subject: Reply with quote

he will have to double evaluate it, like:

eval "putchan $chan \"$output\""
or
eval "puthelp \"PRIVMSG $chan :$output\""
_________________
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Back to top
View user's profile Send private message MSN Messenger
chaokusc
Voice


Joined: 25 Apr 2006
Posts: 18

PostPosted: Fri Apr 28, 2006 2:31 pm    Post subject: Reply with quote

I managed to fix it with this code

Code:
# Superm4n
set bigmanreply {
"Its a Bird, Its a Plane, No Its \0024Superm4n\002"
"\0024Superm4n\002 i think \002$nick\002 wants your attention"
"\002$nick\002 do you know why \0024Superm4n\002 wears his underwear on the outside ?"
"\002$nick\002 do you know why \0024Superm4n\002 wears red underwear ?"
}
bind pub - superm4n pub_bigman
proc pub_bigman {nick u h chan t} {
global bigmanreply
if {$t == ""} {
set output [lindex $bigmanreply [rand [llength $bigmanreply]]]
regsub -all {\$nick} $output $nick output
putchan $chan "$output"
  }
}


This also let me allow $nick in bigmanreply

Thanks for all of your reply, and DragnLord i will look into rand and expr
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