Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: LUniqueDan on Wed 03/11/2010 23:42:57

Title: Is there an AGS version of the ASC() function?
Post by: LUniqueDan on Wed 03/11/2010 23:42:57
I'm just trying to return the Letter of an ASCII code.
Something like :

String MyString = ASC(65);


Can't find nothing on the Helpfiles.

help!!
Title: Re: Is there an AGS version of the ASC() function?
Post by: Wyz on Wed 03/11/2010 23:51:24
Erm you could do this:

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


or:


String MyString = "";
MyString = MyString.AppendChar(65);
Title: Re: Is there an AGS version of the ASC() function?
Post by: LUniqueDan on Thu 04/11/2010 00:07:45
Wyz! you're a King.
(BTW I just do that cuz of your Joystick Pluging, so tx :D )
Title: Re: Is there an AGS version of the ASC() function?
Post by: Wyz on Thu 04/11/2010 00:34:49
Lol! thanks, and you're welcome!  ;D
Title: Re: Is there an AGS version of the ASC() function?
Post by: monkey0506 on Thu 04/11/2010 00:46:00
Just for completeness sake if you ever needed the reverse operation (ord) then it's also pretty simple in 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
Title: Re: Is there an AGS version of the ASC() function?
Post by: LUniqueDan on Thu 04/11/2010 12:13:26
Tx Monkey, it can be also useful if I want the keyboard to stay active instead of the joystick.