|
Joined: Jan 2003
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 18 |
Hey all, just a quickie... I'm looking for a script, or to make one, that reverses the alphabet with an alias. Example: /lang abdefg will create zyxwvu. I tried this with no success: code { return $replace($upper($1-),a,z,b,y,c,x,d,w,e,v,f,u,g,t,h,s,i,r,j,q,k,p,l,o,m,n,n,m,o,l,p,k,q,j,r,i,s,h,t,g,u,f,v,e,w,d,x,c,y,b,z,a) } /lang //say $code($1-) Any ideas? All that creates is abcdefg again  andy
Last edited by Indefinate; 24/11/03 09:06 AM.
|
|
|
|
Joined: Dec 2002
Posts: 5
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Dec 2002
Posts: 5 |
I think this is what you want Example 1: //echo -s $reverse(r zn blfi mvd tlw olo) Example 2: //echo -s $reverse(gsrh rh z xizkkb vcznkov)
/reverse {
var %alpha = a;b;c;d;e;f;g;h;i;j;k;l;m;n;o;p;q;r;s;t;u;v;w;x;y;z
var %n = 1,%m = $len($1-),%final.string,%mid,%letter
while (%n <= %m) {
%mid = $mid($1-,%n,1)
if (%mid == $chr(32)) { %final.string = %final.string $+ $cr }
elseif (%mid isletter) {
%letter = $gettok(%alpha,$abs($calc($findtok(%alpha,%mid,1,59) - 27)),59)
%final.string = %final.string $+ $iif(%mid isupper,$upper(%letter),%letter)
}
else { %final.string = %final.string $+ %mid }
inc %n
}
return $replace(%final.string,$cr,$chr(32))
}
-- GamerTag: maffew How many hax0rz does it take to screw in a lightbulb? 1337
|
|
|
|
Joined: Jan 2003
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 18 |
I just tried it then... gave me this error:
* Invalid format: $mid (line 6083, aliases.nns)
andy
|
|
|
|
Joined: Jan 2003
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 18 |
Ok, just made it look like how you put it in the code quotes, and now it's giving me no error at all, but also isn't working  andy
|
|
|
|
Joined: Jan 2003
Posts: 18
Pikka bird
|
OP
Pikka bird
Joined: Jan 2003
Posts: 18 |
Yay! I got it...
I totally ignored the first part :tongue:
Now the next part... dialog to reverse it :tongue:
Edit: To reverse it, by that I mean, paste the reversed text into an input box, hit the button, and it spits out the real english in the other input box.
andy
Last edited by Indefinate; 24/11/03 03:13 PM.
|
|
|
|
Joined: Dec 2002
Posts: 5
Nutrimatic drinks dispenser
|
Nutrimatic drinks dispenser
Joined: Dec 2002
Posts: 5 |
To use the script you will need the alias from my last post. Type in the top editbox and click the reverse button your reversed text will appear in the bottom editbox. You can have your text reversed in realtime just check the checkbox and type in the top editbox. You can copy your results from the bottom editbox by clicking the copy button.
dialog reverse {
title "Reverse Text by Maffew"
size -1 -1 370 87
option pixels
edit "",1,5 5 360 23,autohs
edit "",2,5 33 360 23,read,autohs
button "&Close",100,315 63 50 20,ok
button "&Reverse",101,195 63 60 20,default,disabled
check "R&ealtime Reverse",102,5 65 110 20
button "C&opy",103,260 63 50 20,disabled
}
on *:dialog:reverse:edit:1:{
if ($did(102).state) {
did -b $dname 101
if ($did(1,1) != $null) {
did -o $dname 2 1 $reverse($did(1,1))
did -c $dname 2 1 $len($did(2,1)) $len($did(2,1))
did -e $dname 103
}
else {
did -r $dname 2
did -b $dname 103
}
return
}
elseif ($did(1,1) != $null) { did -e $dname 101 }
else { did -b $dname 101 }
}
on *:dialog:reverse:sclick:101:{
if ($did(1,1) != $null) {
did -o $dname 2 1 $reverse($did(1,1))
did -e $dname 103
}
else { did -b $dname 101,103 }
}
on *:dialog:reverse:sclick:102:{
if ($did(102).state) { did -b $dname 101 }
elseif ($did(1,1) != $null) { did -e $dname 101,103 }
else { did -b $dname 101 }
}
on *:dialog:reverse:sclick:103:{
if ($did(2,1) != $null) { clipboard $ifmatch }
else { did -b $dname 103 }
}
menu status,channel,menubar {
-
$iif($dialog(reverse),$style(2)) Reverse Text:{ dialog -m reverse reverse }
-
}
-- GamerTag: maffew How many hax0rz does it take to screw in a lightbulb? 1337
|
|
|
|
|