Home   Help Search Login Register  

Author Topic: Scrollable static dialog text  (Read 5204 times)

0 Members and 1 Guest are viewing this topic.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Scrollable static dialog text
« on: 26 Jul 2007, 22:30:54 »
Edit: attached file and image (dialogbox.jpg) lost in crash of 2009; file has been re-upped here - WEK
« Last Edit: 16 Jan 2011, 02:59:12 by Walter_E_Kurtz »
"When 900 years YOU reach, look as good you will not!"

Offline Igor Drukov

  • Contributing Member
  • **
  • Conscientious Subjector
Re: Scrollable static dialog text
« Reply #1 on: 27 Jul 2007, 00:16:59 »
The idea is to use the UI EventHandler "onMouseZChanged" (see here).


Define the answers in a listbox, and retrieve the second argument of what the EH returns.


Simpler than words, see my example mission attached (I couldn't be bothered to center the controls because I ripped them from one of my own dialogs).


Hope that helps!



Igor.



Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Scrollable static dialog text
« Reply #2 on: 28 Jul 2007, 12:50:56 »
Hey there.

Now, I downloaded your example, and it spawned a black screen with a dialog that had three options, t_0, t_1 and t_3. It did indeed scroll when I used the mouse wheel, which was nice. But it wasn't exactly what I was looking for, unless I've misunderstood something :D Thank you anyway.

I have now amended by .jpg file by using the incredible powers of Paint to better illustrate what I need ^^

Basically, I'd like to be able to have a slider-thing that allows me to have more text than what fits in the little screen and read it, and then I'd like the PC questions in the bottom dialog to not be cut off if they go outside the box, but continue on the second line. That make any more sense?  :)

Hm. I'll go tinker on this by myself as well. There must be some solution!

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Scrollable static dialog text
« Reply #3 on: 28 Jul 2007, 13:54:33 »
Finally I did understand your problem  :whistle:

You have two options as minimum there:
1 - use HTML controls for each "reply", so you may write what you want there without cutoffs (same as with briefing.html).
2 - use structured text controls in the same way.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Scrollable static dialog text
« Reply #4 on: 28 Jul 2007, 21:59:43 »
Pardon for being so oblique earlier, luckily my picture speaks more than a thousand words. Or what-you-have it. :)

As to your answer, I'm afraid I'll have to quote myself:
Quote
I know practically nada about about dialog making, barely enough to fake it
I've tried messing around with the basic talk.sqf which is used by the Dynamic Dialog system, but damned if I can make the ctrlSetText [idc, string] into a _control ctrlSetStructuredText parseText "text". It just says "expected control, type number" or the like. Isn't the only way to refer to a control via the IDC (which in this case is 100)? Does the description.ext somehow need to be drastically changed to cater for Structured Text? And I still don't think this really solves the problem with no slider.

(relevant part of talk.sqf. it is fed from a pre-made global variable containing arrays which have all the strings and such in them, PC and NPC. Highlighted is the part I'd like to turn into 100 ctrlSetStructuredText parseText _speechArray select 0)

Code: [Select]
if (_dlgOK) then
{
while {!((_speechIndex == -1) or !(ctrlVisible 100))} do
{
_speechArray =_speechFile select _speechIndex;
lbClear 101;
[b]ctrlSetText [100,(_speechArray select 0)];[/b]
if (_speechArray select 1 != "") then
{
_speechUnit say (_speechArray select 1);
};
_lbArray = _speechArray select 2;
{_x call SOW_FillListBox} forEach _lbArray;

waitUntil {((SOW_DialogButtonOK) or !(ctrlVisible 100))};
SOW_DialogButtonOK = false;
_speechIndex = lbValue [101,lbcursel 101];
_speechAction = lbData [101,lbcursel 101];
if (_speechAction != "") then
{
call _speechAction;
};
};
closedialog 1;
} else
{
closeDialog 2;
};

Likewise the problem with the text being cut off, using lbAdd [idc, string] it refuses to accept Structured Text (as far as I can see), simply displaying nothing when attempted. Is there something for listBoxes which is a bit like the CT_MULTI control...thing...that allows for multiple lines? I've never really found a good explanation for how stuff like that works anyway. Mwah.

(here's the relevant part of the fillListBox.sqf, which you can see is called by the above script. Once again the place which refuses to take Structured Text is in bold)

Code: [Select]
_lbText = _this select 0;
_lbNewIndex = _this select 1;
_lbAction = _this select 2;
_curLBIndex = 0;

[b]_curLBIndex = lbAdd [101, (_lbText)];[/b]

lbSetValue [101, _curLBIndex, _lbNewIndex];
lbSetData [101, _curLBIndex, _lbAction];
lbSetCurSel [101, 0];

I -can- solve the first problem (too much "reply" text from NPC) by adding some kind of "page one", "page two" option (like underneath the topmost text) and splicing up the text and whatnot, but that sort of...makes things complicated. However if that is what I have to do then that's what I'll do. Argh. :( Dialog-editing...*thinks wistfully about 1.46 pre-dialog editing and all this other weird stuff*

Apologies for not making much sense, but I'm out in deep waters here, I'm afraid.  ???

I am such a noob.  :D
Thank you for trying to help anyway!

Wolfrug out.

"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Scrollable static dialog text
« Reply #5 on: 03 Aug 2007, 03:47:34 »
Annoyingly, I just wrote a similar dialog system for myself and had exactly the same problems as you are having. So much for looking hard enough to find the script someone had already written *sighs* Well, I learned some things and my version suits my purposes better.

As far as wrapping the answers, you could use a multi or structured text and handle the mouseclicks manually by setting an event handler on the control (rather than using a non-wrapping button or active text). Still, though, since you can't measure the length of a string or the amount of space used in a multi/structured area, in the end you are down to deciding whether 1 or 2 or 3 lines, or whatever, is enough for you.

Listboxes are entirely stuck with one line as far as I can tell. No way around that that I've ever seen in real GUI toolkits, so no reason to suppose BIS would have done it better. One way to tackle the problem would be to manually chop up your answers if needed. E.g. if you had 2 actual answers, one of which required 2 lines, you could do this...
Answer 1: Hello!                                             => goto A
Answer 2: I want to talk to you about                => goto B
Answer 3: the price of fish.                               => goto B

The best way, I think, to deal with long npc statements is to split it into multiple speech parts. Thus, you would see how much you could fit in the box manually and you would cut it into multiple seperate messages, all but the last of which being given only one player reply, which would be "[More...]". This is the way I did it in the end in my conversation thing.

Both those solutions wouldn't need the dialog package to be edited, which is only a good thing ;P
Quote from: wolfrug
I've tried messing around with the basic talk.sqf which is used by the Dynamic Dialog system, but damned if I can make the ctrlSetText [idc, string] into a _control ctrlSetStructuredText parseText "text". It just says "expected control, type number" or the like. Isn't the only way to refer to a control via the IDC (which in this case is 100)? Does the description.ext somehow need to be drastically changed to cater for Structured Text? And I still don't think this really solves the problem with no slider.

The thing is that ctrlSetText takes an idc, which is the ID number (type number) of the control to affect. ctrlSetStructuredText takes an actual control (type control) rather than just an ID. You need to findDisplay using the dialog's idd (type number) to get a display (type display), then use displayCtrl to find the specific control (type control) you want within that display.

Code: [Select]
// Not tested.
_display = findDisplay MY_DIALOG_IDD; // You'd need to look up the IDD of the dialog in the hpp.
_control = _display displayCtrl 100;
_control ctrlSetStructuredText (parseText "text");
« Last Edit: 03 Aug 2007, 11:38:13 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Scrollable static dialog text
« Reply #6 on: 05 Aug 2007, 12:28:06 »
Much obliged Spooner! And I know the feeling, I was on the verge of delving into the scary world of dialog-making as well before I found out about this already in-place system. Anyway, having thought about it while waiting for an answer, I came to pretty much the same conclusion as you. However I'd very, very much like to have a slightly more...I don't know...integrated solution.

Say, for instance, a button underneath the text which would say something like "Page 2", and would only be clickable if you've given the script at least two separate bodies of text. Would require some editing of the script through, I guess, but I'd very much like for people to be able to move back and forth in the text at will. Then again, the whole [More] thing for now seems the easiest solution.  :good:

Thanks for the hint on the Structured Text - I'll try that as soon as I get back home from my trip and back to ArmA ^^

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Scrollable static dialog text
« Reply #7 on: 05 Aug 2007, 12:36:00 »
Well, the way I've implemented my dialog would allow for [more] and [back] to be added by the user, though it would be a little fiddly. I'll certainly consider adding it to the standard features, now that you've brought it up. I'm hoping to release my version in a general pack of integrated scripts (including stuff like shopping and banking) very soon. Although I'm happy to release betas to my clan, I'm still reticent to release to OFPEC/BI; I imagine it is always hard to leap over that precipice...
« Last Edit: 05 Aug 2007, 12:39:11 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline CrashDome

  • Members
  • *
Re: Scrollable static dialog text
« Reply #8 on: 10 Aug 2007, 19:48:09 »
Hi Wolfrug!

I was very surprised to see this script resurface! It is very powerful but has few applications in this type of game! I like to see other people are interested in bringing it to ArmA.

In OFP, the text would scroll with a scroll bar on the NPC area. I am not sure why ArmA it does not, must be something they added (ability to turn off/on scroll bars maybe)?

The text in the response area never was able to "wrap" and thus the responses had to be short. This was an OFP limitation with the listbox that you could not work around.

Since I haven't kept up with dialogs, I cannot say what you need to do, but I can say how it worked in OFP and what the limitations were there.

Finally, I would like to revisit this project and add many new features capable in ArmA (like keyboard support, better response area, etc..) but I do know that BIS basically borrowed my idea and there exists commands that seem to be almost the same in structure to SOW Dynamic Dialogs (kbTell, kbAdd, etc..) so I think it might become an official part of the game. If it doesn;t arrive soon, I may beat them to the punch with an updated version though! In fact, if you check the wiki for Game 2 you will see a screenshot that has something like that shown on the screen.

Offline Cold

  • Members
  • *
  • Mission Maker
Re: Scrollable static dialog text
« Reply #9 on: 16 Apr 2008, 04:23:35 »
I've got a question about this dialog... first off I am so happy someone converted it to use in ARMA. I tried about a month ago just using the old dialog "as is" in ARMA - and the rest is history.... any how. I've read through the many dialog tutorials at this site, and have even modified this script to suit my needs... but I can still not get it to do what I need. Here's what I DO need...

"Brak" [whose name will be changed in the mission] needs to start his conversation off with Sergeant, we're lucky we found you! SLA reinforcements are inbound. We need to get you out of here. We have a concealed camp a few kilometers from here where you can hide, or we can take you back to your forward operating base.

Whereas the player now needs two choices... which in turn each will activate a seperate script. Choosing Let's get to your camp will activate a script taking the player and his rescue squad to the RACS camp I have specified in the script... unless the player chooses I need to get back to my base which will start a seperate script taking the player and his rescuers to a different base... I just can't get the menus worked out... any help?

Here is the "BrakTalk.sqf" located in the demo mission that I am trying to manipulate.

Code: [Select]
private ["_structure"];

_structure = [];

comment "Array consists of [ AI unit text response, [Array of user responses] ] for each dialog 'page' or 'set' ";
comment "Array for user responses consists of [text, which page to go to next (or -1 to end), {scripted action} ]";
comment "Speech Set 0";
_structure = _structure +
[[
"Hi everybody! I'm Blip! eep! eep! eep!","Talk1",
[
["Do you know any jokes?",1,{}],
["Would you like some coffee?",2,{}],
["Goodbye...",-1,{}]
]
]];

comment "Speech Set 1";
_structure = _structure +
[[
"A guy walks into a restaurant and says....","Talk2",
[
["Would you like some coffee?",2,{}],
["Goodbye...",-1,{}]
]
]];

comment "Speech Set 2";
_structure = _structure +
[[
"No thank you, I cannot drink coffee because it makes me jittery.","Talk3",
[
["Do you know any jokes?",1,{}],
["Goodbye...",-1,{}]
]
]];

_structure
A leader is best when people barely know he exists, when his work is done, his aim fulfilled, they will say: we did it ourselves. <br />Lao Tzu

Offline Rommel92

  • Members
  • *
Re: Scrollable static dialog text
« Reply #10 on: 16 Apr 2008, 05:41:51 »
Code: [Select]
["Would you like some coffee?",2,{}],It would appear you place script files like so:
Code: [Select]
["Would you like some coffee?",2,{player exec "blah.sqs"}],Hope this helps.  :P

Offline Cold

  • Members
  • *
  • Mission Maker
Re: Scrollable static dialog text
« Reply #11 on: 16 Apr 2008, 06:34:17 »
Well, I had figured that out... but my problem is that anytime I even run the default dialog, it seems to skip past the "Hi everybody! I'm Blip! eep! eep! eep!" and go straight to "A guy walks into a restaurant and says....". I haven't done anything to cause that, but it's going to be a real problem when it chooses the answer for the player instead of them choosing themselves.
A leader is best when people barely know he exists, when his work is done, his aim fulfilled, they will say: we did it ourselves. <br />Lao Tzu