mIRC Home    About    Download    Register    News    Help

Print Thread
#105913 22/12/04 05:26 AM
Joined: Dec 2004
Posts: 6
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
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

#105914 22/12/04 05:31 AM
Joined: Mar 2004
Posts: 526
Fjord artisan
Offline
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!
#105915 22/12/04 05:41 AM
Joined: Dec 2004
Posts: 6
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
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: laugh

#105916 22/12/04 08:00 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
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

#105917 22/12/04 03:30 PM
Joined: Dec 2004
Posts: 6
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
Joined: Dec 2004
Posts: 6
hmmm... what u told me there isnt workin.... or am i doin sumthing wrong..

#105918 22/12/04 03:42 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Do you mean when a message is incoming (On Text) or outgoing (On Input)?

#105919 22/12/04 03:47 PM
Joined: Dec 2004
Posts: 6
L
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
L
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

#105920 22/12/04 03:57 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
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
}

#105921 22/12/04 04:03 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
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:

Code:
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
#105922 22/12/04 04:17 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
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.
#105923 22/12/04 04:18 PM
Joined: Dec 2004
Posts: 8
K
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
K
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.
#105924 22/12/04 04:29 PM
Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Good point smile


New username: hixxy

Link Copied to Clipboard