Ascii to letter typecasting ?

For questions about using Classic.

Post » Sat Jul 21, 2012 8:53 am

I'm newly started to Consturct2 and I need to typecast an ascii value to letter.For example 65-->A ,I cant find the solution so I need typecasting but I dont know how to do?
B
7
Posts: 8
Reputation: 941

Post » Sat Jul 21, 2012 11:52 am

Bad topic bro -,- this is construct classic topic....
B
24
S
4
G
2
Posts: 318
Reputation: 2,446

Post » Sat Jul 21, 2012 6:24 pm

You could use a dictionary object and make a conversion table. Instead of adding each key,value pair individually I would do it all at once with the "load" action of the dictionary object to load a JSON string.

You could also use javascript to do the conversion. It's a fairly common operation so searching a javascript reference should give a result. You can then use the javascript from C2 with a third party plugin that allows you to call javascript code.
B
79
S
24
G
53
Posts: 4,728
Reputation: 40,219

Post » Sun Jul 22, 2012 6:54 am

Thanks you very much R0J0hound, I learned many new things , thanks . .
B
7
Posts: 8
Reputation: 941

Post » Mon Jan 07, 2013 8:13 pm

I have the opposite problem in Construct Classic. I have to convert one-character strings to their ASCII values; 0 -> 48, A -> 65. How could I do this without having to create dozens of comparation events?
Borka223 from RecGames
B
14
S
4
G
5
Posts: 39
Reputation: 2,987

Post » Mon Jan 07, 2013 9:01 pm

First you would place all the characters in a string, in order to the number you wish to compare, then use GetToken(String, Index, Separator) in a loop.

So basically GetToken(yourString, loopindex, ",")


Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Tue Jan 08, 2013 7:34 am

What if the characters are not separated by anything like "ZXCQWER00001000000959599595995959959590000000ASD" or "1013600163194740998124450345017503431720620090004510408"?
Borka223 from RecGames
B
14
S
4
G
5
Posts: 39
Reputation: 2,987

Post » Tue Jan 08, 2013 8:49 am

Got it! Used a hash table!
Borka223 from RecGames
B
14
S
4
G
5
Posts: 39
Reputation: 2,987


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests