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 

Store colored text.

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


Joined: 05 Sep 2005
Posts: 22
Location: Germany

PostPosted: Tue Mar 28, 2006 6:33 pm    Post subject: Store colored text. Reply with quote

Hi,

hope somebody can help...

I want to store a colored text in a variable. And only the words in this specific color. I don't even know if it's possible...
Example:
This text is only an example for what I need.
Code:

set $greentext "is only an example"


Tnx in advance,
oxygen
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Tue Mar 28, 2006 7:26 pm    Post subject: Reply with quote

Code:
set greentext "\00303green text here\003"

\003 stands for mIRC's ctrl+k code.
_________________
Follow me on GitHub

- Opposing

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


Joined: 05 Sep 2005
Posts: 22
Location: Germany

PostPosted: Tue Mar 28, 2006 7:46 pm    Post subject: Reply with quote

Hello Sir_Fz

Tnx for your reply. I know that. Wink
Wat I'm searching for is to grab the colored words from a text. Not the entire sentence, only the green colored words. Since english is not my native language, it's a little difficult to explain. Sorry..

~oxygen
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Wed Mar 29, 2006 6:04 am    Post subject: Reply with quote

Code:
proc grapgreen str {
 set greentext {}
 foreach token [lrange [split $str \003] 1 end] {
  if {[regsub {^(0?)3(,[0-9]{1,2})?} $token "" token]} {
   lappend greentext $token
  }
 }
 set greentext
}

Usage:
Code:
grapgreen <text>

this should return a list of green text.
_________________
Follow me on GitHub

- Opposing

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


Joined: 05 Sep 2005
Posts: 22
Location: Germany

PostPosted: Thu Mar 30, 2006 5:42 am    Post subject: Reply with quote

Hello Sir_Fz

It's exactly what I was lookin' for. Works fine Smile

Tnx alot.

~oxygen
Back to top
View user's profile Send private message
oxygen
Voice


Joined: 05 Sep 2005
Posts: 22
Location: Germany

PostPosted: Thu Apr 20, 2006 12:57 pm    Post subject: Reply with quote

Hello,

I have a problem with the stored text. I store the greentext with:
Code:

        set fd [open $log_greentext a+]
        puts $fd "$greentext"
        close $fd


In the stored file, the text is filled with ? between the words.
Example: "This is?an?example of the?green?text."
With "putlog" in the bots partyline I can't see any ?. Can anybody help pls.

Tnx,
~oxygen
Back to top
View user's profile Send private message
oxygen
Voice


Joined: 05 Sep 2005
Posts: 22
Location: Germany

PostPosted: Sun Apr 23, 2006 4:41 am    Post subject: Reply with quote

Hello

Seems that this behavior is only under windrop. I uploaded my script on my eggdrop, and there is all ok.


Tnx,
~oxygen
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