|
Joined: Dec 2002
Posts: 111
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 111 |
Why isnt this thing working right? alias bk2 { var %x 1 while (%x <= $gettok($1-,0,32)) { var %i = $len($gettok($1-,%x,32)) while (%i > 0) { var %o = $+(%o,$mid($gettok($1-,%x,32),%i,1)) dec %i } inc %x } if ($isid) return %o say %o } It's being a pos and not adding spaces.. I know that doesnt have any kind of space-adding in it, but even when I try, it doesnt work. I'm annoyed as hell with it, and that's probably why I cant get it, but it's getting really annoying and, bah.
Experience The Void.. Are You Ready?
|
|
|
|
Joined: Dec 2002
Posts: 144
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 144 |
Don't know if it makes a difference or not, but you forgot the equation sign for the %x. var %x = 1
Dana
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
|
|
|
|
Joined: Dec 2002
Posts: 111
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 111 |
/me tries that..
(few minutes later)
Nope. Didnt work, bah.
Experience The Void.. Are You Ready?
|
|
|
|
Joined: Dec 2002
Posts: 144
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 144 |
I added a bit to it ...
alias bk2 {
var %x = 1, %result = ""
while (%x <= $gettok($1-,0,32)) {
var %i = $len($gettok($1-,%x,32))
while (%i > 0) {
var %o = $+(%o,$mid($gettok($1-,%x,32),%i,1))
dec %i
}
inc %x
set %result $instok(%result,%o,$calc($numtok(%result,32) + 1),32)
unset %o
}
if ($isid) return %result
echo -s %result
} I *think* that this is what you want, but not sure.
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
|
|
|
|
Joined: Dec 2002
Posts: 111
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 111 |
*sighs heavily* Yes, it is, but I want to know why it wont work with var %o = $+($chr(32),%o,...) and such. It's beginning to piss me off a little.
Experience The Void.. Are You Ready?
|
|
|
|
Joined: Dec 2002
Posts: 144
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 144 |
I suspect that it has something to do with the way that mIRC parses spaces. Because if you replace all the "regular" spaces with "hard" spaces ($chr(160)), then the script works just like you want it to as well:
alias bk2 {
var %x = 1
var %start = $replace($1-,$chr(32),$chr(160))
while (%x <= $gettok(%start,0,32)) {
var %i = $len($gettok(%start,%x,32))
while (%i > 0) {
var %o = $+(%o,$mid($gettok(%start,%x,32),%i,1))
dec %i
}
inc %x
}
if ($isid) return %o
echo -s %o
}
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
|
|
|
|
Joined: Dec 2002
Posts: 111
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 111 |
alias bk { var %i $len($1-),%o while (%i) { var %o = $+(%o,$mid($1-,%i,1),$chr(32)) dec %i } if ($isid) return %o say %o }
Does the same thing.. it reverses everything. What I'm trying to do is keep the words in the same order, but reversed. And I've partially got it, but the spaces are being ...
Experience The Void.. Are You Ready?
|
|
|
|
Joined: Dec 2002
Posts: 144
Vogon poet
|
Vogon poet
Joined: Dec 2002
Posts: 144 |
First of all, I think that you should just use the script that I gave you. :P If it works, don't mess with it! Secondly, I don't understand where in your script, you're telling it to add the spaces. Basically, you're breaking down the input into words and then reversing the order of the letters for each word "$mid($gettok($1-,%x,32),%i,1)" before moving on to the next word. But you're not taking any spaces from the original input and adding it to %o. Or am I blind?
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
|
|
|
|
Joined: Dec 2002
Posts: 111
Vogon poet
|
OP
Vogon poet
Joined: Dec 2002
Posts: 111 |
Like I said, even when I took adding spaces into account with the $mid, it didnt work. BUT, I have it now.
alias bk2 { var %x 1 while (%x <= $gettok($1-,0,32)) { var %i = $len($gettok($1-,%x,32)),%b while (%i) { %b = $+(%b,$mid($gettok($1-,%x,32),%i,1)) dec %i } var %o = %o %b inc %x } if ($isid) return %o say %o } Anyway, g'night, and thanks for the help.
Experience The Void.. Are You Ready?
|
|
|
|
Joined: Dec 2002
Posts: 18
Pikka bird
|
Pikka bird
Joined: Dec 2002
Posts: 18 |
alias bk2 {
var %i 1,%x,%t,%r
while %i <= $numtok($1-,32) {
%x = $len($gettok($1-,%i,32))
while %x { %t = %t $+ $mid($gettok($1-,%i,32),%x,1) | dec %x }
%r = %r %t
%t = ""
inc %i
}
if $isid { return %r }
say %r
}
-watcher
|
|
|
|
|