OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: ponq on 02 Jul 2004, 22:00:59

Title: Multiple text lines in Control (Dialog)
Post by: ponq on 02 Jul 2004, 22:00:59
I'd like to have a text of more than 1 line in a text control in a dialog.
I've tried to /n or \n, but to no avail. Also the ctrl is set to multiline, but doesn't seem to make a difference.


Also, can I have scrollbars in the text ctrl (or attached/linked to it), so the player can scroll up and down the read all the text of the ctrl.

Any1 know how to do it?
Title: Re:Multiple text lines in Control (Dialog)
Post by: Planck on 02 Jul 2004, 22:04:49
There is a dialog tutorial in the Editors Depot.......by VectorBosun I think.


Planck
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 02 Jul 2004, 22:13:42
I know. Couldn't find what I need there.
Maybe you know how to?
Title: Re:Multiple text lines in Control (Dialog)
Post by: Planck on 02 Jul 2004, 22:17:27
If I remember correctly someone also did an addition to VectorBosons tutorial to cover bits that weren't covered.

I'll have a look and see if I can find it.


Planck
Title: Re:Multiple text lines in Control (Dialog)
Post by: dmakatra on 02 Jul 2004, 22:25:23
1) A guy that called himself crashnburn or summin like that made a function just what you want. Try contacting him (he's registred on the forum) and ask him if he wants to release the function the the ed depot function library.
2) Dunno, you can do it other ways like pressing a "Next Page" button or summin.

:beat: *Gets Shot* :beat:
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 02 Jul 2004, 22:28:01
I'll try to contact him, thnx.

Having a next page isn't really what I want.
I'm trying to show some kind of conversation in a dialog, with text added to the conversation over time. The new text should at the first line of the ctrl, the old text right below.
But if the player wants to read the old text, he could scroll down...well that's the idea.

My first question is more important though, so I'll see if CnB know something about this.
Title: Re:Multiple text lines in Control (Dialog)
Post by: dmakatra on 02 Jul 2004, 22:31:18
Dude, that's exactly why I know about this function. He realesed a dialog script, and I asked him if I can modify it for my own use to make it more advanced. He said sure. I'll see if I can dig it up, would still be better if we could contact CnB first though.

:beat: *Gets Shot* :beat:
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 02 Jul 2004, 22:32:44
great!  ;D

PM sent.
Title: Re:Multiple text lines in Control (Dialog)
Post by: dmakatra on 02 Jul 2004, 22:38:24
I'm afraid he hasn't been on the forums for ages, try e-mailing or his Mod Forum. BTW, his mod looks really cool.

:beat: *Gets Shot* :beat:
Title: Re:Multiple text lines in Control (Dialog)
Post by: Planck on 02 Jul 2004, 22:41:45
OK......In case you still wanted to know.......

The other dialog tutorial is called 3D Dialog Tutorial and is by Igor Drukov.


Planck
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 02 Jul 2004, 22:46:09
Thanks Planck.
I also have "studied" that one already.
Title: Re:Multiple text lines in Control (Dialog)
Post by: CrashnBurn on 03 Jul 2004, 02:34:01
Sorry you guys but I don't have any knowledge of this. It must be someone else you're thinking of, or, I'm really getting old....  :-\
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 03 Jul 2004, 10:43:30
Armstrong, could it be some1 else made that nice function you referred too? Or is there any chance you could find it on your HD somewhere?
Title: Re:Multiple text lines in Control (Dialog)
Post by: dmakatra on 03 Jul 2004, 11:44:29
Very sorry!! I meant a guy called Crashdome and his mod is Sinews of War. Hope I didn't sceared you up Crashnburn. :P

:beat: *Gets Shot* :beat:
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 03 Jul 2004, 11:50:46
np ;)

email sent to him now.
Title: Re:Multiple text lines in Control (Dialog)
Post by: CrashDome on 03 Jul 2004, 20:19:00
Hello everyone,


Armstrong: Thanks for the comments!

Ponq: Multiline dialog ctrls are very limited in ofp. Only the textbox can be multiline and there are no scroll bars that I am aware of. Even if you use pages, you will have to manually set the length of each page as you cannot determine a count of characters in a string and break it up programmatically.

I did write a dialog that resembles something like old RPG games where the top portion is a multiline textbox of talking and the lower portion is a listbox of single line responses you can make. Check it out at http://www.crashdome.net/ofpsx (http://www.crashdome.net/ofpsx)
No need to register just click on the anonymous link to access the files.

To summarize what you need to get a multiline text box (in case you do not want to download my dialog and browse through it:

in the description.ext file define a textbox class like so:
Code: [Select]
class multiTextBox
{
   type = CT_STATIC;
   idc = -1;
   style = ST_MULTI;
   colorBackground[] = <any color you want>;
   colorText[] = <any color you want>;
   font = <any font you want>;
   sizeEx = <height of each line - 0.025 is a good start but try and match the font so it is not fuzzy>;
   linespacing = 1.0;
   text = "";
};

Create the actual textbox as a control:
Code: [Select]
   class myTextBox : multiTextBox
   {
      idc = 100;
      text = "";
      x = 0.0625; y = 0.3625; w = 0.875; h = 0.25;
   };

Then, to get your text into the textbox, you will need to use a single string in a script to set the text (or write it into the description.ext directly if it never changes)
Here is an example:

Code: [Select]
ctrlSetText [100, "Here is an example of a multiline text box, blah, blah. I can write text and keep going and going and going..."]
The text will be displayed and it will break wherever it wants. "\n" doesn't work and you will be stuck with however it looks. To fine tune, you will need to maybe add spaces to the text to get it to look right - or adjust the size of the box.


Edit: forgot a "   :)
Title: Re:Multiple text lines in Control (Dialog)
Post by: ponq on 03 Jul 2004, 20:53:04
Thanks for your reply!

I guess I have to accept there's no decent line-breaks in ofp-dialogs ;)

LOL at your demo mission btw
Title: Re:Multiple text lines in Control (Dialog)
Post by: CrashDome on 03 Jul 2004, 23:28:31
Glad I can (still) help!   ;D