MODULE: NBD Custom Dialog v1.0 - Testers, anyone?

Started by Phemar, Mon 13/05/2013 22:43:51

Previous topic - Next topic

Phemar

Q. What is this?

A. It's a module for a custom dialog GUI modeled after LucasArt's games. But more importantly, it does a bunch of cool things. It's non-blocking (which means you can interact with hotspots during a dialog), and it addresses a bunch of things from the bug and suggestion tracker.

Q. What does NBD stand for?

A. It's an acronym, and acronyms are COOL.

Q. How's this different to the other dialog module out there?

A. This one doesn't use any of AGS's built-in features for rendering dialog windows. That means it doesn't block the script while it's running.

Q. That doesn't sound so special, what else does it do?

A. Oh shush you. Here, take a look at this:

Q: Can I run an individual dialog option using this module?

A: Why yes you can! Just use the RunOption (int option) command.

Q. Does this module have the ability to keep the dialog GUI visible while the conversation plays out?

A. Of course it does! This module is designed to be like LucasArt's dialog system, which it means it works well for games that have a GUI that takes up permanent screen space.

Q. Can I set the color the options are highlighted in?

A. You can do that too! Just #define NBD_SELECT_COLOR in the module header.

Q. Do I have the option of turning off the startup option?

A. That option is available too! Just run your dialog with the argument eNBD_DontPlayStartup.

Q. Are the options scrollable? Can I have like, arrow buttons on my GUI?

A. You sure can! This dialog GUI is designed to be a fixed width and height, which means that it NEEDS to be scrollable.

Q. Does this module provide me with the power of AGS's normal script editor, which isn't available in the dialog script editor?

A. Since all your dialog scripts will be written in a separate module, you can have ALL THE POWER of the normal script editor!

Q. Can I set font the options are displayed in, and can I change it at a later stage if I wanted to?

A. Oh you, of course you can do that. Since the options are displayed as labels on a GUI, you can just set the label's font to whichever you choose!

Q. Alright, I guess that does sound pretty cool. Where can I get it?

A. RIGHT HERE!

If anyone wants to do some more testing on please feel free! I think I've alpha tested as much as I can and while I can quite positively say there shouldn't be any kinks, some always manage to creep out of nowhere.

Secret Fawful

I just want to say thank you very much for this module. It presents a lot of neat gameplay possibilities, and I'm glad people are making things like this possible with the engine. Keep up the great work.

Ghost

I am Ghost and this is my favourite Dialog Module on the Interwebs!

Seriously, great job! I'll test it a lot more, but it already looks like a remarkable asset to me. Thank you for sharing!

[edit]
Two things:

* I am pretty sure I set up everything right but I can't get the scrolling to display (it works, though): Clicking the scroll buttons scrolls, but the lines only update AFTER I select a conversation line and have the talking happen.

* The documentation is very thorough and covers everything, the example dialogs, however, require two characters that are not "in game" and I think a newcomer would be able to easily spot what they need to be named (cDeath especially). Maybe a small additional info about how to get the example dialog to display, OR an actual template that has the diolog as a "feature presentation"?

Phemar

#3
That's an interesting problem, Ghost. I'll definitely have a look at it when I get a chance, either later tonight or tomorrow. I did upload this demo, which combines the module with non-blocking speech, but I'll do a proper open-source demo soon!

Edit: I just read the documentation, which seems to be a bit out of date. You shouldn't call ScrollDown on the gui, but instead call it on the struct itself.

So use
Code: ags
NBD.Scrolldown;


instead of
Code: ags
gDialog.NBD_ScrollDown;


I refactored the code before releasing it and I guess I forgot to change the documentation. I don't know if this will solve the problem. If it doesn't, can you clarify and explain exactly what is going wrong? I'm not sure I understand exactly from your post.

Ghost

Quote from: Phemar on Sat 15/06/2013 15:40:51
So use
Code: ags
NBD.Scrolldown;

instead of
Code: ags
gDialog.NBD_ScrollDown;


Perfect, that solved it! Thanks!

Phemar

#5
Great, that's awesome! I really should update the documentation.

Anyway, let me know if you have any other feature requests.


Edit: Documentation updated, hope things are a lot clearer now.

monkey0506

First things first, thanks for having readable code. It means a lot to me. I mean, you inject random blank lines in the middle of functions for no reason whatsoever, but I mean, at least I can read it.

I wanted to note though, there are some opportunities for generalization that I think would help improve this module. As an example, I don't understand why you opted to use a macro for label coloring versus a structure property. The latter would be of relatively equal simplicity to implement, but would give the end-user a customization opportunity that is presently missing. If you're worried about encapsulation, you could always use attributes instead of raw members.

Phemar

#7
Quote from: monkey_05_06 on Tue 18/06/2013 02:26:37
First things first, thanks for having readable code. It means a lot to me. I mean, you inject random blank lines in the middle of functions for no reason whatsoever, but I mean, at least I can read it.

Readable code is very important to me too :D Yea I do put a lot of whitespace in my code, but my mind processes code 10x faster when everything's separated, so it's just a stylistic choice. If you look carefully you'll notice that similar/related lines are grouped together.

Quote from: monkey_05_06 on Tue 18/06/2013 02:26:37
I wanted to note though, there are some opportunities for generalization that I think would help improve this module. As an example, I don't understand why you opted to use a macro for label coloring versus a structure property. The latter would be of relatively equal simplicity to implement, but would give the end-user a customization opportunity that is presently missing. If you're worried about encapsulation, you could always use attributes instead of raw members.

You're probably right about the label coloring. I just figured label coloring would be a constant, so that's why I used a macro but I guess I can see that people might want it to be dynamic.

As for encapsulation, I literally only picked up this whole programming thing about a month or two ago so I'm not really sure what that means. I took about a week's worth of Java in high school seven years ago but dropped it after a week so I'm still quite new to the whole thing. Everything's a learning experience though!

I'm still getting used to the whole nomenclature and vernacular of everything.

Edit:
Things I've realized are missing from this module:
1. Text wrapping - needs to be added in a future release.
2. Option to sort the options bottom to top.
4. Option to change whether one remaining option is automatically spoken or not.
5. Auto numbering of options.
6. Option to set whether options that have been selected dim/change color.

None of which should be too hard to implement.

monkey0506

#8
In fact, #2, 4, 5, and 6 should read directly from the editor settings. First three are GetGameOption, last one is game.read_option_color or something like that. Actually 6 may not have an editor setting per se, but using the built-in method should be preferred where available (IMO). I noted and appreciate that your module was able to take advantage of Dialog.GetOptionText, something that wasn't available back in the days of AGS 2.62 when my scrollable dialog code became my first contribution to the community. Ah, the good old days. ;)

Encapsulation is a programming idiom to protect the integrity of your data structures. In AGS this is done through attributes, which is how practically every built-in struct property is implemented. Internally it leads to a function call when you get or set a struct member, so you can validate the new values being set, array index, etc. (as applicable). If you'd like, I'm highly interested in discussing some of the technical details with you (perhaps an IM client would be more fitting for that).

kconan

  Just want to say thanks for making this, as I'm currently in the market for a flexible dialog system.  8-)

Phemar

Ah Monkey, yes, reading the options set in AGS is way easy, but the code that actually implements those options would still need to be added. Remember my module doesn't use any of AGS's dialog rendering functions. Essentially all it is is labels on a GUI with, as you said, GetOptionText and GetOptionState. Then it just runs RunOption from the Script File with the appropriate parameters.

So basically everything needs to be handwritten if it is to be implemented.

Pierrec

This is EXACTLY what I was looking for, and it works EXACTLy how I was hoping for. Thank you so much!

daneeca

Hi Guys!
I'm new in the forum, and I tried to use this module. I did everything I think, but I got an error message:

"There were compilation errors. See the output window for details."

"Failed to save room room1.crm; details below
NBD.ash(290): Macro 'NBD_MAIN_GUI' is already defined"

I wrote the "#define NBD_DIALOG_GUI gDialog" command under the comments in the NBD.ash header. Is it good that way?
I use AGS 3.4.0.6 Alpha.

Thanks for help.
PS: Sorry for my bad english :$

SMF spam blocked by CleanTalk