Jump to content

I read the manual thiny, and I dont get this buffer text thingy


Recommended Posts

What kind of code can you put into print_str_color()? You can either put a single literal ("Hi everybody!"), or a string CONSTANT, but not both.

 

You can't append anything to the constant, and the literal must be given in its entirety. There is no flexibility in this regard, but the buffer calls can at least allow you to append a mix of strings and numbers together, and then you can dump the buffer into a string, which is the only time when you can change the string constant.

Link to comment
Share on other sites

Quote:
Originally written by Keep:
What kind of code can you put into print_str_color()? You can either put a single literal ("Hi everybody!"), or a string CONSTANT, but not both.

You can't append anything to the constant, and the literal must be given in its entirety. There is no flexibility in this regard, but the buffer calls can at least allow you to append a mix of strings and numbers together, and then you can dump the buffer into a string, which is the only time when you can change the string constant.
Okay, HOW do I do that? I don't understand how to use the buffer.
Link to comment
Share on other sites

Did you read the section in the appendix on string manipulation? It's pretty self-explanatory. Basically the text buffer just gives you a way to do some really nifty things with string variables to customize text output.

 

For instance, you could do something like this:

 

Code:
code =   if (species_in_party(3) == 1) { // If there's a slith in the player's party      while (get_species(char_number) != 3) { // Cycle through PC's to identify the slith        char_number = char_number + 1;      }      clear_buffer(); // Prep the buffer by emptying it out      append_string("Bob frowns at "); // Add this text into the buffer      append_char_name(char_number); // Tack the slith PC's name onto the end of the text above      append_string(". _And that includes you._"); // Add this text after the PC's name      get_buffer_text(char_addressed); // Assigns all the text we just made to variable char_addressed      message_dialog("_I don't deal with sliths._",char_addressed); // Displays the first text in a dialog, followed by the buffer text we just created   }break;
So the final result is, if the player has a slith named Ssschah in his party, the text the player sees in the dialog will now read:

 

"I don't deal with sliths." Bob frowns at Ssschah. "And that includes you."

 

In this example, we've used the text buffer to "build" a custom chunk of text using a literal and a constant, which is something that would be impossible to do without the string manipulation calls and the text buffer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...