GML Implementing Textboxes

W

WinuX

Guest
Hello everyone,

I have a really hard time to decide how to implement my textboxes. The textboxes as such work perfectly fine, but how to implement them in objects etc is the problem here.
So, I have currently have 2 methodes I could use.

The first one would be to make a certaint amount of objects and use them like this:
upload_2017-7-28_1-59-53.png
as you can see there are 2 objects with nearly the same code in it. the object will be placed above certain objects in game like a picture of a cat or a table. like here(the red things are solids):upload_2017-7-28_2-11-43.png
When it gets activated it will run a script that opens a new dialouge instance and gives it text with another script. in the first object the text will be "A picture of a cat" in the second it will be "Just a table.".

With this method I can use the object in mulitple rooms but I need a new object for every dialouge that going to happen in the room. It's also really confusing if you have 10 triggers with nearly the same code in it.

The second Method would be having 1 object and creating the dialoug with the creation code, but I don't know if thats all that good.

Which of these Methodes would be the best or are there other better methodes?

Thanks for coming answers^^
And also, im sorry for my bad english it's not my native language(I'm Swiss). if something is not understandable please let me know :D
 

BLang

Member
Normally, whenever I have to do anything similar to this, I'd use creation code to set the text for the textbox. Doing this, I don't need nearly as many objects, so the project tree is much cleaner. Doing it with separate objects may seem manageable at first, but what happens when you have 10000 lines of dialogue and have to make adjustments to a level layout? Are you gonna go through a list of all 10000 dialogue objects to find the right one?
 
W

WinuX

Guest
Normally, whenever I have to do anything similar to this, I'd use creation code to set the text for the textbox. Doing this, I don't need nearly as many objects, so the project tree is much cleaner. Doing it with separate objects may seem manageable at first, but what happens when you have 10000 lines of dialogue and have to make adjustments to a level layout? Are you gonna go through a list of all 10000 dialogue objects to find the right one?
Yeah, but I will never have 10000 object when i use them like above. because when you look at the code you see that i check for a room so i can place the object in many diffrent rooms, but the problem is when I have 50 dialouges in 1 room I need 50 objects. but yeah, then i will probably use creation code.

btw. i don't have 10000 lines of dialouge i just use such a high number in the switch because i have ranges for the dialouge like 0-100 is debug stuff etc... ;D
 

BLang

Member
Yeah, but I will never have 10000 object when i use them like above. because when you look at the code you see that i check for a room so i can place the object in many diffrent rooms, but the problem is when I have 50 dialouges in 1 room I need 50 objects. but yeah, then i will probably use creation code.

btw. i don't have 10000 lines of dialouge i just use such a high number in the switch because i have ranges for the dialouge like 0-100 is debug stuff etc... ;D
Still, having one object is easier than having to sort through 50 objects!

It's just the way I would go about it, but most of the time, there's no real right way of doing something. You just have to determine what's the most comfortable for you to work with and what's best for your game. If this is the way you're comfortable doing things, and you know that it's manageable for you, then go for it! In the end, all that matters is the final product, and how you get there is completely irrelevant for the most part.
 
W

WinuX

Guest
Still, having one object is easier than having to sort through 50 objects!

It's just the way I would go about it, but most of the time, there's no real right way of doing something. You just have to determine what's the most comfortable for you to work with and what's best for your game. If this is the way you're comfortable doing things, and you know that it's manageable for you, then go for it! In the end, all that matters is the final product, and how you get there is completely irrelevant for the most part.
Yeah thats true. I have decided to use creation code it's really the simplest and the most manageable methode.

Thanks for helping :D
 
Top