Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: EnterTheStory (aka tolworthy) on Tue 04/01/2011 17:15:30

Title: GetTranslation - can it translate pointers?
Post by: EnterTheStory (aka tolworthy) on Tue 04/01/2011 17:15:30
My translated games work fine, except for this code:
function rm(String st) // used for finding room numbers from names
{ if(st ==GetTranslation("London streets"))        return 3;

How it works is this: if a hotspot has the name of a room (e.g. "London streets" is room 3) the game can use "rm(name)" to return its room number. I also list room names in an array of recently visited rooms. This works fine in English, but in other languages it breaks. So I tried this:
function rm(String st) // used for finding exits from names
{ if(st ==GetTranslation("London streets"))        return 3;

But get the following error:
misc code.asc(369): Error (line 369): Type mismatch: cannot convert 'String*' to 'string'
Any suggestions?
Title: Re: GetTranslation - can it translate pointers?
Post by: Khris on Tue 04/01/2011 17:33:34
Try this:

  if(st.CompareTo(GetTranslation("London streets")) == 0)        return 3;
Title: Re: GetTranslation - can it translate pointers?
Post by: EnterTheStory (aka tolworthy) on Tue 04/01/2011 17:46:05
Brilliant! It works! I am forever in your debt.