Solved] Question about Korean inputer

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Solved] Question about Korean inputer

#1 Post by backansi » Sun May 31, 2009 8:25 am

hi :oops: I want to make a dating simulation game by Ren'Py.

and....I'm korean so I used a Korean inputer code made by JQuartz, but it didn't work.

according to traceback.txt , it was a UnicodeDecodeError, but there was no other words about cause of error .

where error occured is here

Code: Select all

        $ J_ki_word_placeholder=eval("u'\u"+J_ki_word_placeholder+"'") 
and another same code made an error.

when I add # front of that codes, it worked like this.
img1.JPG
img1.JPG (7.4 KiB) Viewed 1817 times
of course, I tried to fix it, but i couldn't fix that code.

Ren'Py version is latest, and language default is eastasian.


I'll be thankful about your help :oops:
Last edited by backansi on Tue Jul 14, 2009 1:52 am, edited 1 time in total.

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Question about Korean inputer

#2 Post by JQuartz » Sun May 31, 2009 9:43 pm

Try this version:

Code: Select all

init:
    $ J_ki_word=''
    $ J_ki_jamo=0
    $ J_ki_tail=0
    $ J_ki_vowel=0
    $ J_ki_lead=0
    $ J_ki_word_placeholder='[]'
    $ J_ki_last_alphabet=''
    $ J_ki_num=-1
    $ this_got_final=None
    $ J_ki_limit=999


label korean_inputer:
############################################### Put Whatever show or scene in here#######################################################
    $ J_ki_limit=5


###############################################################################################################################
    if J_ki_word_placeholder=='':
        $ J_ki_word_placeholder='[]'
    $ J_ki_identifier=[]
    $ J_ki_all_korean_alphabets=[(u"\u3131",1,0),(u"\u3134",3,0),(u"\u3137",4,0),(u"\u3139",6,0),(u"\u3141",7,0),(u"\u3142",8,0),(u"\u3145",10,0),(u"\u3147",12,0),(u"\u3148",13,0),(u"\u314a",15,0),(u"\u314b",16,0),(u"\u314c",17,0),(u"\u314d",18,0),(u"\u314e",19,0),("", 'x', 5),(u"\u3132",2,0), (u"\u3138",5,0),(u"\u3143",9,0),(u"\u3146",11,0),(u"\u3149",14,0),             (u"\u314f",1,1),(u"\u3151",3,1),(u"\u3153",5,1),(u"\u3155",7,1),(u"\u3157",9,1),(u"\u315b",13,1),(u"\u315c",14,1),(u"\u3160",18,1),(u"\u3161",19,1),(u"\u3163",21,1),("", 'x', 5),(u"\u3150",2,1),(u"\u3152",4,1),(u"\u3154",6,1),(u"\u3156",8,1),("", 'x', 5),(u"\u3158",10,1),(u"\u3159",11,1),(u"\u315a",12,1),(u"\u315d",15,1),(u"\u315e",16,1),(u"\u315f",17,1),(u"\u3162",20,1),           (u"\u3131",1,2),(u"\u3134",4,2),(u"\u3137",7,2),(u"\u3139",8,2),(u"\u3141",16,2),(u"\u3142",17,2),(u"\u3145",19,2),(u"\u3147",21,2),(u"\u3148",22,2),(u"\u314a",23,2),(u"\u314b",24,2),(u"\u314c",25,2),(u"\u314d",26,2),(u"\u314e",27,2),("", 'x', 5), (u"\u3132",2,2),(u"\u3146",20,2),("", 'x', 5),(u"\u3133",3,2),(u"\u3135",5,2),(u"\u3136",6,2),(u"\u313a",9,2),(u"\u313b",10,2),(u"\u313c",11,2),(u"\u313d",12,2),(u"\u313e",13,2),(u"\u313f",14,2),(u"\u3140",15,2),(u"\u3144",18,2),("", 'x', 5),("",0,11),("Space",19,20),("Backspace",19,15),("Done",19,12)]
    
    $ ui.frame(xpos=.5, ypos=.5, xanchor=.5)
    $ ui.vbox( )
    $ ui.hbox()
    $ ui.text(J_ki_word)
    if J_ki_limit>=len(J_ki_word) + 1:
        $ ui.text(J_ki_word_placeholder)
    $ ui.close()
    $ ui.null(height=20)
    if J_ki_jamo==0 and J_ki_limit>=len(J_ki_word) + 1:
        $ ui.text('Initial')
    elif J_ki_jamo==1:
        $ ui.text('Median')
    elif J_ki_jamo==2:
        $ ui.text('Final')
        
    $ ui.hbox()
    python:
        for alphabets, unicode_value,type in J_ki_all_korean_alphabets:
            if len(J_ki_word)<=J_ki_limit-1:
                if J_ki_jamo==type:
                    ui.button(clicked=ui.returns(unicode_value))
                    ui.text(alphabets)
                if J_ki_jamo==type-9:
                    ui.button(clicked=ui.returns(unicode_value))
                    ui.text(alphabets)
                if J_ki_jamo==type-20 and J_ki_word:
                    ui.button(clicked=ui.returns(alphabets))
                    ui.text(alphabets)
            if (J_ki_jamo==type-13 or J_ki_jamo==type-14 or J_ki_jamo==type-15) and (J_ki_word or not J_ki_jamo==0):
                ui.button(clicked=ui.returns(alphabets))
                ui.text(alphabets)
            
            if J_ki_jamo==type-12 and J_ki_word:
                ui.button(clicked=ui.jumps('J_ki_done'))
                ui.text(alphabets)
            if type==5:
                ui.close()
                ui.hbox()
    $ ui.close()
    $ ui.close()
    $ J_ki_button_selection=ui.interact()
    
    if J_ki_jamo==0:
        if J_ki_button_selection=="Space":
            $ J_ki_word=J_ki_word+u" "
            jump korean_inputer
            
        elif J_ki_button_selection=="Backspace":
            $ J_ki_jamo=0
            $ J_ki_tail=0
            $ J_ki_vowel=0
            $ J_ki_lead=0
            $ J_ki_word_placeholder=''
            $ J_ki_word=J_ki_word[:-1]
            if len(J_ki_word)>=1:
                $ J_ki_last_alphabet=J_ki_word[-1]
                if J_ki_last_alphabet==" ":
                    while J_ki_last_alphabet==" " and not len(J_ki_word)<-(J_ki_num):
                        $ J_ki_last_alphabet=J_ki_word[J_ki_num]
                        $ J_ki_num-=1
                    if J_ki_last_alphabet==" ":
                        jump korean_inputer
                $ J_ki_last_alphabet=repr(J_ki_last_alphabet)
                
                $ J_ki_last_alphabet=J_ki_last_alphabet[:-1]
                $ J_ki_last_alphabet=J_ki_last_alphabet[4:]
                $ J_ki_hex=str(J_ki_last_alphabet)
                python:
                    J_ki_dec = "%d" % int(J_ki_hex, 16)
                    J_ki_dec=int(J_ki_dec)
                    J_ki_dec=(J_ki_dec-44032)%588
                    J_ki_dec=J_ki_dec%28
                if J_ki_dec==0:
                    $ this_got_final=None
                else:
                    $ this_got_final=True
                    
                    
                
              
            jump korean_inputer
        $ J_ki_lead=J_ki_button_selection
        $ J_ki_jamo=1
        python:
            for alphabets, unicode_value,type in J_ki_all_korean_alphabets: 
                if J_ki_lead==unicode_value and type==0:
                    J_ki_word_placeholder="[" + alphabets + "]"
    elif J_ki_jamo==1:
        if J_ki_button_selection=="Backspace":
            $ J_ki_jamo=0
            $ J_ki_tail=0
            $ J_ki_vowel=0
            $ J_ki_lead=0
            $ J_ki_word_placeholder=''
            jump korean_inputer
        $ J_ki_vowel=J_ki_button_selection
        $ J_ki_jamo=2
        $ J_ki_word_placeholder= (J_ki_vowel-1)*28 + (J_ki_lead-1)*588 + 44032 
        $ J_ki_word_placeholder=unichr(J_ki_word_placeholder )
        $ J_ki_word_placeholder="["+J_ki_word_placeholder+"]"
    elif J_ki_jamo==2:
        if J_ki_button_selection=="Backspace":
            $ J_ki_jamo=0
            $ J_ki_tail=0
            $ J_ki_vowel=0
            $ J_ki_lead=0
            $ J_ki_word_placeholder=''
            
            jump korean_inputer
        $ this_got_final=True
        if J_ki_button_selection==0:
            $ this_got_final=None
        $ J_ki_tail=J_ki_button_selection
        $ J_ki_jamo=0
        $ J_ki_word_placeholder = J_ki_tail + (J_ki_vowel-1)*28 + (J_ki_lead-1)*588 + 44032 
        $ J_ki_word_placeholder=unichr(J_ki_word_placeholder )
    
        
        $ J_ki_word=J_ki_word+J_ki_word_placeholder
        $ J_ki_word_placeholder='[]'
        $ J_ki_tail=0
        $ J_ki_vowel=0
        $ J_ki_lead=0
    
        
    jump korean_inputer
    
label J_ki_done:
    
    python:
        if J_ki_word[-1]==' ':
            while J_ki_word[-1]==' ':
                J_ki_word=J_ki_word[:-1]
    $ variable=J_ki_word
    # Let the variable you want the name in =J_ki_word
    if this_got_final:
        "Hello, %(variable)s은"
    else:
        "Hello, %(variable)s는"
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: Question about Korean inputer

#3 Post by backansi » Sun May 31, 2009 11:30 pm

oooooohhhhh thanks a lot lol. it works very well :D :D :D
but....... if you don't mind, i'll ask another question. :oops:
is it possible to changing inputer like this?


http://www.youtube.com/watch?v=BuBe3ro4Jt4


well, I can't explain it in english very well so I uploaded video in youtube
the video is about another korean inputer in 'princess maker 2' , korean version.
consonant and vowel are shown at same time, and when vowel is added and if there is a character with final, new character is created.

this is another video

http://www.youtube.com/watch?v=YLaP9-rGn1k

sorry if I'm annoying you :oops:

User avatar
Tomoko
Regular
Posts: 37
Joined: Tue Mar 24, 2009 6:07 pm
Location: Germany, somewhere in NRW
Contact:

Re: Question about Korean inputer

#4 Post by Tomoko » Mon Jun 01, 2009 9:58 am

OOOOOOOOOOOOOOOMMMMMMMMMMMMGGGGGGGGGG!!


Sorry! But I am so excited that there is another (South-)Korean (I guess lol?) here in the Forums! Great :D! 저도 한국사람입니다!
No wonder that you are inspired by the PM Series as I am XD

I think for nonKoreans its kinda hard to explain how the Korean alphabet works. I am not better than you in English I guess although I live in Germany and the English lessons are quite different from the Korean ones.

User avatar
JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Question about Korean inputer

#5 Post by JQuartz » Mon Jun 01, 2009 8:23 pm

backansi wrote:consonant and vowel are shown at same time, and when vowel is added and if there is a character with final, new character is created.
Sorry, but it's beyond my abilities to do so. Maybe you could get someone to edit the korean inputter (you may take full credit for it) or make a new one from scratch.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: Question about Korean inputer

#6 Post by backansi » Tue Jun 02, 2009 12:43 am

Jquartz//Well, then maybe I have to make it. Anyway thanks a lot!! I appreciate your help Jquartz:D



Tomoko// Hi :D i'm very surprised and happy to meet another korean at this Ren'Py board. I guess my poor english grammar skill is very shameful but thanks. you live in Germany? your english is better than me i bet ;_;
Tomoko wrote: I think for nonKoreans its kinda hard to explain how the Korean alphabet works.
umm.. I completely agree with your opinion. And Korean is too difficult to understand to nonkorean how it combinate.
Tomoko wrote: But I am so excited that there is another (South-)Korean (I guess lol?)
and oh yes, i'm south korean lol

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: Question about Korean inputer

#7 Post by backansi » Tue Jul 14, 2009 1:51 am

This is the lastest version of Korean Inputter that I edited.
I already posted it at Cookbook in Ren'py wiki,
but someone could search this forum first to find Korean inputter, so I added it at this topic.
If anyone finds bugs, please tell me.

Korean inputter code in cookbook(click)

edit: deleted a code because I linked the recipe.

This is preview.
koreaninputer.PNG

PETpro
Newbie
Posts: 20
Joined: Wed Jun 24, 2009 1:36 am
Projects: [Working]Seven of Seven ~ Forever ~
Location: Uijeongbu, Gyeonggi-do, South Korea
Contact:

Wooooooow!!!

#8 Post by PETpro » Sun Aug 30, 2009 12:42 am

I did NOT imagine as I translated Ren'py Launcher. O<-<
(렌'파이 구동기 번역했을 뿐인데, 이런 게 뜰 줄이야...)

Even though when I did was a month later...
(뭐, 제가 한 건 한달 뒤의 일이지만요.)

Ah, I'm also Korean as translating the Launcher.
(아, 구동기 번역한 저도 한국인입니다.)
Last edited by PETpro on Sun Aug 30, 2009 11:12 am, edited 1 time in total.
Ren'Py 7 celebration as 'Seven of Seven(Shichinin no NANA) ~ Forever ~'?

User avatar
backansi
Veteran
Posts: 224
Joined: Sun May 31, 2009 7:15 am
Location: Korea, Republic of
Contact:

Re: Solved] Question about Korean inputer

#9 Post by backansi » Sun Aug 30, 2009 4:11 am

Edit: deleted because the contents doesn't connected this thread not at all
Last edited by backansi on Sun Aug 30, 2009 10:59 am, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: Bing [Bot]