I tired to use list boxes but they were only letting me have text that would fit on 1 line.
I could use lots of text labels in a dialog but that would take a very long time since there's going to be thousands of labels (probably)
List boxes are the only way to have scroll-wheel functionality. You don't have to use the built in version, though. Create your own list box template in the UI module, with an empty frame inside it. Use triggers to create an instance of this list box template, then hookup the inner frame and use create in panel to add contents.
considering there is going to be hundreds of different sentences do you really think that would be the best idea?
You should definatly make sure that there is some sort of limit in text displayed, for two reasons:
1. There is a max text length for a label
2. Having a label with lots of text on the screen actually causes an FPS loss (Even if not all of the label is visible!)
I think the best solution would be MasterWraths list box template holding a label and then using script to make sure the text within the label doesnt get to long, for example by using an array where each field represents a new message.
New messages would be inserted at index 0 while all other messages within the array would be moved one field index up, causing the oldest message to get cut off.
(Obviously you would use a loop for this, its just a demonstration of the concept)
After that, you set the value of index 0 to the newest message, like this:
messages[0] = "A new message";
Now, to update the label within the scrollpane, just have a function that combines all strings within the array to one big string which can be put into the label. Array indexes can be seperated by adding the newline escape sequence </n>.
Hmmm... My first attempts to make a working custom list box template have failed. Hoping somebody else knows how to do this. I will probably try again later.
I just whipped one up, it's a bit different in how it works. The text scrolls by itself, sort of like how Diablo II's scrolling text worked. This is an already finished up thread, but hey, might as well post it! Maybe someone will get use from it.
The demo of the map (if you run it) shows whatever you type in scroll in 4 different ways (Scroll Down and Scroll Left with two styles of both). The styles are as follows:
Scroll: Text will scroll through the dialog, without stopping, and dissapear after it has scrolled entirely through to the other side.
Scroll Into View: Text will scroll unitil it reaches the point where the entire text fits into view, and then stop. It will then wait for a moment and then dissapear.
4 Action definitions in this demo:
Scroll Text Horizontal
Scroll Text Vertical
Scroll Text Into View Horizontal
Scroll Text Into View Vertical
You can have the text scroll up, down, left or right, in both of the previously mentioned styles. For the scroll into view functions, you can specify how long the text will linger after it has made it into view (Specified in seconds by a Real parameter).
If there is too much text to fit into the dialog, you may have to break up the message into multiple Text Scrolls.
Hope someone gets some use from this!
EDIT: Hah, seems like I just kind of missed the point with my version: My browser wasn't letting me play the game, so I just assumed that you meant what I had posted. Lol, regardless.. I guess it's here now! Sorry for the irrelevance!
Is it possible to make a text box similar to the one in this game?
http://adarkroom.doublespeakgames.com/
I tired to use list boxes but they were only letting me have text that would fit on 1 line.
I could use lots of text labels in a dialog but that would take a very long time since there's going to be thousands of labels (probably)
thanks
Or you could create one giant text label and set it to the text + text label. Eventually you will hit the limit though, but it will be doable.
One way would be to check how many msgs are sent and then don't send anymore.
Set everything in variables, like text[1] = hi text[2] = lol
That way you can set the text label to text[1]+text[2] and it would be hi lol
@DogmaiSEA: Go
considering there is going to be hundreds of different sentences do you really think that would be the best idea?
@Ownag3666: Go
List boxes are the only way to have scroll-wheel functionality. You don't have to use the built in version, though. Create your own list box template in the UI module, with an empty frame inside it. Use triggers to create an instance of this list box template, then hookup the inner frame and use create in panel to add contents.
You should definatly make sure that there is some sort of limit in text displayed, for two reasons:
1. There is a max text length for a label
2. Having a label with lots of text on the screen actually causes an FPS loss (Even if not all of the label is visible!)
I think the best solution would be MasterWraths list box template holding a label and then using script to make sure the text within the label doesnt get to long, for example by using an array where each field represents a new message.
New messages would be inserted at index 0 while all other messages within the array would be moved one field index up, causing the oldest message to get cut off.
@Mille25: Go
This is sounding very complicated now heh.
Would it be possible for an example so I can get the idea and work from there?
Lets say you wanted your message box to always display the 3 latest messages.
To achieve that you could have a string array of size 3:
string messages[3];
Now, each time a new message is sent, you move all existing messages within the array 1 index up, like this:
messages[2] = messages[1];
messages[1] = messages[0];
(Obviously you would use a loop for this, its just a demonstration of the concept)
After that, you set the value of index 0 to the newest message, like this:
messages[0] = "A new message";
Now, to update the label within the scrollpane, just have a function that combines all strings within the array to one big string which can be put into the label. Array indexes can be seperated by adding the newline escape sequence </n>.
@Mille25: Go
ugh I've tired to get this to work all day but I just can't figure it out :\
If you're not busy could you post an example screenshot please?
Could you be a little bit more specific about your problem?
@Ownag3666: Go
I myself am actually working on something similar, so I'll post a demonstration sometime tonight.
Hmmm... My first attempts to make a working custom list box template have failed. Hoping somebody else knows how to do this. I will probably try again later.
@Mille25: Go
Basically the entire thing. I'm having trouble converting your text into the triggers ;_;
In that case you should start with beginner scripting tutorials before attempting to create a custom message box.
There should be quite a few trigger editor guides here on the forums, some even in video format! :)
Here you go. I'm looking forward to your text based adventure game.
It's a crude system I worked for fun, just now. It doesn't look too bad.
EDIT: Just realized this can be useful for putting up a compact README in games. Glad I worked on something useful for my own.
PS: Set Dialog Item Style allows you to pick your listbox's font. Just look for the fonts with a prefix of MOD to find easily comprehensible styles.
(C) Vicboy
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
Did I help?
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
@Vicboy: Go Sorry been a bit busy.
Works perfectly, I'll credit you when it's finished.
@Ownag3666: Go
Glad to have helped!
Member since 2010. Made the -The Thing- [Revival] game. Nostalgic of the WC3 days.
I just whipped one up, it's a bit different in how it works. The text scrolls by itself, sort of like how Diablo II's scrolling text worked. This is an already finished up thread, but hey, might as well post it! Maybe someone will get use from it.
The demo of the map (if you run it) shows whatever you type in scroll in 4 different ways (Scroll Down and Scroll Left with two styles of both). The styles are as follows:
4 Action definitions in this demo:
You can have the text scroll up, down, left or right, in both of the previously mentioned styles. For the scroll into view functions, you can specify how long the text will linger after it has made it into view (Specified in seconds by a Real parameter).
If there is too much text to fit into the dialog, you may have to break up the message into multiple Text Scrolls.
Hope someone gets some use from this!
EDIT: Hah, seems like I just kind of missed the point with my version: My browser wasn't letting me play the game, so I just assumed that you meant what I had posted. Lol, regardless.. I guess it's here now! Sorry for the irrelevance!