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.

why wont it work?

Old posts that have not been replied to for several years.
Locked
d
dcboy

why wont it work?

Post by dcboy »

What its doing wrong
[00:09:49] <dcToAST> !aa poop
[00:09:51] <octain> Got $adword?3
That should be like: Got Poop?3
But its not its still keeping the $adword...

It also does it kinda slow...

Any help would be great...

this is my code:
## The Character to trigger the trigger
set adword(cmdchar) "!"

## The Trigger
set adtrig "aa"

## Catch the trigger being pulled in the chat room
bind pub - [string trim $adword(cmdchar)]$adtrig ad_socket

proc ad_socket {nick uhost hand chan text} {

set adword [split $text]

set admsgs {
{Got $adword?}
{Got $adword?3}
{Got $adword?4}
{Got $adword?6}
{Got $adword?7}
}

set outmsg [lindex $admsgs [rand [llength $admsgs]]]

putserv "privmsg $chan :$admsgs"

}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

First off, Tcl doesn't function as simple as this, hwoever, it's prety sinple to get around.

Second, from looking at your code, it would be impossible for it to function the way you think you would want it.

Look at the line that sends the output. You are sending the variable $admsgs and not the one you did a lookup on.

Your script is sending exactly what you have told it to. If, for example, it picked the one your pasted as an example, it would output this as is. You need to force a substitution in this case. The "subst" command will help you with this.

As for it being slow. Try correcting the above error, and it may help. However, speed can deped on many thigns. Lag between you and th server, lagg between the bot and the server, both in combination. On top, eggdrop uses a otuput queue system, so that it isn't flooded off, when large amounts of text or commands need sending. You simply have to wait for this to go down.
d
dcboy

Post by dcboy »

thanks ppslim after talking to ya on the chan ya got me sorted with the right way to do subst and its working wonderfull. Thanks
Locked