|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Sat Apr 17, 2004 10:11 pm
Neeed help changing say color, within one word.... |
I have been puzzling over a code for a long time. I am attempting to make a script that will basically cause my say commands, etc... look like the following without having to enter the color codes and stuff by myself.
Greetings, My Name Is Imri Lucius.
I've pieced it together, I've figured a lot out in my attempts...I even figured out a way to reverse the order of my words when I enter them. However, I have failed all my attempts to get this code to work. Could anyone help me figure out how to make it work?
I'm thinking you will need to use %numwords to figure out how many words per sentence...use some function to determine how many letters in each word, probably need a loop to do it word by word...so you can edit the color of the First letter and capitalize it..though the capitialization can be left out, as thats easy enough to type by itself....will also probably need another loop to make it do this to each word in the sentence...anyway, thanks for the help. |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Sun Apr 18, 2004 1:39 am |
Something like this could work.
#VAR phrase "Greetings, My Name Is Imri Lucius."
#VAR colorphrase %subregex(@phrase, "(bw+b)", "%ansi(bold,blue)%insert(%ansi(bold,green),%proper(%1),2)")
#SHOW @colorphrase
edit
Missed that you wanted em capitalized as well added %proper(%1)
Jesse |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Mon Apr 19, 2004 8:57 pm |
That works, as the show command, however...when I try and enter that into a say, it gives the ansi color codes, rather than coloring it...at least thats what it looks like....also, I need to change the phrase command, to be able to take whatever I say, and enter that....for example...
say Hello, how are you doing.
I need it to take everything after say, and color it. Also, this isn't just for my viewing, I had wanted everyone that sees me speak int he game, see the color change, if they have the ability to. the phrase variable can't be a set thing...I was thinking to use the %-1 command, to make it take everything after say...but I'm not sure if thats the appropriate, or complete command I would need to add to this. if you need more info on how I need this...please let me know. my email is holy_flame@hotmail.com if you want to contact me directly. Thanks. |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Mon Apr 19, 2004 9:23 pm |
The one important piece of information you have left out, is what's the color codes for the blue and the green you want?
|
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Mon Apr 19, 2004 9:26 pm |
Ok I was just giving an example cause I didnt know what you used to send color to your mud. Like on most muds your not allowed to send
ansi telnet codes they usually have a system for you to send them color. For example on one of my old muds if I wanted bold, blue and bold green id send %^BOLD%^%^BLUE%^hi!%^BOLD%^%^GREEN%^everybody
So im gonna use %ansi for this example but you should replace that with how you send color codes to your mud.
Don't forget the tilde in front of say in say alias! Serious spammage! :)
#ALIAS say {clrtmp = %-1;~say @colorit("@clrtmp")}
#FUNCTION colorit {%subregex(%-1, "(bw+b)", "%ansi(bold,blue)%insert(%ansi(bold,green),%proper(%%1),2)")}
Just a note I use the variable,quote combo in the say alias to stop any probs with saying anything with commas. And That %%1 in the color it function is correct, it makes sure 'colorit' uses the %1 from the subregex function rather then the %1 from the colorit function.
Cheers, Jesse |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Mon Apr 19, 2004 9:52 pm |
Thanks, I'll get it to work...also, the color codes we use are $ and a number...each color has a number. And $I to make it bold, as you put it. :) for bright blue and bright green, you would use $1$I for blue, and $2$I for green...hope this works...thanks again.
|
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Mon Apr 19, 2004 9:57 pm |
Hmmm...ok, I plugged that in and now it is giving me this...when I typed a message....
You say ',Hello,2), ,Hope,2) ,This,2) ,Works,2).'
the proper command works..as I didn't type it al in caps like that...but the color didnt' work....
I changed it to different colors...I used bright blue and cyan....the whole thing is color cyan.... :( any ideas? |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Mon Apr 19, 2004 10:03 pm |
#ALIAS say {clrtmp = %-1;~say @colorit("@clrtmp")}
#FUNCTION colorit {%subregex(%-1, "(bw+b)", "$1$I%insert($3),%proper(%%1),2)")}
I put a space right..................................^ here....and it changed it to this....
You say '% insert(),Hello,2), % insert(),Hope,2) % insert(),This,2) % insert(),Works,2).'
You get the idea.....it repeats to the end of the message.... |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Mon Apr 19, 2004 10:06 pm |
mutters..ok, that space here thing didn't work...should have previewed it first..the space is just before the %insert command
|
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Mon Apr 19, 2004 10:17 pm |
The problem is you have too many closing Parentheses. Remove the last ) in the function, and move the " inside the closing bracket ->
#ALIAS say {clrtmp = %-1;~say @colorit("@clrtmp")}
#FUNCTION colorit {%subregex(%-1, "(bw+b)", "$1$I%insert($3),%proper(%%1),2")} |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Mon Apr 19, 2004 10:36 pm |
I tried it...and it still isn't working...I've played with a few of the variables...but still doesn't change it completely...like removing the commas removes them from the display....removing the parenthases will remove them from the display...I put parathases around the color codes as well.....didn't change much....
|
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Mon Apr 19, 2004 11:13 pm |
Ah yes, this one should do:
#ALIAS say {clrtmp = %-1;~say @colorit("@clrtmp")}
#FUNCTION colorit {%subregex(%-1, "(bw+b)", "$1$I%insert($3,%proper(%%1),2)")} |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Tue Apr 20, 2004 3:29 am |
THANKS A BILLION, I never would have figured that out on my own...however, I need you for one more thing if you could? I need to make that into a sayto command now...basically...the format is this...
sayto (persons name or adj) (message)
so it needs to skip over the second word, then start working from there I tried throwing in the usual commands to make it skip it...but its not wanting to work...I tried adding this...
~sayto %1<to skip the name> @colorit( "@clrtmp")%2
but it gave this in response.....
>sayto self ooc is it working now?
You ask to you 'Self Ooc Is It Working Now?
the coloring works, but its just screwing the word structure up...any ideas?
Thanks |
|
|
|
jessew Apprentice
Joined: 03 Mar 2003 Posts: 141
|
Posted: Tue Apr 20, 2004 3:33 am |
This is pretty easy you dont even have to modify the function code
#ALIAS sayto {clrtmp = %-2;~sayto %1 @colorit("@clrtmp")}
#FUNCTION colorit {%subregex(%-1, "(bw+b)", "$1$I%insert($3,%proper(%%1),2)")}
Jesse |
|
|
|
imri Beginner
Joined: 15 Apr 2004 Posts: 13 Location: USA
|
Posted: Tue Apr 20, 2004 5:05 pm |
THANK YOU BOTH SOO MUCH!!! I don't know why I didn't try that myself....there is a lot I need to learn about scripting.... Thanks again!
|
|
|
|
|
|
|
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
|
|