|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Thu May 20, 2004 11:37 pm
What's wrong with this alias? |
The alias:
Code: |
#ALIAS trans {#VARIABLE before {%-1} {_nodef} {translate/words}
#VARIABLE after {} {_nodef} {translate/words}
after = %subchar( @before, @regular, @garbled)
#SHOW @before
#SHOW @after
#VARIABLE before_words %replace( @before, " ", "|") {_nodef} {translate/words}
#VARIABLE after_words %replace( @after, " ", "|") {_nodef} {translate/words}
#IF (%numwords( @before, " ") = %numwords( @after, " ") ) {
#LOOP 1,@num_before) {
#IF ((!%ismember( %item( @before_words, %i), @translated)) AND
(!%ismember( %item( @after_words, %i), @nontranslated))) {
#ADDITEM translated %item( @before_words, %i)
#ADDITEM nontranslated %item( @after_words, %i)
} {
#SHOW %item( @before_words, %1) and %item( @after_words, %i) not added.
}
}
} {
#SHOW Number of translated words do not match! before: %numwords( @before), after: %numwords( @after)}
} |
This is for my translation stuff. I give it a string of English words, it translates it into the jibberish that I can't normally read. However, the first IF statment always fires off the false command even when the %numwords values are equal. What's wrong with this?
Sample -
input: trans I want this translated
Output:
I want this translated
z vynr rpus rvynsyyruw
Number of translated words do not match! before: 4, after: 4
As you can see, the values do match, so what's wrong with it? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri May 21, 2004 3:44 am |
It's the unneeded space at the end of the condition.
#IF (%numwords( @before, " ") = %numwords( @after, " ")) |
|
|
|
Vorax Apprentice
Joined: 29 Jun 2001 Posts: 198 Location: USA
|
Posted: Fri May 21, 2004 3:50 am |
Ugh. A lousy space! I'm not even sure how that space got there. Thanks for catching that. :)
|
|
|
|
|
|
|
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
|
|