|
Joined: Dec 2004
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2004
Posts: 6 |
Im making a bot and i want it to be a colour on each message......random colour (besides yellow)
How do i do it??
Ps: If u dont know how to get random colours BESIDES yellow just gimme the command for any colour.. i can deal with that and change it
|
|
|
|
Joined: Mar 2004
Posts: 526
Fjord artisan
|
Fjord artisan
Joined: Mar 2004
Posts: 526 |
you could use $rand:
$rand(v1,v2) This works in two ways. If you supply it with numbers for v1 and v2, it returns a random number between v1 and v2. If you supply it with letters, it returns a random letter between letters v1 and v2.
and then test the value returend and if it is '8' then call $rand again..
ie: set %color1 $rand(1,15) (valid values are 0 to 15 but you do not want to use 0)
Hope this helps.
Help others! It makes the world a better place, Makes you feel good, and makes you Healthy!
|
|
|
|
Joined: Dec 2004
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2004
Posts: 6 |
hmm i havent used $ rand before... Try telling me the command.. cause ive seen pplz do it but..... "Greedy" pplz dont wanna share :tongue: 
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
set %color1 $calc((($rand(1,14) + 7 ) % 15) + 1)
random color from 1,2,3,4,5,6,7,9,10,11,12,13,14,15
|
|
|
|
Joined: Dec 2004
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2004
Posts: 6 |
hmmm... what u told me there isnt workin.... or am i doin sumthing wrong..
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Do you mean when a message is incoming (On Text) or outgoing (On Input)?
|
|
|
|
Joined: Dec 2004
Posts: 6
Nutrimatic drinks dispenser
|
OP
Nutrimatic drinks dispenser
Joined: Dec 2004
Posts: 6 |
On input....
Wheneever i type a message i want it to be in a dif. colour ...not for me but for everyone
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
on 1:Input:*: {
if ($left($1-,1) == $readini(mirc.ini, text, commandchar)) { return $1- }
else {
set %color1 $calc((($rand(1,14) + 7 ) % 15) + 1)
msg $active $chr(3) $+ %color1 $+ $1- $+ $chr(3)
}
halt
}
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
/ is always a command char, but your if statement will only check if the text doesn't start with the second command char, so, for example, it would send commands if they were prefixed with / but ~ was your second command char. This fixes that: on *:input:*:{
if (!$istok(/ $readini($mircini,text,commandchar),$left($1,1),32)) {
msg $active $+($chr(3),$base($rand(0,15),10,10,2),$1-)
halt
}
}
New username: hixxy
|
|
|
|
Joined: Feb 2004
Posts: 2,019
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,019 |
Don't forget that there could be unrequired results when the string $1- would start with a number, thus possibly corrupting the color code.
Anyway, you already know this, but I'd add a double bold char, or $base($r(0,15),10,10,2) to that expression, just in case.
Greets!
Gone.
|
|
|
|
Joined: Dec 2004
Posts: 8
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Dec 2004
Posts: 8 |
Found a couple errors in my code and need to fix em @_@ How do i delete posts?
Last edited by KaiHeilos; 22/12/04 04:47 PM.
|
|
|
|
Joined: Nov 2003
Posts: 2,327
Hoopy frood
|
Hoopy frood
Joined: Nov 2003
Posts: 2,327 |
Good point 
New username: hixxy
|
|
|
|
|