|
DuXxXieJ
|
DuXxXieJ
|
Hi, I'm looking for a script which replaces your words with an color. Example:
<Name> hi there how are you, I am fine!
So, it needs 3 colors, which it will repeat. (No random, just color1 color2 color3 color1 color2 color3).
If can, it doesn't need to work when I type something with / or ! etc.etc. (Just like always with the "first letter color"-talkers)
|
|
|
|
Joined: Nov 2006
Posts: 1,552
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,552 |
Give this a try: ; --- color-per-word talker ---
on *:input:*:{
if ($readini($mircini,text,commandchar) $+ * !iswm $1) && (!$ctrlenter) && ($istok(channel.query.chat,$window($active).type,46)) {
; --- put the numbers of the colors to loop here (zeropad all single-digit color numbers) ---
var %cols = 04 12 08
var %num = $numtok(%cols,32)
msg $active $$regsubex($strip($1-),/(\S+)/g,$+($chr(3),$gettok(%cols,$iif(($calc(\n % %num) == 0),%num,$v1),32),\t))
haltdef
}
} Edit: fixed it to work for more than 9 colors-to-loop; put haltdef for halt
Last edited by Horstl; 11/08/09 04:10 PM.
|
|
|
|
never_lose
|
never_lose
|
Do you know how to make it so that it also counts how many spaces you put? For the current script:
; --- color-per-word talker ---
on *:input:*:{
if ($readini($mircini,text,commandchar) $+ * !iswm $1) && (!$ctrlenter) && ($istok(channel.query.chat,$window($active).type,46)) {
; --- put the numbers of the colors to loop here (zeropad all single-digit color numbers) ---
var %cols = 04 12 08
var %num = $numtok(%cols,32)
msg $active $$regsubex($strip($1-),/(\S+)/g,$+($chr(3),$gettok(%cols,$iif(($calc(\n % %num) == 0),%num,$v1),32),\t))
haltdef
}
}
(I will use "_" to represent space.) If I typed "Hello.______How_are_you?", It would come out as "Hello._How_are_you?". I'm making my own talker script and was wondering if anyone knew how to modify it so that it counts all your spaces as well.
Last edited by never_lose; 09/09/09 03:26 AM.
|
|
|
|
Joined: Nov 2006
Posts: 1,552
Hoopy frood
|
Hoopy frood
Joined: Nov 2006
Posts: 1,552 |
I don't, sorry. The problem is not with preserving leading/trailing/consecutive spaces in the script (a common issue; one can word around it). It's rather acccessing the original input string: You can access the input text only with the identifier $1-, and the content of $1- is a "space-tokenized" version of the original string (leading/trailing/consecutive spaces are "lost" already). And while many events contain the original, "full spaced" string in $rawmsg, you cannot use this one in on input either, as there's no inbound message to the client. Edit: Have a look here for a better explanation and a possible third-party-sollution via "spaces.dll" which contains some "input" function. I don't have any personal experience with this dll, but I'm pretty sure other users on these forums do.
|
|
|
|
Joined: Jan 2007
Posts: 1,155
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,155 |
Try, $count($1-,$chr(32))
|
|
|
|
Joined: Jul 2006
Posts: 4,020
Hoopy frood
|
Hoopy frood
Joined: Jul 2006
Posts: 4,020 |
You can access the input text only with the identifier $1-, and the content of $1- is a "space-tokenized" version of the original string (leading/trailing/consecutive spaces are "lost" already). So anything on $1- won't work
#mircscripting @ irc.swiftirc.net == the best mIRC help channel
|
|
|
|
|