Jooel's code tidied up a little. Changed some ($c^) to $c^0.

<br><br><pre style="background:white;border-style:solid;border-color:silver;">

KiXtart
KiXtart Version = 4.52
KiXGolf Script = kixgolf_ts.kix

Computer
OS = Windows XP Professional
CPU = Intel Pentium Model 13
Speed = 599 MHz
Memory = 1024 MB

KiXGolf Scoring Engine
Scoring Engine = 3.3

KiXtart Golf Score
Tournament = Top Secret
Processing Start = 2007/08/10 07:40:23.621
Processing End = 2007/08/10 07:40:23.661
Duration = 0000/00/00 00:00:00.040
KiXGolf Result = Solution passed all 18 tests
KiXGolf Score = <font color="red">345</font>

Thank you for participating in KiXtart Golf!
</pre><br><br>

 Code:
; begin Top Secret
;
;!
Function a($l,$b,$c,$d)
 /*
 1) the block length
 2) the permutation
 3) the message to be encoded or decoded
 4) a parameter denoting encoding (E) or decoding (D)
 */

dim $i,$o[$c^0],$g,$,$r,$k
 for $i=0 to $c^0
  $=substr($c,$i+1,1)
	$a=lCase($)
	if $a>` & $a<}
   $g=$g+1
   $k=$k+$
   $r=$r+" "+$i
  endif
  $o[$i]=$
  if $g=$l | $i=($c^)
   for each $a in split($b,",")
    if $i+$a-$g-1<($c^)
     $=$+" "+$a
    endif
   next
   $=split($)
   for $a=1 to $g
    $o[split($r)[iif($d=E,$a,$[$a])]]=substr($k,iif($d=E,$[$a],$a),1)
   next
   redim $r,$g,$k
   $a=join($o,'')
EndFunction
;!
;!
; end Top Secret 
_________________________
Home page: http://www.kixhelp.com/hb/