|
SoulbreaK Novice
Joined: 15 Aug 2001 Posts: 47 Location: USA
|
Posted: Tue Dec 25, 2001 7:58 pm
input text processing |
I'm making an encryption script. It works and all but there's a problem when people enter things like "," or "@" and such that are used in commands. This throws the whole thing off. How can I get it to take those characters as literals and still be able to capture them. Script sample:
#ONINPUT {^mt(%w) (*)} {
#IF (%pos( ",", "%2") > 0) {
#SA %ansi( red, high)Please leave out the ',' <-- small attempt to help fix the problem -->
#ABORT 1
}
keyn = %random( 1, 10)
sastring = %concat( %item( @alphabet, %random( 1, 52)), "z")
sastring = %concat( @sastring, %item( @alphabet, @keyn), %item( @alphabet, %random( 1, 52)), "`")
#LOOP 1,%len( %2) {
TempVa1 = %ismember( %copy( %2, %i, 1), @alphabet)
#IF (0 < @TempVa1 AND @TempVa1 < 42) {sastring = %concat( @sastring, %item( @alphabet, @TempVa1+@keyn))} {sastring = %concat( @sastring, %IF( @TempVa1 > 41, "`", ""), %copy( %0, %i, 1))}
}
%1 @sastring
}
Waterdeep "City of Splendors" |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Tue Dec 25, 2001 8:47 pm |
The first thing that would fix a few problems would be to quote the variable you capture your to encrypt string in.
#LOOP 1,%len( "%2") {TempVa1 = %ismember( %copy( "%2", %i, 1), @alphabet).......
This would take care of comma's, dots, punctuations and stuff, to take care of zMUD's special charcters you need to use %expand to keep them from being seen as special characters.
I have an encryption/decryption alias myself that I've been using for a while now. I never knew it malfunctioned on @ and ; and stuff (it handles all other characters perfectly) until I read this post and tested some things out.
Acaila |
|
|
|
SoulbreaK Novice
Joined: 15 Aug 2001 Posts: 47 Location: USA
|
Posted: Tue Dec 25, 2001 9:22 pm |
Solution worked great but created a new problem: The spaces between the words no longer show up. Now it just appears as all one word.
Waterdeep "City of Splendors" |
|
|
|
Acaila Apprentice
Joined: 30 Aug 2001 Posts: 187 Location: Netherlands
|
Posted: Tue Dec 25, 2001 9:41 pm |
Must be the %concat thing. I've never figured that one out, so I never use it.
Maybe someone who does understand that function can help here?
Acaila |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|