How do I convert a character to ASCII

0 favourites
  • 12 posts
From the Asset Store
2d mushroom sprite 2d game mushroom character enmy sprite game art
  • how can i convert a character to Ascii and vice versa ?

    i really need that ,it would save my week because if i don't find a solution i would spend the next week doing it manually.

    any help please ?

  • I guess this link can help...?

    picascii.com

    Or do you mean during runtime in Construct 2...? Is yes, I'd probably have one textfield replace the corresponding sprite at the same coordinate...

  • http://stackoverflow.com/questions/9403 ... javascript

    Add the browser object and use these expressions to convert over and back.

    Browser.ExecJS("'"& char & "'.charCodeAt(0)")

    Browser.ExecJS("String.fromCharCode("& ascii &")")

  • stackoverflow.com/questions/94037/convert-character-to-ascii-code-in-javascript

    Add the browser object and use these expressions to convert over and back.

    Browser.ExecJS("'"& char & "'.charCodeAt(0)")

    Browser.ExecJS("String.fromCharCode("& ascii &")")

    thank you i will try that now , i know about execute js in the browser object but never thought to you it :3

  • I guess this link can help...?Or do you mean during runtime in Construct 2...? Is yes, I'd probably have one textfield replace the corresponding sprite at the same coordinate...

    thats not what i'm looking for , but thanks man! yes i need it in runtime ,

  • let me tell you why i need it you might suggest me easy solution to my problem, i hade problem with Android keyboard when it shows it scales my page down and make it very small , but i some element are important i need them to still looks big , generally i don't want the page to scaldown. i couldn't figure out how to fix that . so i decided to make my own costum keyboard , i wanted to make buttons for the keyboard but you can't text from button unless you use values don't forget each button have many layers ( i mean lower case , uppercase and special character ) so picking up a value and changing the button text each time isn't a good idea , i thought to make the buttons as sprites, and make 3 different animations for it ( lower case , apper case and special character) i used animations not frame because it have text name while frames uses numbers , so each time you touch the sprite gives you the animation name , and i will name the animations like ( char_91 ) a special text followed by the ascii code of the character shown in the animation then i will remove (char_) , why i use ascii ? because you can't name the animaton with special characters unless you name the button's animation like ("doublecotes") then make text replace and replace that part with doublecotes and that would be a pain to make a special action for each button .

  • stackoverflow.com/questions/94037/convert-character-to-ascii-code-in-javascript

    Add the browser object and use these expressions to convert over and back.

    Browser.ExecJS("'"& char & "'.charCodeAt(0)")

    Browser.ExecJS("String.fromCharCode("& ascii &")")

    it works man , thank you very much ^^

  • Oooooh sorry man - I read "character" as a "person" (character <=> sprite), I see now that you meant character as in abcd... d'oh! That certainly changes everything! ^_^

  • Is there still no native Ascii Code > Char and back? R0J0hound - unfortunately the browser-exec functions crash construct now.

    Am trying to make a touch keyboard and thought the most elegant way to make it work would be by animation frame (+65 for Capital letters )

  • JohnnySix

    Someone could make a plugin i suppose, but using exec javascript still works here. What's the error? If you open up the browser console you should see what the javascript error is. However copy pasting what I posted here works fine.

  • I think I was missing something - got it working now - have uploaded an example if anyone wants to use ( ascii number set by animation frame to return character in string ) :

    demo: http://johnnysix.net/games/qwerty_touch/

    download : http://johnnysix.net/games/qwerty_touch.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hey guys , thank you for the replies , this was a long time ago , and i had to create a virtual keyboard in construct .

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)