Curious Artila 20eyes Posted July 20, 2004 Share Posted July 20, 2004 I have two questions: First, is there any way to use a string variable inside a dialogue as part of the "answer" text (text1, text2, etc.)? Specifically, I'm trying to have an NPC say something in reference to a member of the party who is a slith, and have the NPC use the character's name in the text. Here's what I'm trying (probably in vain) to do: variables; short char_number = 0; string char_addressed; Code: code = if (species_in_party(3) == 1) { while (get_species(char_number) != 3) { char_number = char_number + 1; } clear_buffer(); append_string("The mayor glances uneasily at "); append_char_name(char_number); append_string(". _No offense intended, of course._"); get_buffer_text(char_addressed); print_str(char_addressed); }break; Obviously this is goofy and not much use while in a dialogue, because print_str only outputs to the little text area beneath the play screen, and I get underscores instead of quote marks. My second question is related to the first, but far more stupid: How can I output a variable stored with the get_buffer_text call to a plain old dialogue box? Thanks for any guidance! Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted July 20, 2004 Share Posted July 20, 2004 Um, I haven't tried it, but I think the way to use string manipulation in dialogue is to use the message_dialog call. The call print_str won't do it -- that just prints a line in the text area, which isn't what you want. To use string manipulation in regular dialog boxes, well, you're pretty much there already. Once you've saved the string you want as whatever name you like (I like dlgstr, myself, as a compresssed form of the phrase "dialog string," but obviously you can use anything), just use whatever call you would normally use to set up the dialog. If it's short, it will look like this: Quote: message_dialog(dlgstr,""); or you can get a longer message with add_dialog_str Code: add_dialog_str(0,dlgstr,0); Everything else is the same as what you've already done. The HLPM v1.0.2 has examples of this, in state 20 of the town script for instance, although this version isn't terribly clear. The next version, v1.1, will have comments all over it so you can follow along, and it will be out tomorrow. Link to comment Share on other sites More sharing options...
Well-Actually War Trall Fort Posted July 20, 2004 Share Posted July 20, 2004 I'm not sure if this will work because I don't think you can call this inside of a dialog script since it you don't really script inside it. Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted July 20, 2004 Share Posted July 20, 2004 I don't quite know what Keep is talking about. That's what the "code = " thing is there for. Link to comment Share on other sites More sharing options...
Curious Artila 20eyes Posted July 20, 2004 Author Share Posted July 20, 2004 Thanks Kel, I've managed to beat my poor script into submission using message_dialog() while in dialogue mode. It ain't pretty, but at least now it does what I want it to do. Link to comment Share on other sites More sharing options...
Garrulous Glaahk Yellow Sub Posted July 20, 2004 Share Posted July 20, 2004 Quote: Originally written by 20eyes:Thanks Kel, I've managed to beat my poor script into submission using message_dialog() while in dialogue mode. It ain't pretty, but at least now it does what I want it to do. Try using clear strings() in the code. Then make conditions to show different texts. EX: code = clear_strings(); if (condition 1) { add_string(number of text, text1 - 8. NUMBER ONLY! } if (condition 2) { add_string(same as above) break; Link to comment Share on other sites More sharing options...
Magnificent Ornk Kelandon Posted July 20, 2004 Share Posted July 20, 2004 That won't get you a character's name, GIFTS. Link to comment Share on other sites More sharing options...
Curious Artila 20eyes Posted July 21, 2004 Author Share Posted July 21, 2004 Yeah, been there done that, GIFTS. My original code still contains the remnants of a few failed add_string attempts that are very similar to your suggestion. message_dialog("blahblah",x), I believe, is the only call that can output buffer text *while in dialogue mode* (where x = the buffer text). If anyone knows any different, please correct me! At any rate, my script is humming along nicely now, so it's all good. Now my NPC's can recognize the species of every PC in the player's party and say nifty things like "Aldous, you're a pitiful excuse for a human" and "Trust me, I know a slith fart when I smell one. No more broccoli for you tonight, Ssschah." The fun never ends. Link to comment Share on other sites More sharing options...
Recommended Posts