mIRC Home    About    Download    Register    News    Help

Print Thread
#1989 16/12/02 03:58 AM
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
Why isnt this thing working right? smirk

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?
#1990 16/12/02 04:02 AM
Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
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
#1991 16/12/02 04:15 AM
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
Joined: Dec 2002
Posts: 111
/me tries that..

(few minutes later)

Nope. Didnt work, bah.


Experience The Void.. Are You Ready?
#1992 16/12/02 04:38 AM
Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
Joined: Dec 2002
Posts: 144
I added a bit to it ...

Code:
alias bk2 {
  var %x = 1, %result = ""
  while (%x &lt;= $gettok($1-,0,32)) {
    var %i = $len($gettok($1-,%x,32))
    while (%i &gt; 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
#1993 16/12/02 04:50 AM
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
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?
#1994 16/12/02 05:00 AM
Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
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:

Code:
alias bk2 {
  var %x = 1
  var %start = $replace($1-,$chr(32),$chr(160))
  while (%x &lt;= $gettok(%start,0,32)) {
    var %i = $len($gettok(%start,%x,32))
    while (%i &gt; 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
#1995 16/12/02 05:05 AM
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
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?
#1996 16/12/02 05:16 AM
Joined: Dec 2002
Posts: 144
D
Vogon poet
Offline
Vogon poet
D
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! wink

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
#1997 16/12/02 05:23 AM
Joined: Dec 2002
Posts: 111
F
Frog Offline OP
Vogon poet
OP Offline
Vogon poet
F
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?
#1998 16/12/02 05:40 AM
Joined: Dec 2002
Posts: 18
W
Pikka bird
Offline
Pikka bird
W
Joined: Dec 2002
Posts: 18
Code:
 alias bk2 {
  var %i 1,%x,%t,%r
  while %i &lt;= $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
} 

cool


-watcher

Link Copied to Clipboard