Is there an AGS version of the ASC() function?

Started by LUniqueDan, Wed 03/11/2010 23:42:57

Previous topic - Next topic

LUniqueDan

I'm just trying to return the Letter of an ASCII code.
Something like :
Code: ags

String MyString = ASC(65);


Can't find nothing on the Helpfiles.

help!!
"I've... seen things you people wouldn't believe. Destroyed pigeon nests on the roof of the toolshed. I watched dead mice glitter in the dark, near the rain gutter trap.
All those moments... will be lost... in time, like tears... in... rain."

Wyz

Erm you could do this:
Code: ags

String MyString = String.Format("%c", 65);


or:

Code: ags

String MyString = "";
MyString = MyString.AppendChar(65);
Life is like an adventure without the pixel hunts.

LUniqueDan

Wyz! you're a King.
(BTW I just do that cuz of your Joystick Pluging, so tx :D )
"I've... seen things you people wouldn't believe. Destroyed pigeon nests on the roof of the toolshed. I watched dead mice glitter in the dark, near the rain gutter trap.
All those moments... will be lost... in time, like tears... in... rain."

Wyz

Life is like an adventure without the pixel hunts.

monkey0506

Just for completeness sake if you ever needed the reverse operation (ord) then it's also pretty simple in AGS:

Code: ags
int ord = 'A'; // convert character-literal to ASCII value
char c = 'A';
ord = c; // convert char to ASCII value
String s = "A";
ord = s.Chars[0]; // convert specific character in a String to ASCII value

LUniqueDan

Tx Monkey, it can be also useful if I want the keyboard to stay active instead of the joystick.
"I've... seen things you people wouldn't believe. Destroyed pigeon nests on the roof of the toolshed. I watched dead mice glitter in the dark, near the rain gutter trap.
All those moments... will be lost... in time, like tears... in... rain."

SMF spam blocked by CleanTalk