mIRC Home    About    Download    Register    News    Help

Print Thread
replace characters into $chr(43) #94308 15/08/04 01:19 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi all.
I try to change the characters in a line into $chr(43) [this is a +] but excluding the spaces.
example:
line = New York
new line shouild be: +++ ++++

i have this sofar, but it doesn't work.

%teller = $len(%antwoord)
var %i = 1
while (%i <= %teller) {
%hinta = $replace(%hinta,%antwoord,$chr(43))
inc %i
}

greetz
aaron


Deridio fatum
Re: replace characters into $chr(43) #94309 15/08/04 02:06 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
Code:
alias teller {
  var %i = 1, %total = $numtok($1-,32), %output
  while (%i &lt;= %total) {
    var %x = $len($gettok($1-,%i,32))
    var %output = %output $+ $str(+,%x) $+ $chr(160)
    inc %i
  }
  $iif($isid,return,say) %output
}
I tested here and it works fine smile

Have fun wink
Zyzzy.


"All we are saying is give peace a chance" -- John Lennon
Re: replace characters into $chr(43) #94310 15/08/04 02:20 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
Hi Zyzzyx26

i tried your solution but i got the error:
/say: insufficient parameters

greetz
aaron


Deridio fatum
Re: replace characters into $chr(43) #94311 15/08/04 02:26 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
I tested here once again at it works as it should. Remember that, to use /teller <word>, you must be in a channel or query window, or else it wont work.

You can use it in 2 ways: /teller word to send the sentence to the channel/query - or - $teller(word) to return the sentence (in a script, maybe). Also make sure you copied the whole code.

Good luck smile
Zyzzyx.


"All we are saying is give peace a chance" -- John Lennon
Re: replace characters into $chr(43) #94312 15/08/04 02:41 PM
Joined: Jan 2004
Posts: 129
A
AaronL Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2004
Posts: 129
hi Zyzzyx26

i forgot the ,word>
after that i got the error: you'r not in a channel.
so i changed the SAY into MSG #CHANNELNAME

works like a charm now.
Thank you very much for your help.

Greetz
Aaron


Deridio fatum
Re: replace characters into $chr(43) #94313 15/08/04 03:11 PM
Joined: Feb 2004
Posts: 2,019
FiberOPtics Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

Usage: $reptext(string,char)

Code:

alias reptext var %a | .echo -q $regsub($$1,/\S/g,$$2,%a) | return %a

This works in all cases except if the char is a \
There's a small work around possible for that, but imo it's not worth it.

Greets

Last edited by FiberOPtics; 15/08/04 03:45 PM.

Gone.
Re: replace characters into $chr(43) #94314 15/08/04 05:06 PM
Joined: Feb 2004
Posts: 714
Z
Zyzzyx26 Offline
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
yw, glad it works! smile


"All we are saying is give peace a chance" -- John Lennon