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.

getting rid of letters in a ! trigger

Old posts that have not been replied to for several years.
Locked
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

getting rid of letters in a ! trigger

Post by NewzUK »

hi

I use a stockquote script for my trading channel, where one of the commands is !q <symbol> to get a quote. I've already cut the command down from !quote to !q, but I'm wondering if it's possible to have it so the user will just go !<symbol> (eg !msft). I've tried this myself by dropping the q, but you still have to put a space after the ! for it to work...any ideas?

here's the line from the script:

bind pub - !q pub:quote

Thanks!
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

bind pubm - "* !*" pub:quote

this will match against all lines said in any channel starting with ! , replace the first * with #chan if you want to enable it in just one channel
Elen sila lúmenn' omentielvo
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

hi - tried putting that line in but it made the bot quit with error 'wrong arguments' etc

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

Post by ppslim »

I can't see any reason why the bot would quit, or make an error for that matter.

It's likely that this is not all that is needed.

However, through the majic that is Tcl, locate the line that starts "proc pub:quote" and make the next line

Code: Select all

set [lindex [info args pub:quote] 4] [string trimleft [subst $[lindex [info args pub:quote] 4]] !]
When using the PUB type bind, the first word is the command, while the rest of the line are the arguments.

With the PUBM bind, the whole line becomes the arguments.

The code above, should in theory strip the ! from the begining of the line, and make the script operate as you intend it to.

On top, even if you go back to using the !q method, the above code will not affect it's use.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

hi again

wonderful - it's working great now!

thank you very much for the help - much appreciated!

:)

Damon.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

sorry one more thing...

it seems now to be responding to lines have ! in other places...

[16:49:50] <NewzBoy> testing!
[16:49:51] <News24> TESTING! No such stock symbol found

is it possible to make it only respond to lines that start with ! only like:

[16:52:25] <NewzBoy> !yhoo
[16:52:27] <News24> YHOO 18.80 -.350000381 (-1.83%) Last Trade: 7:56pm (USET) Low-High: 18.56 - 19.30 Volume: 9674491
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The bind line quoted above is iucorrect, and causes too wider match.

change the bind too

Code: Select all

bind pubm - "% !*" pub:quote
You will need to issue a ".restart" after doign this.
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

fantastic - working properly now!

thank you again - it's a great improvement for the channel!

:D
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

one more thing (again!) sorry...

is there a way to make the script ignore certain ! commands, as I have another script that uses a one word ! command, and it's triggering off the stock quote script ...

sorry this just came about now that the other problem is fixed!
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

just add a if match in your proc.. returning 0 if it matches the other command
Elen sila lúmenn' omentielvo
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

so would something like this be right if the word I want to ignore is: fut


if {[string $arg]==fut} {
return 0
}
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

NewzBoy, could you post the script in here ?
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

this is the piece of script - basically I want to add a return line that will ignore specific words if typed in the channel in the format of !word - as I have another script that is clashing with this one...

bind pubm - "% !*" pub:quote

proc pub:quote { nick uhost handle channel arg } {
set [lindex [info args pub:quote] 4] [string trimleft [subst $[lindex [info args pub:quote] 4]] !]
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Plase this at the very top of the file, let alone the script.

Code: Select all

lappend IGwords this
lappend IGwords that
Create a new line, for each word you want to ignore, changing the obvious ("this" and "that") with your ignored words.

After this, place the following line, as the next line in the script

Code: Select all

foreach _IG [uplevel #0 {set IGwords}] { if {[string equal -nocase $_IG [lindex [split $arg] 0]]} { return } }
N
NewzUK
Master
Posts: 200
Joined: Mon Nov 18, 2002 3:10 am
Location: Auckland, New Zealand
Contact:

Post by NewzUK »

awesome - that works great!

thanks very much guys for you help!
:D :D
Locked