forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Simple Translator Project

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Jaymes
Newbie


Joined: 29 Dec 2004
Posts: 4

PostPosted: Wed Dec 29, 2004 3:46 am    Post subject: Simple Translator Project Reply with quote

How would I convert the contents of one variable via translation? I'm looking to start very simple. Such as a=b, b=d, c=c. I got it to translate single letters with a list trick, but words and whole sentences are a mystery to me.

Note: I'm using The VDS Personal version 4 (free)

_________________
N00b
Back to top
View user's profile Send private message
Serge
Professional Member
Professional Member


Joined: 04 Mar 2002
Posts: 1480
Location: Australia

PostPosted: Wed Dec 29, 2004 8:13 am    Post subject: Reply with quote

i don't think that there is a difference in that instead of using @ITEM() you would use %%VARIABLE

serge

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Dec 29, 2004 9:21 am    Post subject: Reply with quote

Is this what you try to do (made it real quick, so I hope you can understand what it does) ? Smile

Code:
%%Sentence = "Hello world what a nice day"

rem List 1 will keep the translations in the format of |ORIGINAL=NEW
list create,1
list add,1,|hello=hallo
list add,1,|world=wereld
list add,1,|what=wat
list add,1,|a=een
list add,1,|nice=mooie
list add,1,|day=dag

rem Put the contents of %%Sentence in a list here
list create,2
repeat
  rem You can change the IF-statement below so that it will also "recognize" commas and dots.
  if @greater(@pos(" ",%%Sentence),0)
    list add,2,@substr(%%Sentence,1,@pred(@pos(" ",%%Sentence)))
    %%Sentence = @strdel(%%Sentence,1,@pos(" ",%%Sentence))
  else
    list add,2,%%Sentence
    %%Sentence =
  end
until @equal(%%Sentence,)

rem Now translate all list items and put it back into the %%Sentence variable
%%Counter = 0
repeat
  list seek,1,0
  if @match(1,"|"@item(2,%%Counter)"=")
    %%Sentence = @trim(%%Sentence" "@strdel(@item(1),1,@pos("=",@item(1))))
  end
  %%Counter = @succ(%%Counter)
until @equal(%%Counter,@count(2))

list close,2
list close,1

info Translated sentence:@cr()%%Sentence

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Jaymes
Newbie


Joined: 29 Dec 2004
Posts: 4

PostPosted: Wed Dec 29, 2004 7:56 pm    Post subject: Reply with quote

Skit3000 wrote:
Is this what you try to do (made it real quick, so I hope you can understand what it does) ? Smile
That works wonderfully! However, I tweaked with it for about an hour and I couldn't get it to do what I wanted. I am looking more for a letter-by-letter translator.
hello = junni because h=j, e=u, l=n, o=i, etc. It's a very simple translator and eliminates the need to put every word in the endlish language (about a million according to oxford) into that list. I'd rather handle 26 letters plus some punctuation.

_________________
N00b
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Dec 30, 2004 7:56 am    Post subject: Reply with quote

If ya wanna do that type of character translation, String.DLL has a Translate function which
does exactly that.

Greetz
Dr. Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Jaymes
Newbie


Joined: 29 Dec 2004
Posts: 4

PostPosted: Fri Dec 31, 2004 10:28 pm    Post subject: Reply with quote

Dr. Dread wrote:
If ya wanna do that type of character translation, String.DLL has a Translate function which
does exactly that.

Greetz
Dr. Dread
That doesn't work for Personal VDS 4.
_________________
N00b
Back to top
View user's profile Send private message
Jaymes
Newbie


Joined: 29 Dec 2004
Posts: 4

PostPosted: Mon Jan 03, 2005 9:39 am    Post subject: Reply with quote

What would have to be changed in that script above for it to work with letter-by-letter translation?
_________________
N00b
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group