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 

help wih colour
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Reynaldo
Halfop


Joined: 11 May 2005
Posts: 54

PostPosted: Fri Aug 12, 2005 3:24 am    Post subject: help wih colour Reply with quote

Code:
PRIVMSG $chan :\(4\002Hi..\002\)


how to set with random color? from 1-15 colour
Please help. Embarassed
Back to top
View user's profile Send private message
Dedan
Master


Joined: 09 Jul 2003
Posts: 260
Location: Memphis

PostPosted: Fri Aug 12, 2005 6:38 am    Post subject: Reply with quote

[rand 15] returns a random number between 0 and 14

Code:


  set colour [expr [rand 15] + 1]
  PRIVMSG $chan :\(\003$colour \002Hi..\002\003\)



i hope this helps
_________________
I once was an intelligent young man, now i am old and i can not remember who i was.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Aug 12, 2005 6:53 am    Post subject: Reply with quote

Code:
[rand 16]

returns a number in this range [0,15].
_________________
Follow me on GitHub

- Opposing

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


Joined: 16 Jun 2004
Posts: 771

PostPosted: Fri Aug 12, 2005 12:16 pm    Post subject: Reply with quote

0 being nothing is probably why he adds 1 Smile
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Aug 12, 2005 1:33 pm    Post subject: Reply with quote

Actually 0 is for white, so I thought he might wanna use it.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Fri Aug 12, 2005 6:15 pm    Post subject: Reply with quote

MeTroiD wrote:
0 being nothing is probably why he adds 1 Smile

There are actually 16 colours, not 15!
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Reynaldo
Halfop


Joined: 11 May 2005
Posts: 54

PostPosted: Sat Aug 13, 2005 2:43 am    Post subject: Reply with quote

it's working now..
thank you guys
Back to top
View user's profile Send private message
Reynaldo
Halfop


Joined: 11 May 2005
Posts: 54

PostPosted: Thu Mar 23, 2006 5:48 am    Post subject: Reply with quote

How to made each character from words be different the colour? Rolling Eyes
Back to top
View user's profile Send private message
Alchera
Revered One


Joined: 11 Aug 2003
Posts: 3344
Location: Ballarat Victoria, Australia

PostPosted: Thu Mar 23, 2006 9:39 am    Post subject: Reply with quote

Reynaldo wrote:
How to made each character from words be different the colour? Rolling Eyes

All is revealed in Colour and formatting codes.
_________________
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Back to top
View user's profile Send private message Visit poster's website
Reynaldo
Halfop


Joined: 11 May 2005
Posts: 54

PostPosted: Thu Mar 23, 2006 8:15 pm    Post subject: Reply with quote

i mean, each caracter will be automatically random the color.
says "botnick" , character "b" "o" "t" "n" "i" "c" & "k". will be random eachother & never same color. Rolling Eyes
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Mar 23, 2006 10:14 pm    Post subject: Reply with quote

Code:
proc randomcolors str {
 set str2 ""
 for {set i 0} {$i<[llength [split $str ""]]} {incr i} {
  set rdm [expr {[rand 15]+1}]
  if {[set token [string index $str $i]] != " "} {
   append str2 \003${rdm}$token\003
  } {
   append str2 $token
  }
 }
 set str2
}

Usage:
Quote:
set string [randomcolors $string]

_________________
Follow me on GitHub

- Opposing

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


Joined: 11 May 2005
Posts: 54

PostPosted: Sat Mar 25, 2006 5:49 am    Post subject: Reply with quote

i cant used it on "numbering" ?? Embarassed
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sat Mar 25, 2006 6:14 am    Post subject: Reply with quote

Code:
proc randomcolors str {
 set str2 ""
 for {set i 0} {$i<[llength [split $str ""]]} {incr i} {
  set rdm [expr {[rand 15]+1}]
  if {$rdm < 10} { set rdm 0$rdm }
  if {[set token [string index $str $i]] != " "} {
   append str2 \003${rdm}$token\003
  } {
   append str2 $token
  }
 }
 set str2
}

_________________
Follow me on GitHub

- Opposing

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


Joined: 11 May 2005
Posts: 54

PostPosted: Sat Mar 25, 2006 11:03 pm    Post subject: Reply with quote

Thank you verymuch bro Sir_fz
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Sun Mar 26, 2006 8:31 am    Post subject: Reply with quote

You can use this proc, which is much faster:
Code:
proc randomcolors str {
 set str2 ""
 foreach token [split $str ""] {
  set rdm [expr {[rand 15]+1}]
  if {$rdm < 10} { set rdm 0$rdm }
  if {$token != " "} {
   append str2 \003${rdm}$token\003
  } {
   append str2 $token
  }
 }
 set str2
}

_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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