Displaying info in a dialog

Interesting mapping tools and mapping help.

Moderator: Morax

Displaying info in a dialog

Postby EntropyWins » 29 Oct 2017, 06:42

I want to display some info to the payers without using a bunch of PrintText calls.

I stumbled upon CreateDialogue which at first glance seems great. It gives me a box to put the info in, and the box can have a close button so the user can get rid of it if they don't want to see it.

It seems like dialogs have a problem with multi line text though, at least if the text is long. The following code shows a dialog with messed up text:

Code: Select all
local d = CreateDialogue([[a kinda long is line that is kinda long ish
MJHAU]], {"Close"}, "right")


Text shown:

a kinda long is line that is kinda long is
MJHA


The first line is missing some stuff in the center and the last letter and the second line misses the last letter. Kinda bizzare behavior.

I've also been trying to change the dialog width, to no avail. One thing I tried was more text on the button, though this just leads to the text spilling out of the button rather than the thing resizing >_>

Anyone know how to display info to the players in a decent way, preferably one where they can choose to hide it?
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Displaying info in a dialog

Postby speed2 » 29 Oct 2017, 10:54

So I assume you're trying to display something from the sim-side (script)?

This bug with missing letters should be fixed in the next patch (you can try it in the faf develop mod)

Else this is currently the only way to to display text from sim instead of ugly printtext.

Some time ago I was trying to display a text like in the missions, just without the video. It was somehow working, just the duration after it should collapse again was bit random and I didn't manage to finish it.

This is the UI-side code for this dialogue https://github.com/FAForever/fa/blob/develop/lua/ui/game/simdialogue.lua
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Displaying info in a dialog

Postby EntropyWins » 29 Oct 2017, 23:46

On the sim side yes. This is in a (survival) map script. In maps all code is normally sim right? Any way to have UI code? I actually found the file you linked and tried calling stuff directly as part of my experimentation, though that went nowhere.
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Displaying info in a dialog

Postby speed2 » 30 Oct 2017, 09:36

Yes script is sim, and you cant call directly functions from UI. This is how it works https://wiki.faforever.com/index.php?ti ... Sim_and_UI

So you cant alter functions in UI from the map script. You would need a mod for that.
User avatar
speed2
Contributor
 
Posts: 3189
Joined: 05 Jan 2013, 15:11
Has liked: 636 times
Been liked: 1119 times
FAF User Name: speed2

Re: Displaying info in a dialog

Postby EntropyWins » 09 Dec 2017, 22:08

Since related code was being worked upon and it has been some time since I asked... Is it possible now to display text in a closable dialog from a map script?
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Displaying info in a dialog

Postby EntropyWins » 25 Jan 2018, 03:34

New idea: Is it possible to run mod code "from a map"? So not invoking it from the map script, but having code be invoked as if it was a mod. Basically shipping the mod with the map and automatically including it when it is played? If this is not possible at the moment, perhaps this is something that can be made possible relatively easily, and open up a lot of cool possibilities for map makers?
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Displaying info in a dialog

Postby Franck83 » 31 Jan 2018, 23:00

New idea: Is it possible to run mod code "from a map"? So not invoking it from the map script, but having code be invoked as if it was a mod. Basically shipping the mod with the map and automatically including it when it is played? If this is not possible at the moment, perhaps this is something that can be made possible relatively easily, and open up a lot of cool possibilities for map makers?


Following
Alliance of Heroes Mod is out ! Try it ! It's in the Mod Vault !
User avatar
Franck83
Evaluator
 
Posts: 538
Joined: 30 Dec 2016, 11:59
Location: France
Has liked: 114 times
Been liked: 122 times
FAF User Name: Franck83


Return to Mapping

Who is online

Users browsing this forum: No registered users and 1 guest