mIRC Home    About    Download    Register    News    Help

Print Thread
#208809 29/01/09 01:32 AM
Joined: Feb 2007
Posts: 228
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 228
im trying to perform a binary replace but im having problems with it. %_SERVERS_CHANNELS_% is never in the same place and what is returned from $new_servers_channels will change as well.

im trying to search for the string %_SERVERS_CHANNELS_% in my &var and replace it with what ascii text is returned from $new_servers_channels


alias new_servers_channels { return foobar }

when i tried:
/breplace &var $+(%,_SERVERS_CHANNELS_,%) $new_servers_channels


i get this instead:

f_SERVERS_CHANNELS_f



MTec007 #208849 30/01/09 02:10 AM
Joined: Feb 2007
Posts: 228
M
MTec007 Offline OP
Fjord artisan
OP Offline
Fjord artisan
M
Joined: Feb 2007
Posts: 228
resolved. for reference: link to script

modifications:

Quote:

;/brepbytes &binvar oldtext newtext
alias brepbytes {
var %p,%s,%r = 1,%l = 1
bunset &replace
while (%l <= $bvar($1,0)) {
while ($bfind($1,%l,$2).text) {
%p = $ifmatch
while (%l < %p) {
bset &replace %r $bvar($1,%l,1)
inc %r
inc %l
}

bset -t &replace %r $3-
inc %l $len($2)
inc %r $len($3-)
}
bset &replace %r $bvar($1,%l,1)
inc %r
inc %l
}
%l = 1
while ($bvar(&replace,%l,1) != $null) {
bset $1 %l $ifmatch
inc %l
}
}


Link Copied to Clipboard