How do you do text generation?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Guest

How do you do text generation?

Post by Guest »

So I've been working on some modding and wanted to ask if there is a way to make text generate across a floating object
my only problem is that its an object that will be in players view in game.
It's a textbox the companion brings up to say something when player does something cool, or dies, presses a button, etc. this textbox needs to have text scroll on it as I have made 300 lines for the companion to say. Doing 300 separate textboxes, renaming each, and sorting through them in code would be tedious, so I want a message to show up on it that will go in the parameters of the box. Of course the box goes away a short while after the message is shown. The textbox also needs an option and binded button to be pulled up for a dad joke for the companion to make, and a button to pull it away if it is getting in the way of combat.
've been thinking.... maybe I just need some videos for z scripting in ZDoom decorate.
I have only the smallest idea of how this works
like maybe each phrase contains typed text, and having a script that generates what you typed in on the text box and aligns it on the text box, and each phrase has a name that can be called out to be used because all of these phrases will have an 1 percent chance of happening.
To explain there is also 3 things it will pop up for
A. A good kill streak
B. Player Death
C. Dad jokes (yes there will be a button just for dad jokes)
Dad jokes and player deaths are things that could be set up by themselves as I only need to bind a key for dad jokes and set up a script to have a phrase show up upon death. So basically I guess we would have a template script that picks 1 of 100 of the quotes meant for the event in question, and we would have a script up top that has all the scripting for what triggers the sequence. Then under after all three of those picking scripts are set up below would be the just seas of phrases that mind you are categorized and below the phrases is text alignment and generation scripts. I know a rough outline of how this will work I only know that random pick will take part in this.
Im slowly getting an idea of how I will execute the process of all of these lines popping up its just the text generation I need help with, I have no idea how I will align the text nor how to connect the number from the randompick to the lines and the text box. If anyone can help with that it would be awesome. The textboxes may not be integral and may have to move the entire idea of the lines to it being said in the gz console.
User avatar
Redneckerz
Spotlight Team
Posts: 976
Joined: Mon Nov 25, 2019 8:54 am
Discord: Redneckerz#8399
Graphics Processor: Intel (Modern GZDoom)

Re: How do you do text generation?

Post by Redneckerz »

PSA: This is Goopymonster from Doomworld on this thread: https://www.doomworld.com/forum/topic/1 ... ion-script

I have linked to DECORATE and ACS already, but OP seems to be stuck at the following:
I have no idea how I will align the text nor how to connect the number from the randompick to the lines and the text box. If anyone can help with that it would be awesome. The textboxes may not be integral and may have to move the entire idea of the lines to it being said in the gz console
Perhaps a Community Guide can shine a light upon it.
Jarewill
Posts: 1349
Joined: Sun Jul 21, 2019 8:54 am

Re: How do you do text generation?

Post by Jarewill »

If I understand it currently, you are trying to connect text and a number together, right?
As far as I am aware, DECORATE doesn't have a way to do it.
You can do it with ACS's Print / Log / HudMessage:

Code: Select all

Print(s:"string ", i:number) 
ZScript can also do it with the String.Format() function.

You can emulate RandomPick in ACS like this.
Bananaboii
Posts: 1
Joined: Fri Aug 14, 2020 1:46 pm

Re: How do you do text generation?

Post by Bananaboii »

Jarewill wrote:If I understand it currently, you are trying to connect text and a number together, right?
As far as I am aware, DECORATE doesn't have a way to do it.
You can do it with ACS's Print / Log / HudMessage:

Code: Select all

Print(s:"string ", i:number)
ZScript can also do it with the String.Format() function.

You can emulate RandomPick in ACS like this.
So it looks like this is a way to format text, am I right?

Return to “Scripting”