| View previous topic :: View next topic |
| Author |
Message |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Tue Mar 28, 2006 6:33 pm Post subject: Store colored text. |
|
|
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Tue Mar 28, 2006 7:26 pm Post subject: |
|
|
| 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 |
|
 |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Tue Mar 28, 2006 7:46 pm Post subject: |
|
|
Hello Sir_Fz
Tnx for your reply. I know that.
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 |
|
 |
Sir_Fz Revered One

Joined: 27 Apr 2003 Posts: 3793 Location: Lebanon
|
Posted: Wed Mar 29, 2006 6:04 am Post subject: |
|
|
| 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:
this should return a list of green text. _________________ Follow me on GitHub
- Opposing
Public Tcl scripts |
|
| Back to top |
|
 |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Thu Mar 30, 2006 5:42 am Post subject: |
|
|
Hello Sir_Fz
It's exactly what I was lookin' for. Works fine
Tnx alot.
~oxygen |
|
| Back to top |
|
 |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Thu Apr 20, 2006 12:57 pm Post subject: |
|
|
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 |
|
 |
oxygen Voice
Joined: 05 Sep 2005 Posts: 22 Location: Germany
|
Posted: Sun Apr 23, 2006 4:41 am Post subject: |
|
|
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 |
|
 |
|