MODULE: TypedText 1.0.0

Started by Crimson Wizard, Sun 12/02/2017 22:53:14

Previous topic - Next topic

Cassiebsg

Oh. :~(
And I was enjoying seeing the text printed there... (roll)

Hope you can fix it soon, and sorry for being a pain.
There are those who believe that life here began out there...

Crimson Wizard

Sorry, I think it did not work for you because you do not set tt_draw.TextColor, it is black by default, and if your room background is black, that would explain why you do not see anything.

Cassiebsg

#22
Okay, I figured out why it's not working... seems like it can't render over my BG video?
I "removed" the code for the D3D pluging BG video, and now it's working. (nod) Looks really nice too!
Also thanks for the heads up with the TextColor code. :)
Do you think it's possible to render it over the video, like the speech is? If it's not it's okay, I'll just have to work something else out. Or add the text to the rendered video.

EDIT: Also, think you canceled the module too quick, seems to be working just fine, and that it's just my ineptitude to understand the complex code plus my other messy code that was on the way. ;)
Only real needed change, seem to be in your example code, where you typed string s instead of String s. ;)
There are those who believe that life here began out there...

Crimson Wizard

#23
Quote from: Cassiebsg on Fri 10/03/2017 08:44:19
Okay, I figured out why it's not working... seems like it can't render over my BG video?

I don't know; that depends on how this video is rendered, which I never tried out myself. Maybe video gets drawn above text?
If video plugin can somehow return drawing surface of its own, you may draw upon it instead.

You may try using TypedTextOverlay or TypedTextLabel instead of TypedTextDrawing, if you have a possibility to use overlay/GUI in your room.


I will repost the module after I fix some errors and write easier explanation on how to use it.

Cassiebsg

#24
I'll give it a try, can it be a transparent GUI/overlay?

I'm using the D3D plugin by AJA for the video rendering found here: http://www.adventuregamestudio.co.uk/forums/index.php?topic=45348.0
You can probably easily test it your self, if you like, by copy pasting my code into a new game's room, and just replace the video filename with any other ogv movie you might have laying around.

EDIT: No, text gets drawn over the video. At least the speech text does. Had no problem rendering the TextSay over it.

EDIT2: Okay, tried it with a GUI, I imported the footline code from your demo to test, and edited the lines relating to sounds out.
I got it to sorta work. It seems it can render over the video. (nod) Only it doesn't run while the speech is running. (wrong) So, I only get the first line rendered once I hit the start button on the main menu, and my second video starts. ??? Then the next comes first after the game has started (controling the character in a non-blocking way). So my guess right now is, the GUI lbl won't uptade if it's blocked.

Haven't tried overlay yet, since I have never used overlays before, meaning that it's even a bigger mystery for me. (roll)

EDIT3: Now I'm even more confuse... works even in blocked mode, but still not over my first video. This is weird, since the code is the same for both videos, is it not? ??? (EDIT4: And now I'm at a loss... put my 1st video on the cutscene_start and then I get the text typed... with the cutscene_Intro it doesn't run... what is different? ??? )

EDIT5: Okay, got it working with a GUI! :-D :-D :-D Now I just need to change the lines to display my text and fine tune it! (nod)
Thanks, and sorry for being a noob. ;)
And oh, am not sure what was wrong before, I changed 2 things, I moved the NextFootline(); to room_load() and added a variable to fire up my code in rep_exe... which ever of the two "fixes" was, it's working! :-D

EDIT 6: Am I over doing this? Sorry.
Now I'm trying to complicate a simple thing... I am here trying to keep 2 lines on screen, instead of writing one line, clear, and then write a second line. I realized that I can just use the [ to break a line into 2, and I would do that, if I didn't want to use a smaller font on the 1st line and a bigger on the second. (roll)
I've managed to do it, by writing 2 lines simultaneous (though I would prefer to write one at a time), but the first line is still removed before the second. Is there a simple setting I can change, or this is not possible without some complicated rewrite?
There are those who believe that life here began out there...

Crimson Wizard

#25
Quote from: Cassiebsg on Fri 10/03/2017 10:04:17
EDIT 6: Am I over doing this? Sorry.
Now I'm trying to complicate a simple thing... I am here trying to keep 2 lines on screen, instead of writing one line, clear, and then write a second line. I realized that I can just use the [ to break a line into 2, and I would do that, if I didn't want to use a smaller font on the 1st line and a bigger on the second. (roll)
I've managed to do it, by writing 2 lines simultaneous (though I would prefer to write one at a time), but the first line is still removed before the second. Is there a simple setting I can change, or this is not possible without some complicated rewrite?


If you want to have 2 different fonts then you will have to use 2 different objects, because right now TypedTextDrawing does not support changing font when typing, and Labels, Buttons and Overlays do not support multiple fonts on their own (and my module cannot make them do). So yes, you will need 2 Labels and TypewriterLabel objects, linked to each other. You actually did that, if I understand right?

If you want first line to stay you need to tell it not to clear text at all, or keep it for a long time. That depends on what function you use to run it.

If you are manually managing TypewriterLabel, then simply do not call "Clear" function for it.

If you are using Label.Typewriter extender function, then I realized that I did not provide option to keep it forever until you say to remove it, but there is a trick you can use: when you set up its properties with TypewriterPreset.SetGeneral, last parameter is "reading time". Simply set that reading time to some very big number (you may actually do same if you are using TypewriterLabel object yourself).

Cassiebsg

#26
Yes, I'm actually using 6 labels in the GUI, because I wanted the text to be displayed in different places on screen, and thought it would be easier to print each line to a new label... (roll)
I'm pretty happy the way it's working now, except for the top label with the smaller font and the bottom label with the bigger font are printed at the same time.
I would love it to print the fist line, not clear the line, then type the second line, and then clear the two lines simultanoues when I move to print line 3 and 4.

I tried to figure where the clear was in the code, but failed to see it. :-[

Here's the code I'm currently using:
Code: ags

#define footline_TYPEWRITER_PRESET 1

String footlines[];
int footline_count;
int footline_index;
int footline_tw;

function game_start()
{
  footline_count = 7;
  footlines = new String[footline_count];
  footlines[0] = "A fan game by     [";
  footlines[1] = "Sandra T. Almeida [";
  footlines[2] = "Made with             [";
  footlines[3] = "Adventure Game Studio [";
  footlines[4] = "based on the original TV show: [";
  footlines[5] = "Battlestar Galactica           [";
  footlines[6] = " ";
  footline_index = 0;
  footline_tw = NO_TYPEWRITER;
  
  //lblTypedText1.TextColor = 64960;
  //lblFootline.Font = eFontGalactican;
  lblTypedText1.Text = "";
  lblTypedText1t.Text = "";
  lblTypedText2.Text = "";
  lblTypedText2t.Text = "";
  lblTypedText3.Text = "";
  lblTypedText3t.Text = "";
  
  TypewriterPreset.SetGeneral(footline_TYPEWRITER_PRESET, 2, 4, eTypedDelay_LongSpace, 10);
  //TypewriterPreset.SetCaret(footline_TYPEWRITER_PRESET, 2, 4, eTypedCaret_Explicit, " ");
  //AudioClip *type_clips[] = new AudioClip[3];
  // type_clips[0] = aKeyboard;
  //type_clips[1] = aKeyboard2;
 // type_clips[2] = aKeyboard3;
 // TypewriterPreset.SetSoundArray(footline_TYPEWRITER_PRESET, type_clips, 3, null, aKeyboard_beep);
}

void NextFootline()
{
  if (!playingCredits)
  {
    if (footline_tw != NO_TYPEWRITER)
    {
      TypewriterRunners.Cancel(footline_tw);
    }
  }
}

function repeatedly_execute_always()
{
  if (!playingCredits)
  {
    if (footline_tw != NO_TYPEWRITER)
    {
      if (!TypewriterRunners.IsActive[footline_tw])
        footline_tw = NO_TYPEWRITER;
    }
    if (footline_tw == NO_TYPEWRITER)
    {
      if (Game.DoOnceOnly("1st intro line")) 
      {
        lblTypedText1t.Font = eFontOptimus;
        footline_tw = lblTypedText1t.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
        //lblTypedText1="";
        footline_index++;
        footline_tw = lblTypedText1.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      }
      else if (Game.DoOnceOnly("2nd intro line")) 
      {
        lblTypedText1t.Text="";
        footline_tw = lblTypedText2t.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
        footline_index++;
        footline_tw = lblTypedText2.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      }
        else if (Game.DoOnceOnly("3rd intro line")) 
      {
        lblTypedText2t.Text="";
        footline_tw = lblTypedText3t.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
        footline_index++;
        footline_tw = lblTypedText3.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      }
      footline_index++;
      if (footline_index == footline_count || footlines[footline_index] == null)
      {
        lblTypedText3.Text="";
        footline_index = 6;
      }
    }
  }
}


The label ending in t is the top line with the smaller font.

But don't go out of your way if making it work slightly different is too much of a pain. It's just a little fine tune to make it 1% better (in my eyes, that is). (laugh)

EDIT: Fixed the indent... seems like the forum doesn't like my copy/pastes from the editor (I'm using tab for indent there...)
There are those who believe that life here began out there...

Crimson Wizard

#27
The first error in this script is that you are remembering all typewriter indexes in same variable, and since some of them run simultaneously or have to stay on screen for some time, it gets overwritten every time and you loose control over previous ones.
Also, you are starting two lines at the same time, that's why... they are typing at same time.

Instead of "int footline_tw" you need "int footline_tw[N]", where N is the number of labels you have, or at least the number of simultaneous typewriters, whichever is more convenient.

As I mentioned earlier, you need to set read time to some big number to prevent automatic removal of a text.

Code: ags

TypewriterPreset.SetGeneral(footline_TYPEWRITER_PRESET, 2, 4, eTypedDelay_LongSpace, 1000); // notice 1000


The code may look something like:
Code: ags

function repeatedly_execute_always()
{
  if (footline_tw[0] == NO_TYPEWRITER) // first typewriter was not started yet
  {
    if (Game.DoOnceOnly("1st intro line SMALL FONT"))
    {
      // start first line
      footline_tw = lblTypedText1t.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      footline_index++;
    }
  }
  if (footline_tw[0] != NO_TYPEWRITER && !TypewriterRunners.IsActive[footline_tw[0]]) // first typewriter has started and finished typing
  {
    if (Game.DoOnceOnly("1st intro line BIG FONT"))
    {
      // start second line 
      footline_tw[1] = lblTypedText1.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      footline_index++;
    }
  }
  if (footline_tw[1] != NO_TYPEWRITER && !TypewriterRunners.IsActive[footline_tw[1]]) // second typewriter has started and finished typing
  {
    if (Game.DoOnceOnly("2nd intro line SMALL FONT"))
    {
      // Remove first two lines
      TypewriterRunners.Cancel(footline_tw[0]);
      TypewriterRunners.Cancel(footline_tw[1]);
      // Start third line
      footline_tw[2] = lblTypedText2t.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      footline_index++;
    }
  }
  if (footline_tw[2] != NO_TYPEWRITER && !TypewriterRunners.IsActive[footline_tw[2]]) // third typewriter has started and finished typing
  {
    if (Game.DoOnceOnly("2nd intro line BIG FONT"))
    {
      // start fourth line 
      footline_tw[3] = lblTypedText3.Typewriter(footlines[footline_index], eNoBlock, footline_TYPEWRITER_PRESET);
      footline_index++;
    }
  }

  // and so on...
}


There should be more optimal way to do this, but my brain is not working well right now.

Cassiebsg

#28
Yes, I knew why they were writing simultaneous, just not how to stop the first line from being removed. ;)
I'll give a try, and thanks bunch for the help and the module! (nod)


EDIT: Been trying this but now the second line (or any other after the 1st) never starts... :( Not sure what I did wrong, probably the arrays?
There are those who believe that life here began out there...

Crimson Wizard

Quote from: Cassiebsg on Sat 11/03/2017 14:06:46
EDIT: Been trying this but now the second line (or any other after the 1st) never starts... :( Not sure what I did wrong, probably the arrays?

Can you post your current code again?

Cassiebsg

#30
Sure, though it's quiet a mess atm, since I started testing other ways in the hopes to figure this out.

Code: ags


#define introline_TYPEWRITER_PRESET 2

String introlines_Small[];
String introlines_Big[];
int introline_Small_count;
int introline_Small_index;
int introline_Big_count;
int introline_Big_index;
int introline_Big_tw[1]; // Number of typewriters
int introline_Small_tw[1]; // Number of typewriters

function game_start()
{
  introline_Big_count = 4;
  introlines_Big = new String[introline_Big_count];
  introlines_Big[0] = "Sandra T. Almeida [";
  introlines_Big[1] = "Adventure Game Studio [";
  introlines_Big[2] = "Battlestar Galactica           [";
  introlines_Big[3] = " ";
  introline_Big_index = 0;
	
	
  introline_Small_count = 4;
  introlines_Small = new String[introline_Small_count];
  introlines_Small[0] = "A fan game by     [";
  introlines_Small[1] = "Made with             [";
  introlines_Small[2] = "based on the original TV show: [";
  introlines_Small[3] = " ";
  introline_Small_index = 0;
	
  introline_Big_tw[0] = NO_TYPEWRITER;
  introline_Small_tw[0] = NO_TYPEWRITER;
  
  //lblTypedText1.TextColor = 64960;
  //lblintroline.Font = eFontGalactican;
  lblTypedText1.Text = "";
  lblTypedText1t.Text = "";
  lblTypedText2.Text = "";
  lblTypedText2t.Text = "";
  lblTypedText3.Text = "";
  lblTypedText3t.Text = "";
  
  TypewriterPreset.SetGeneral(introline_TYPEWRITER_PRESET, 2, 4, eTypedDelay_Mixed, 200); // long reading time so it stays on screen
  //TypewriterPreset.SetGeneral(introline_TYPEWRITER_PRESET, eTypedDelay_Mixed, 20); // long reading time so it stays on screen
  //TypewriterPreset.SetCaret(introline_TYPEWRITER_PRESET, 2, 4, eTypedCaret_Explicit, " ");
  //AudioClip *type_clips[] = new AudioClip[3];
 // type_clips[0] = aKeyboard;
  //type_clips[1] = aKeyboard2;
 // type_clips[2] = aKeyboard3;
 // TypewriterPreset.SetSoundArray(introline_TYPEWRITER_PRESET, type_clips, 3, null, aKeyboard_beep);
}

void NextIntroline()
{
	/*if (!playingCredits)
	{
		if (introline_tw[0] != NO_TYPEWRITER)
		{
			TypewriterRunners.Cancel(introline_tw[introline_index]);
		}
		if (introline_tw[1] != NO_TYPEWRITER)
		{
			TypewriterRunners.Cancel(introline_tw[introline_index]);
		}
	}*/
}

function repeatedly_execute_always()
{
	if (!playingCredits)
	{
    /*if (introline_tw[0] != NO_TYPEWRITER)
    {
      if (!TypewriterRunners.IsActive[introline_tw[0]])  
			{
				introline_tw[0] = NO_TYPEWRITER;
			}
    }
    else if (introline_tw[1] != NO_TYPEWRITER)
		{
      if (!TypewriterRunners.IsActive[introline_tw[1]])  introline_tw[1] = NO_TYPEWRITER;
    }*/
		//if (introline_tw[0] != NO_TYPEWRITER && !TypewriterRunners.IsActive[0]) gHelp.Visible=true;
		
		if (introline_Small_tw[0] == NO_TYPEWRITER) // first typewriter was not started yet
		{
			player.SayBackground("test");
			if (Game.DoOnceOnly("1st intro line SMALL FONT"))
			{
				// start first line
				introline_Small_tw[0] = lblTypedText1t.Typewriter(introlines_Small[introline_Small_index], eNoBlock, introline_TYPEWRITER_PRESET);
				introline_Small_index++;
			}
		}
		if (introline_Small_tw[0] != NO_TYPEWRITER && !TypewriterRunners.IsActive[0]) // first typewriter has started and finished typing
		{
			if (Game.DoOnceOnly("1st intro line BIG FONT"))
			{
				// start second line 
				introline_Big_tw[0] = lblTypedText1.Typewriter(introlines_Big[introline_Big_index], eNoBlock, introline_TYPEWRITER_PRESET);
				introline_Big_index++;
			}
		}
		/*if (introline_tw[1] != NO_TYPEWRITER && !TypewriterRunners.IsActive[introline_tw[1]]) // second typewriter has started and finished typing
		{
			if (Game.DoOnceOnly("2nd intro line SMALL FONT"))
			{
				// Remove first two lines
				TypewriterRunners.Cancel(introline_tw[0]);
				TypewriterRunners.Cancel(introline_tw[1]);
				// Start third line
				introline_tw[2] = lblTypedText2t.Typewriter(introlines[introline_index], eNoBlock, introline_TYPEWRITER_PRESET);
				introline_index++;
			}
		}
		if (introline_tw[2] != NO_TYPEWRITER && !TypewriterRunners.IsActive[introline_tw[2]]) // third typewriter has started and finished typing
		{
			if (Game.DoOnceOnly("2nd intro line BIG FONT"))
			{
				// start fourth line 
				introline_tw[3] = lblTypedText3.Typewriter(introlines[introline_index], eNoBlock, introline_TYPEWRITER_PRESET);
				introline_index++;
			}
		}*/
		if (introline_Big_index == introline_Big_count || introlines_Big[introline_Big_index] == null)
		{
			lblTypedText3.Text="END";
			introline_Big_index = 4;
		}
	}
}


Even tried to test that the code was detecting the introline_tw[0] != NO_TYPEWRITER && !TypewriterRunners.IsActive[0] by opening a GUI, but instead of opening the GUI after it finished typing, it opened it immediately after the 1st letter was written. ???
Also tried to separate the lines into Small and Big, but didn't helped either.

If I put 1000 in the reading delay, it'll hang forever in the 1st line and never start the second, as it is now, it's still writing both lines at the same time.

EDIT: Any help here? I've also tried now to create 2 different typewriters (but module seems to ignore this, and use the last line as setting for both lines), by separating the #Define, made one for the small and one for the big, created 2 lines of TypeWriterPreset, one for the small and one for the big... yet I still only get the same result.  ???
It's like it doesn't really detect when the first line is done writing, and thus only starts writing the next once the first is removed from screen. Wich results if I put 10 in the reading speed it types the first, removes it and then writes the second line. If I put 1000, like you suggest, it writes the 1st line and will never write the second line before the sequence is over.  8-0

Also tried variants on the second if condition and still all I get is either both at the same time, or the 2nd after the 1st got removed.  :~(
There are those who believe that life here began out there...

Crimson Wizard

#31
My suggestion does not work because IsActive returns true until automatic typewriter clears text, and you do not need the text to be cleared until some other time.
You could use timer instead to know when start next typewriter.

But I think best way for now is to use one manual typewriter and just switch label it prints on. This will leave text on previous label until you explicitly tell it to clear.

Code: ags


String introlines[];
int introline_index;
int introline_count;
bool playingCredits;

TypewriterLabel twl;
 
function game_start()
{
  introline_count = 7;
  introlines = new String[introline_count];
  introlines[0] = "A fan game by     [";
  introlines[1] = "Sandra T. Almeida [";
  introlines[2] = "Made with             [";
  introlines[3] = "Adventure Game Studio [";
  introlines[4] = "based on the original TV show: [";
  introlines[5] = "Battlestar Galactica           [";
  introlines[6] = " ";
  introline_index = 0;
  
  lblTypedText1.Text = "";
  lblTypedText1t.Text = "";
  lblTypedText2.Text = "";
  lblTypedText2t.Text = "";
  lblTypedText3.Text = "";
  lblTypedText3t.Text = "";
  
  twl.TypeDelayMin = 2;
  twl.TypeDelayMax = 4;
  twl.TypeDelayStyle = eTypedDelay_Mixed;
  twl.TextReadTime = 5;
}
 
function repeatedly_execute_always()
{
        if (!playingCredits)
        {
                if (twl.IsActive)
                  twl.Tick();
          
                if (introline_index == 0) // typewriter has not start to type the first line yet
                {
                        // start first line
                        twl.TypeOnLabel = lblTypedText1t;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 1 && twl.IsIdle) // typewriter finished typing first line
                {
                        // start second line 
                        twl.TypeOnLabel = lblTypedText1;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 2 && twl.IsIdle) // typewriter finished typing second line
                {
                        // clear previous
                        lblTypedText1.Text = "";
                        lblTypedText1t.Text = "";
                        // start third line 
                        twl.TypeOnLabel = lblTypedText2t;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 3 && twl.IsIdle) // typewriter finished typing 3rd line
                {
                        twl.TypeOnLabel = lblTypedText2;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 4 && twl.IsIdle) // typewriter finished typing 4th line
                {
                        // clear previous
                        lblTypedText2.Text = "";
                        lblTypedText2t.Text = "";
                        twl.TypeOnLabel = lblTypedText3t;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 5 && twl.IsIdle) // typewriter finished typing 5th line
                {
                        twl.TypeOnLabel = lblTypedText3;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 6 && twl.IsIdle) // typewriter finished typing 5th line
                {
                        // clear previous
                        lblTypedText3.Text = "";
                        lblTypedText3t.Text = "";
                        twl.TypeOnLabel = null;
                        twl.Clear();
                }
        }
}


Cassiebsg

#32
Oh, cool! Thanks for the reply!  (nod)

I'll go ahead and test it right now! If it works I can finally start writing all the credits text.  :-D

EDIT: Cool! It's working!  :-D  :-D  :-D
Gave me an error though on another part of the code, so I'll have to figure it out, and hopefully I can figure it out without having to bother you again.  (nod)

EDIT2: Okay, I managed to solve it, but had to remove this last line at the end twl.Clear();, as it was causing a null pointer reference.
Though, seems to be working just fine without the line.  (nod)

EDIT3 : I moved on to make a credits section (new script, with all introline changed to creditline, and the typewriter is now called twlC, only I can only run the credits once.  8-0 If I put the twl.Clear(); I get the null pointer reference at the end, if I remove it I get the null pointer reference at the start or the second run of credits.  8-0
Think I'll try and see if I can put the line someplace else, outside rep_exe_always and see if that helps.  (roll)

EDIT4: I noticed, after doing a search for the function, that IniFile also had a void Clear()... I changed the name of it, and that solved the problem of the null pointer reference.  :-D
There are those who believe that life here began out there...

Crimson Wizard

Quote from: Cassiebsg on Sun 26/03/2017 19:10:51
EDIT3 : I moved on to make a credits section (new script, with all introline changed to creditline, and the typewriter is now called twlC, only I can only run the credits once.  8-0 If I put the twl.Clear(); I get the null pointer reference at the end, if I remove it I get the null pointer reference at the start or the second run of credits.  8-0
Think I'll try and see if I can put the line someplace else, outside rep_exe_always and see if that helps.  (roll)

EDIT4: I noticed, after doing a search for the function, that IniFile also had a void Clear()... I changed the name of it, and that solved the problem of the null pointer reference.  :-D

Wait wait... what? Are you saying there is a bug that having two same functions in two types of objects may lead to error when calling it?

TBH I was sure twl.Clear() was causing errors because I did "twl.TypeOnLabel = null;" just before that, and Clear uses TypeOnLabel reference without checking if its null.

Cassiebsg

#34
Guess that's what I'm saying?
At least after I changed the name, the error stopped and all is running just fine.

I was a little more surprised that the AGS allows two void/function be called the same in game. I thought it would complain if the name had already been used.

EDIT:

Ermmm... it's me again...
Is it possible to type more than one line in the same label? First I tried to do something like:

Code: ags

  introlines[4] = "based on the original TV show: [ 
                           Battlestar Galactica           [";


But it complains with a : undefined symbol 'Battlestar' ...  8-0
I thought that as long as the " was open, it would not complain with such a thing.  :-\ Putting it all into one long line, works up to the point when there's no more space and AGS breaks the line, and then I'm back to the above problem...
Is there maybe an append command? so that the next line starts typing after the previous? Right now if I do

Code: ags

                else if (introline_index == 4 && twl.IsIdle) // typewriter finished typing 4th line
                {
                        // clear previous
                        lblTypedText2.Text = "";
                        lblTypedText2t.Text = "";
                        twl.TypeOnLabel = lblTypedText3t;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 5 && twl.IsIdle) // typewriter finished typing 5th line
                {
                        twl.TypeOnLabel = lblTypedText3;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }
                else if (introline_index == 6 && twl.IsIdle) // typewriter finished typing 6
                {
                        twl.TypeOnLabel = lblTypedText3;
                        twl.Start(introlines[introline_index]);
                        introline_index++;
                }



It will type the text on label 3, and then clear it and type the next text on the label.

So right now, I'm thinking that the only option is to make a label for each line?  8-0 ??? Sounds a bit over kill though.  :-\
There are those who believe that life here began out there...

Crimson Wizard

#35
Cassie, you keep adding updates to the same post after WEEKS, and I do not notice them in time: the main forum page does not display "new posts" icon in this case, so I don't check the thread.

I went here just by luck, because there was a new post in another module topic.


Regarding your question, for some reason AGS script editor does not support multiline strings. You do this instead:
Code: ags

String s = "Some string";
s = s.Append("Longer string");
s = s.Append("Even more longer string");

Cassiebsg

#36
Okay, thanks for the help.  (nod)

Sorry about the editing thing... just not that easy to figure out when it's okay to double post and when it's not.  :-[
And since I found out that it does indeed show "new" in the post topic after an editing, I thought that should then be good enough.
I too would love these "edit new" to show up in the "Show unread posts since last visit." As I often also miss edited posts.

But don't worry, I wasn't getting desperate or anything. Had decided that I could probably solve this by adding a couple more labels, and just add as much in one line as possible.

EDIT: Just saying it works!  (nod) Thanks bunch. Now I just need to format the text so it looks nice.  ;)
There are those who believe that life here began out there...

Aaron Best

Hi,

I'm trying to utilise this module, however I'm having a slight issue and I'm wondering if anyone can help me?

I'm using the TypewriterLabel function, and have replicated the code above pretty much exactly, however I'm finding that when running the game, the gui label writes out perfectly except for the last word which goes onto a separate line below the rest of the text.

I've tried using different labels of different sizes but it always seems to be the case.

any ideas?

Cassiebsg

Well, you could post the code so we can see if there's something in there causing the line break.

In the mean time, I would say make sure the label is wide enough to fit the text, just try and give it a few pixels more to the sides and see if that helps.
check that you do not have a [ before the last word. Try to add a space to the end of the line, after your last word.
There are those who believe that life here began out there...

Crimson Wizard

#39
Yes, the first guess will be that you have '[' character in the string which is used as a linebreak in AGS.

On a side note, I realized there is a functionality limitation in this module that it cannot handle "escaped" linebreaks, e.g. "\\[" will still break line, although it must print '[' character (it does in common functions like Display(...)).

SMF spam blocked by CleanTalk