View Issue Details

IDProjectCategoryView StatusLast Update
0002807The Dark ModGUIpublic17.09.2017 17:26
ReporterSpringheel Assigned ToSteveL  
PrioritynormalSeveritynormalReproducibilityalways
Status closedResolutionfixed 
Product VersionTDM 1.06 
Target VersionTDM 2.04Fixed in VersionTDM 2.04 
Summary0002807: Random GUI quotes not showing during load
DescriptionIn A Score to Settle, I used random loading tips based on the wiki instructions: http://modetwo.net/darkmod/wiki/index.php?title=Loading_Screen_Text

It works wonderfully when loading the mission for the first time, but it doesn't seem to work at all when loading a saved game.


onNamedEvent OnRandomValueInitialised
{
if ("gui::random_value" < 0.1)
{
set "TextFlavour::text" "''The term 'thief' can cover anyone from the drunken thug who beats a beggar for his alms, to the merchants who smuggle kidnapped children to sell to southern slave dealers, to the sophisticated burglar who slips in and out of a merchant's townhouse.''";

set "TextLoading::text" "Tip: Hit the Use key after frobbing a body to shoulder it.";

}
else if ("gui::random_value" < 0.2)
{
set "TextFlavour::text" "''Being part of a thieves' guild provides the same basic benefits as any other guild: insurance, training, and tricks of the trade.''";

set "TextLoading::text" "Tip: Tap the Use key quickly to drop a flashbomb at your feet where it won't blind you.";
}
else if ("gui::random_value" < 0.3)
{
set "TextFlavour::text" "''If a merchant pays protection money but they are robbed anyway, they are not likely to pay again. This is the main reason why independent thieves are not tolerated within a guild's territory.''";

set "TextLoading::text" "Tip: Shoot water arrows slightly above flames to douse them more easily.";
}
else if ("gui::random_value" < 0.4)
{
set "TextFlavour::text" "''Most thieves are brutish thugs who threaten shopkeepers for protection money, or smugglers who move and sell illegal goods. Sophisticated burglars are quite rare.'' ";

set "TextLoading::text" "Tip: Vines, pipes and chains can often be climbed.";
}
else if ("gui::random_value" < 0.5)
{
set "TextFlavour::text" "''Theft and burglary are considered serious crimes, usually punished by branding and mutilation. Theft of Church property is dealt with even more harshly.'' ";

set "TextLoading::text" "Tip: Guards with helmets become immune to knockouts when they have their weapons out.";
}
else if ("gui::random_value" < 0.6)
{
set "TextFlavour::text" "''Thieves guilds are not usually large. Small guilds have only a handful of members, and even the largest have less than a few dozen. Thieves are generally too shifty and selfish to maintain large organizations.'' ";

set "TextLoading::text" "Tip: You can quietly slide down ladders by holding the Crouch key. ";
}
else if ("gui::random_value" < 0.7)
{
set "TextFlavour::text" "''Almost all sea trade is offloaded in the city for transfer to riverboats, which sail up the river Tyne to other ports in the empire. Bridgeport is the most cosmopolitan city in the Empire...if you can't find it in Bridgeport, it can't be found anywhere.'' ";

set "TextLoading::text" "Tip: You can open doors a crack by frobbing them quickly when they start to open.";
}
else if ("gui::random_value" < 0.8)
{
set "TextFlavour::text" "''Guild memberships, official appointments, tax exemptions, personal favours for friends and family, blatant extortion and bribery, and bending the rules for personal benefit are all tools that powerful groups can use to manipulate their surroundings.'' ";

set "TextLoading::text" "Tip: Mines can be triggered by hitting them with an arrow.";
}
else if ("gui::random_value" < 0.9)
{
set "TextFlavour::text" "''Vast and sprawling, most who live there go their whole lives without seeing just how expansive it is. Having been built and rebuilt over the centuries, much of the city is a confusing maze of narrow streets and alleyways.'' ";

set "TextLoading::text" "Tip: Leaning up against a door allows you to eavesdrop on the next room.";
}
else
{
set "TextFlavour::text" "''The wards on the eastern side of the river are connected to the west by two massive bridges: Northbridge and Newbridge. Riverboat traffic ferries travellers from one side to the other as well. Smugglers often use ferrymen to avoid paying hefty bridge tolls.''";

set "TextLoading::text" "Tip: You can mantle while crouched to get into low areas.";
}
Steps To ReproduceStart A Score to Settle. You'll see the random loading text.

Save the game, exit TDM.

Load TDM, go to Load menu, load game. There will be no text at all.
TagsNo tags attached.

Relationships

related to 0002813 confirmed Make mission loading tips part of TDM and translatable 
related to 0004619 new Add Tool Tips to "Press Attack to Start" screen? 

Activities

tels

tels

15.07.2011 07:26

developer   ~0003925

Aper from the bug that this does not show during savegame load, I also think this should be part of the TDM, not only because it then can be translated, but also because then not every mapper needs to muck around with copy&paste.

A new GUI with a single variable for the mapper to turn this on/off should be made, and at that time we hopefully also can also fix that it shows during load.
Springheel

Springheel

21.06.2013 23:44

administrator   ~0005586

the values contain an "else" statement, so it has something to do with this line:

onNamedEvent OnRandomValueInitialised

Even a value of 0 should show some text, yet none appears. My guess is that whatever creates the "onRandomValueInitialised" doesn't actually run when loading from a saved game.
Obstler

Obstler

23.06.2013 09:27

developer   ~0005587

In game/gamelocal.cpp there is the function idGameLocal::InitFromNewMap
which implements the following lines

idUserInterface* loadingGUI = uiManager->FindGui(va("guis/map/%s.gui", mapNameStr.c_str()), false, false, false);

    if (loadingGUI != NULL)
    {
        // Use our own randomizer, the gameLocal.random one is not yet initialised
        loadingGUI->SetStateFloat("random_value", static_cast<float>(rnd.Random()));
        loadingGUI->HandleNamedEvent("OnRandomValueInitialised");
    }
Neither loadgame nor initfromsavedgame does implement this lines (I gues it should go into the latter function, not sure).
Springheel

Springheel

02.07.2013 16:40

administrator   ~0005622

Is it possible to include some kind of "else" statement, so that if the event isn't run, some default comment is still posted?
SteveL

SteveL

20.05.2015 22:13

developer   ~0007524

Obs' suggestion works fine. The same code can be used to show the messages while saved gamnes are loading (paste the same code into idGameLocal::InitFromSaveGame just before the call to LoadMap). We can put them in a separate function and call it from both places.

One problem: when the player reloads the currently loaded map, we don't want the text to be displayed because the player won't have time to read it. So we need to detect whether the same map is being reloaded.

One more thing to check out: whether it's possible to have a default list of tips to be displayed which mappers won't have to configure manually.
Springheel

Springheel

21.05.2015 14:24

administrator   ~0007525

I wonder if it would be possible to just show the quick tips during a quick load. Those normally only show in the last five s condos before the game starts, so they are kept short by design.
SteveL

SteveL

21.05.2015 19:10

developer   ~0007526

I'll find a way to do that. Re the idea of having a default set of tips and flavour text, could we do that simply by adding a file to the main TDM assets, that mappers can override if they wish? Or would mappers have to merge it somehow with their own GUI file? If the latter, I'll look for another way.
Springheel

Springheel

23.05.2015 14:07

administrator   ~0007527

The ideal option would be to have a default file of tips that mappers can opt into with some kind of flag, but that they can modify that file and include it in their pk4 if they want to customize the tips.
SteveL

SteveL

28.05.2015 18:49

developer   ~0007548

I've moved the code that activates the tips and flavour text to the general LoadMap procedure, so it gets used by both save game loads and new games. I've also put in a check for quick loading so that it doesn't show them during a quick load.

The way the GUI scripts are set up right now, the flavour text gets shown during loading, and the tip gets shown in a 5-second pause after loading is complete. We don't want to add a 5-second pause to quickloads, so we'd have to change the GUI scripts, not the game code, to enable tips during quickloads.

I've added a new GUI state variable "quickloading" so that GUI scripts can tell the difference between a quick load and a slow one, in case they want to do this. But I'm not sure whether we want to (a) change the GUI files for the existing maps that use the system, or (b) redesign it more sweepingly so that the tips and text can be placed on an entity, given default values, and modified in DR.

The maps that use the system are Score to Settle, Reputation to Uphold, and St Lucia, plus NHAT uses the same mechanism as a kind of loading progress bar.

I've figured out how we could change the existing GUI scripts to make it work the way you suggest, but not how to implement Tels' suggestion of a separate GUI. I've not done GUIs before.

The work so far is complete and usable -- Tips will show during loads of save games too -- so I'll commit it in the meantime.
SteveL

SteveL

28.05.2015 18:58

developer   ~0007549

at rev 6503

game/game_local.cpp
Springheel

Springheel

29.05.2015 15:49

administrator   ~0007552

Last edited: 29.05.2015 15:50

View 2 revisions

"But I'm not sure whether we want to (a) change the GUI files for the existing maps that use the system, or (b) redesign it more sweepingly so that the tips and text can be placed on an entity, given default values, and modified in DR."

a) I don't think that's necessary. Having them appear during load is a big improvement already. We could see about creating a separate list of "quick tips" that could play during quickloads for authors that want that. I haven't done any gui work for a while, but maybe we could look into this when we get to that stage of the prologue project.
b) Not sure that level of customization is necessary....

SteveL

SteveL

07.06.2015 12:03

developer   ~0007555

I need to put in a fix for an bug that grayman found and patched while I was on holiday. The new "quickloading" setting was causing a crash when launching a map from the console, which doesn't activate any GUIs.

It'd be better if we amend the scripts for the 3 maps that use the system already. At the moment I have logic that says "activate the tips and flavour text during loading of save games, but not during a quick reload" and that logic is sitting in the game code. But it belongs in the GUI scripts really, and there'll be no way to show short tips only during quickloading unless I activate the GUI for all loading events including quickloads. So to enable tips during quickloads but disable flavour text, we'll have to tweak the scripts in your two missions. I can do that if you don't mind updates being published with 2.04. And as you say, we can do what we want with St Lucia's GUIs because we're re-releasing it anyway.
SteveL

SteveL

07.06.2015 12:25

developer   ~0007556

Commit 6504 is grayman's patch for the bug mentioned above.

Commit 6505 is my fix for the bug and patch. I removed the "slow loading only" logic from the game code. I don't think we want that logic hard-coded in the game DLL -- it'd be inflexible. GUI scripts now have access to a "quickloading" flag so they can handle the logic themselves. The cost is that your maps (the only ones so far other than St Lucia that have flavour text) will need that script tweak to stop the flavour text showing during a quickload. If you don't want the scripts tweaking, I'll look for another way to preserve behaviour for those maps.

game/game_local.cpp
SteveL

SteveL

07.06.2015 12:27

developer   ~0007557

Re-assigned to myself to (1) finalise this fix after we've discussed it, and (2) to update the wiki.
Springheel

Springheel

07.06.2015 23:15

administrator   ~0007559

Do I have two missions that use this method? I thought I had only one--A Score to Settle. Does reputation use this? I thought I went with a set text.
SteveL

SteveL

08.06.2015 18:53

developer   ~0007560

You're right. The only maps using the "OnRandomValueInitialised" event (which is what I've tweaked) are St Lucia and Score. And they both use it for this purpose, displaying random text.
Springheel

Springheel

08.06.2015 19:09

administrator   ~0007561

Ok, we'll sort this out for them individually for 2.04 then
SteveL

SteveL

20.06.2015 18:16

developer   ~0007589

@Springheel: forwarded to you in case you want to keep it open until we amend the maps. The code and wiki changes are complete.
Springheel

Springheel

24.06.2015 20:16

administrator   ~0007595

Last edited: 24.06.2015 20:17

View 2 revisions

This might not be relevant now, but it just occurred to me that another place to put tool tips would be the "click to start" screen--no artificial pausing necessary, and it wouldn't require the mapper t do anything.

SteveL

SteveL

25.06.2015 18:39

developer   ~0007596

Ah, you mean a standard set we could simply apply to all missions, taking advantage of a GUI that's common to them all? That would be very useful. I did do the training mission when I discovered TDM, but I only learned about leaning into doors through the tips when playing Score. I'm sure it'd be helpful for most new players.

Do you want me to prep a version of the GUI for A Score to Settle that hides the flavour text on quickloads? What I did to enable the feature is still fresh in my mind so I could probably cover it off and test it in 5 minutes...
Springheel

Springheel

26.06.2015 15:00

administrator   ~0007597

Last edited: 26.06.2015 15:02

View 2 revisions

Sure, if you don't mind.

The benefit of using the attack screen is that it's under our control, yet mappers can still customize flavour text for their loading screen if they wish.

SteveL

SteveL

26.06.2015 20:07

developer   ~0007601

I've attached the amended GUI file to this tracker since it's the only extant example of the system in use :)

In the attached version I've suppressed *both* types of text for quickloads. I did prep a version (and still have it) that allowed the brief tip text during quick loads, but I couldn't read it so I left it out. There's no 5-second pause at the end of map load for quickloads so to show short tips, you have to move them to the Text::Flavour box. But even that didn't work well, because quickloads on my 4-yr old system take less than a second, and we probably *don't* want to slow that down, so there's no opportunity for the player to read any text.
SteveL

SteveL

26.06.2015 20:07

developer  

spring13.gui (7,989 bytes)
SteveL

SteveL

26.06.2015 20:10

developer   ~0007602

For the attack screen idea, are you thinking that we start it off with the tip texts from Score (or suggestions from the forum), in a gui file that mappers can customise?

Is the attack screen already a gui, or do we need to tweak game code to allow it?
Springheel

Springheel

28.06.2015 23:05

administrator   ~0007606

I was thinking the attack screen would be controlled by us. Mappers could still customize their own tips for their loading screen. As for whether the former is a gui, I don't know.
grayman

grayman

17.09.2017 15:25

administrator   ~0009269

Last edited: 17.09.2017 15:26

View 2 revisions

@Spring:

Can you summarize what's still needed to close out this issue? There's an awful lot of text here to satisfy the original observation that saved games don't display the tips, which appears to have been fixed in 2.04.

Springheel

Springheel

17.09.2017 16:04

administrator   ~0009271

I think this one can be closed...I'll open a new one for the additional idea that came up.

Issue History

Date Modified Username Field Change
12.07.2011 00:11 Springheel New Issue
15.07.2011 07:26 tels Note Added: 0003925
15.07.2011 07:28 tels Relationship added related to 0002813
21.06.2013 23:44 Springheel Note Added: 0005586
23.06.2013 09:27 Obstler Note Added: 0005587
02.07.2013 16:40 Springheel Note Added: 0005622
20.05.2015 16:16 SteveL Assigned To => SteveL
20.05.2015 16:16 SteveL Status new => assigned
20.05.2015 22:13 SteveL Note Added: 0007524
21.05.2015 14:24 Springheel Note Added: 0007525
21.05.2015 19:10 SteveL Note Added: 0007526
23.05.2015 14:07 Springheel Note Added: 0007527
28.05.2015 18:49 SteveL Note Added: 0007548
28.05.2015 18:58 SteveL Note Added: 0007549
28.05.2015 18:58 SteveL Assigned To SteveL => Springheel
28.05.2015 18:58 SteveL Status assigned => feedback
29.05.2015 15:49 Springheel Note Added: 0007552
29.05.2015 15:49 Springheel Status feedback => assigned
29.05.2015 15:50 Springheel Note Edited: 0007552 View Revisions
07.06.2015 12:03 SteveL Note Added: 0007555
07.06.2015 12:25 SteveL Note Added: 0007556
07.06.2015 12:27 SteveL Note Added: 0007557
07.06.2015 12:27 SteveL Assigned To Springheel => SteveL
07.06.2015 23:15 Springheel Note Added: 0007559
08.06.2015 18:53 SteveL Note Added: 0007560
08.06.2015 19:09 Springheel Note Added: 0007561
20.06.2015 18:16 SteveL Note Added: 0007589
20.06.2015 18:16 SteveL Status assigned => feedback
20.06.2015 18:16 SteveL Resolution open => fixed
20.06.2015 18:16 SteveL Fixed in Version => TDM 2.04
20.06.2015 18:16 SteveL Target Version => TDM 2.04
20.06.2015 18:17 SteveL Assigned To SteveL => Springheel
20.06.2015 18:17 SteveL Status feedback => assigned
24.06.2015 20:16 Springheel Note Added: 0007595
24.06.2015 20:17 Springheel Note Edited: 0007595 View Revisions
25.06.2015 18:39 SteveL Note Added: 0007596
26.06.2015 15:00 Springheel Note Added: 0007597
26.06.2015 15:02 Springheel Note Edited: 0007597 View Revisions
26.06.2015 19:06 SteveL Assigned To Springheel => SteveL
26.06.2015 20:07 SteveL Note Added: 0007601
26.06.2015 20:07 SteveL File Added: spring13.gui
26.06.2015 20:10 SteveL Note Added: 0007602
26.06.2015 20:10 SteveL Assigned To SteveL => Springheel
28.06.2015 23:05 Springheel Note Added: 0007606
08.01.2016 21:33 Springheel Target Version TDM 2.04 => TDM 2.05
25.11.2016 14:00 grayman Target Version TDM 2.05 => TDM 2.06
23.04.2017 23:44 Springheel Assigned To Springheel =>
16.09.2017 18:39 grayman Status assigned => new
17.09.2017 15:25 grayman Note Added: 0009269
17.09.2017 15:26 grayman Note Edited: 0009269 View Revisions
17.09.2017 16:04 Springheel Note Added: 0009271
17.09.2017 16:24 nbohr1more Relationship added related to 0004619
17.09.2017 16:25 nbohr1more Assigned To => SteveL
17.09.2017 16:25 nbohr1more Status new => resolved
17.09.2017 16:25 nbohr1more Target Version TDM 2.06 => TDM 2.04
17.09.2017 17:26 grayman Status resolved => closed