mIRC Home    About    Download    Register    News    Help

Print Thread
#70424 06/02/04 01:49 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
i have a color script that only for certain things adds spaces to the text for instance if i type
.............. with the script off
. . . . . . . . . . . . . . with the script on replacing each . with a red one
i use this same code for the $ and it comes out fine seems actually to only effect these symbols < > . : " ' at first i thought it was due to usinga bold color however if i type
cntrl bk 12 ................... works just fine so i came down to the fact it must be to do with the consecutive color codes for each individual . which is as far as i got any way around it ?

thx smile

#70425 06/02/04 04:11 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
ok i am making progress but still isnt working i found a tutorial for $regsub and came up with this
Code:
 if ( : isin %ppp ) { !.echo -q $regsub(%ppp,/:/g,12:,%ppp) }  

but now it alternates every other one to bold ?

#70426 06/02/04 05:01 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
migth help to show us a sample of the script. I have never had trouble using an item in $replace

#70427 06/02/04 11:58 PM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
sure something like this
if ( $ isin %ppp ) { /set %ppp $replace(%ppp,$,04$01) }
will put out $$$$$$$$$ without spaces
however this
if ( < isin %ppp ) { /set %ppp $replace(%ppp,<,12<01) }
will put out < < < < < < with spaces
instead of <<<<<< without spaces

#70428 07/02/04 03:33 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
is there a tutorial for $regsub ?

#70429 07/02/04 03:35 AM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
your doing something else as well

i copied your lines eactly as you showed them here.
and added testing info around them,

aaa {
set %ppp $1
echo -a :1: $+ %ppp $+ :
if ( $ isin %ppp ) { /set %ppp $replace(%ppp,$,04$01) }
if ( < isin %ppp ) { /set %ppp $replace(%ppp,<,12<01) }
echo -a :2: $+ %ppp $+ :
}

/aaa $$$$
:1:$$$$:
:2:04$0104$0104$0104$01:

/aaa <<<<<<
:1:<<<<<<:
:2:12<0112<0112<0112<0112<0112<01:

No Spaces appeared on my test at all.

one other thing u might consider doing, if those < & $ are altered all one after each other is this

set %ppp $replace(%ppp,$,04$01,<,12<01)

dump the isin and just replace any occurances, its faster as soon as your replacing more than one thing (this of course is dependent on if your script is ment to replace all of them in one bit of text)

#70430 07/02/04 04:33 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Why do you want each and every character enclosed in "04" "01" ?

#70431 07/02/04 04:50 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
i want to replace the $ with a red$ and then i need to switch back to the regular text color so it will look like --
hello i spent a lot of $$ at the store today & actually it was about 50 % of my paycheck. --
the script works fine for almost every symbol or word i have replaced just for a few it seems to space them ? i had asked awhile ago on how to make my question marks?? alternate color and i believe it was qwerty who gave me a regsub snippet to do that and in part of the notes there was a statement about removing consecutive control codes so i assumed perhaps that is my problem now ? if you could point me to a tutorial dealing with $regsub or give me a working example of how to use it for this purpose ? its not that the script doesnt work it just it makes this <<<<< look like this < < < < < on further examination i am unsure if it just normal behavior when you apply the bold code to the text ? if so then i apoligize for not realizing this but when you apply thr bold code to the $ symbol the spacing doesnt change between them $$$ still looks like $$$ however <<< comes out looking like < < < hope this makes sense .

#70432 07/02/04 05:04 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Well, what you posted above, "if ( < isin %ppp ) { /set %ppp $replace(%ppp,<,12<01) }" will NOT add spaces to it.
As Dave said if you're getting spaces inserted then your script is doing something else as well as what you posted.


Edit:
Just noticed this "on further examination i am unsure if it just normal behavior when you apply the bold code to the text"
If you don't know if there actually is spaces, copy/paste the result and see grin

Last edited by Iori; 07/02/04 05:06 AM.
#70433 07/02/04 05:17 AM
Joined: Dec 2002
Posts: 332
C
Cheech Offline OP
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 332
actually i ran a clean version of mirc and typed this
...
then i applied the bold to it which comes out
. . .
then i typed without bold and added a space to it
. . .
so it is a space between however it isnt caused by my script so sorry for the confusion .

i would still like a good site for $regsub if anybody has one thx .

#70434 07/02/04 05:23 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
alias aaa {
var %ppp $1-
echo -a :1: $+ %ppp $+ :
.echo -q $regsub(%ppp,/([<>%]+)/g,12\1,%ppp)
.echo -q $regsub(%ppp,/([$&]+)/g,04\1,%ppp)
echo -a :2: $+ %ppp $+ :
}
Add/remove <>% or $& chars as needed.

/aaa hello i spent a lot of $$ at the store today & actually it was about 50 % of my paycheck. --
:1:hello i spent a lot of $$ at the store today & actually it was about 50 % of my paycheck. --:
:2:hello i spent a lot of $$ at the store today & actually it was about 50 % of my paycheck. --:

Edit: BTW 01 might be YOUR "normal text" color, it isn't everyone elses though.

Last edited by Iori; 07/02/04 05:31 AM.

Link Copied to Clipboard