| View previous topic :: View next topic |
| Author |
Message |
KhashayaR Voice

Joined: 19 Jul 2007 Posts: 22 Location: World
|
Posted: Fri Nov 27, 2020 6:43 am Post subject: $ch r(3) $+ $r(1,7) |
|
|
hello is it possible to have translate $ch r(3) $+ $r(1,7) to TCL language? this will give a random color to output text Thanks in advance _________________ ===
IRC Network: DALnet
Nick: KhashayaR
=== |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri Nov 27, 2020 8:11 am Post subject: |
|
|
Simplest way:
| Code: | set col [format "%.02d" [expr {1 + round(rand()*6}]]
set ch "\003${col}" |
Note that IRC colors goes from 0 (white= to 15). If you want to use all of them but the white, change the "6" to 14. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Fri Nov 27, 2020 11:34 am Post subject: |
|
|
this seems to work for me but i was wondering if only certain random colors could be used for foreground and background
| Code: |
bind pub n|n .rcols random:cols
proc random:cols {nick host hand chan text} {
putquick "privmsg $chan \00300,[expr {int(6*rand() + 1)}] $text \017"
}
|
if possible i was curious how to use the following config:
for foreground i would like to use:
for background i would like to use:
| Quote: | | 01 02 03 04 05 06 07 10 12 14 |
this is the msl version:
| Quote: | | $+($chr(3),$base($gettok(00 08 09 11 15,$r(1,5),32),10,10,2),$chr(44),$base($gettok(1 2 3 5 6 7 10 12 14,$r(1,9),32),10,10,2)) |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri Nov 27, 2020 1:28 pm Post subject: |
|
|
Create a list of bg colors and a list of fg colors and select random in each.
| Code: | set fg {00 08 09 11 15}
set bg {01 02 03 04 05 06 07 10 12 14}
proc colors {} {
set mfg [lindex $::fg [rand [llength $::fg]]]
set mbg [lindex $::bg [rand [llength $::bg]]]
return "\003${mfg},${mbg}"
} |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Fri Nov 27, 2020 2:17 pm Post subject: |
|
|
| excellent crazycat that worked i was wondering if this could be called by other tcl scripts for example for kick messages |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Fri Nov 27, 2020 4:09 pm Post subject: |
|
|
| was fiddling with it some more seems to be working fine thanx crazycat |
|
| Back to top |
|
 |
KhashayaR Voice

Joined: 19 Jul 2007 Posts: 22 Location: World
|
Posted: Sun Nov 29, 2020 10:32 am Post subject: |
|
|
Thanks alot guys  _________________ ===
IRC Network: DALnet
Nick: KhashayaR
=== |
|
| Back to top |
|
 |
|