[SOLVE] About Using Text Box & GUIs Button

Started by Arjunaz78, Mon 19/12/2011 03:17:57

Previous topic - Next topic

Arjunaz78

I've search the thread about using textbox..

http://www.adventuregamestudio.co.uk/yabb/index.php?topic=35336.0

The only problem is,i cannot use a word or should i said alphabet that more than one lwhen using Append & Appendchar..

However i can use it if i use a single alphabet such as number ('1') or ('O') or ('u') & ('t')

I use the code as shown below..

Code: ags
function ButtonD1_OnClick(GUIControl *control, MouseButton button)
{
 ButtonD1.Animate(10, 0, 15, eOnce);
  TBDrawing.Text = TBDrawing.Text.Append('Out')
}


and try to use like this..

Code: ags
function ButtonD1_OnClick(GUIControl *control, MouseButton button)
{
 ButtonD1.Animate(10, 0, 15, eOnce);
  TBDrawing.Text = TBDrawing.Text.AppendChar('Out')
}


but the both of codes doesn't work at all..then i get..

GlobalScript.asc(749): Error (line 749): incorrectly terminated character constant


below is the graphic of that GUIs that i use..

http://imgur.com/6gwCU

Did i miss something or make a wrong way? or i can't use it together with .Animate code?

For your information,  'ButtonD1' is a custom GUIs Button at top right position of the picture and TBDrawing is a custom GUIs TextBox and i use the text parser too for that GUI's but the ('Out') word is not the one in text parser lib.
And i don't use Label GUIs instead of Button GUIs.
..In the making of Silent Hill: The Hospital..

https://www.facebook.com/ArjunazGamesStudio

Khris

Looking at the manual entry for String.Append, the example is in there three(!) times: mytext.Append("World");

Note the double quotes: "

Code: ags
  TBDrawing.Text = TBDrawing.Text.Append("Out");

Arjunaz78

Owh..thanks again khris..i didn't notice the different of both codes,it seems the same code style that make me confused, but now i got it..thanks again..  :)
..In the making of Silent Hill: The Hospital..

https://www.facebook.com/ArjunazGamesStudio

Wyz

The difference is that single quotes indicate a single character, and double quotes indicate a character sequence.
They are very different things in the realm of computers so that's why the programming language also makes the distinction. Some don't and allow both quotation styles to be used intermixed so I understand how that can be confusing for some.

If you type 'Out' AGS is expecting a single character, yet you gave three, so it will pick the first one. However that is not what you want, so use "Out" as Khris already pointed out.
Life is like an adventure without the pixel hunts.

SMF spam blocked by CleanTalk