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.

[help] $strip in tcl [Solved]

Help for those learning Tcl or writing their own scripts.
Post Reply
w
w00f
Halfop
Posts: 49
Joined: Wed Oct 04, 2006 6:50 pm

[help] $strip in tcl [Solved]

Post by w00f »

hi there again.

I've started a script , but i'm still a complete n00b in tcl scripting and i don't know how to get one one word from one linked phrase.

script usage:
!add <game-Version> <url> <type>

(someone) !add game-V69 <URL> <Type>
(someone) !find game-V69
(bot) [<Type>] Current version of game is V69 , you can find it at <URL>.

i just need to know how i can "extract" the <version>. cuz all the remaining is done.

The <version> identifier can be one of diverse types of identificators like V1 , GOD , whatever, but it is always in the end , separated for one "-" from the game.name


EDIT: Already Solved the problem using split and lrange, easy :x .

-> I guess i can use this topic for one other problem , tcl has any kind of command to do the same as $strip(mIRC scripting) ?
i need that coz i'm using

bind pub - !find

and if !find is in bold , underlined or colored the bot doesn't do the search.
someone can help me with that ?


tnks in advance.


EDIT: Solved m8's , tks.
Last edited by w00f on Mon Nov 06, 2006 8:58 am, edited 2 times in total.
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

From the eggdrop tcl-commands.doc:

stripcodes <strip-flags> <string>
Description: strips specified control characters from the string given.
strip-flags can be any combination of the following:
b - remove all boldface codes
c - remove all color codes
r - remove all reverse video codes
u - remove all underline codes
a - remove all ANSI codes
g - remove all ctrl-g (bell) codes
Returns: the stripped string.
Module: core
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

You should read his post first rosc2112.

Ontopic:

You would need to bind * to pubm and strip the codes out.

example:

Code: Select all

bind pubm -|- * find:proc

proc find:proc {nick host hand chan arg} {
  set arg [stripcodes bcru $arg]

  if {[string equal -nocase "!find" [lindex [split $arg] 0]]} {
    myfindproc $nick $host $hand $chan [lrange [split $arg] 1 end]
  }
}
User avatar
rosc2112
Revered One
Posts: 1454
Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania

Post by rosc2112 »

I did read it, that's why I showed the poster the equivalent command for stripping codes.. But, if criticising me elicits a better answer, that's fine by me :P
Post Reply