Jump to content
Tostm8

Advanced Hints - Adding in Variables

Recommended Posts

Hello,

 

I'm running into some trouble here. I'm trying to add a variable into an advanced hint. For example, displaying the amount of money the player has.

 

So far this is what I have:

class CfgHints
{
	class Toasty
	{
		displayName = "Player Info";

		class Toa_playerInfo
		{
			arguments[] = {
				"name player",
				"money",
				"expe"
			};
			description = "Name: %11<br/>Money: %12<br/>XP: %13";
			displayName = "Player Information";
			tip = "ABC";
		};
	};
};

The player's name shows up fine but the money and experience variables do not. Where they should be is just a blank space and no error.

 

Can anyone help here? I'm a bit stumped...

 

Thanks in advance,

Toasty.

Share this post


Link to post
Share on other sites

%1 %2 %3

Starts at %1, etc...

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, Tostm8 said:

Hello,

 

I'm running into some trouble here. I'm trying to add a variable into an advanced hint. For example, displaying the amount of money the player has.

 

So far this is what I have:


class CfgHints
{
	class Toasty
	{
		displayName = "Player Info";

		class Toa_playerInfo
		{
			arguments[] = {
				"name player",
				"money",
				"expe"
			};
			description = "Name: %11<br/>Money: %12<br/>XP: %13";
			displayName = "Player Information";
			tip = "ABC";
		};
	};
};

The player's name shows up fine but the money and experience variables do not. Where they should be is just a blank space and no error.

 

Can anyone help here? I'm a bit stumped...

 

Thanks in advance,

Toasty.

 

What does "money" and "expe" actually hold? Are these global variables?

 

3 minutes ago, HazJ said:

%1 %2 %3

Starts at %1, etc...

That's true for format, but not for CfgHints.

 

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

@Grumpy Old Man - Had no idea. Thanks! Now I know heh.

@Tostm8 - Just to make sure... These aren't defined using setVariable are they?

  • Like 2

Share this post


Link to post
Share on other sites
arguments[] = {
	"name player",
	"str money",
	"str expe"
};

 

  • Like 3

Share this post


Link to post
Share on other sites

@HazJ No just the simple way :D

@Larrow That did it, thank you!

 

I ran into a different problem which seems to not be fixable but the values won't update. I don't think it would be possible for them to update since it's set in the description?

Share this post


Link to post
Share on other sites
1 hour ago, Tostm8 said:

I ran into a different problem which seems to not be fixable but the values won't update.

What wont update? The code as shown previously?

1 hour ago, Tostm8 said:

I don't think it would be possible for them to update since it's set in the description?

What do you mean by this? "set in the description"? as in the advHint cfg?

Share this post


Link to post
Share on other sites
2 hours ago, Tostm8 said:

@HazJ No just the simple way :D

@Larrow That did it, thank you!

 

I ran into a different problem which seems to not be fixable but the values won't update. I don't think it would be possible for them to update since it's set in the description?

On a sidenote, any reason for using CfgAdvanced hint in the first place?

Why not just hint or hintSilent during mission runtime since you don't seem to use any of the features from CfgAdvancedHint?

 

Cheers

Share this post


Link to post
Share on other sites
1 hour ago, Larrow said:

What wont update? The code as shown previously?

What do you mean by this? "set in the description"? as in the advHint cfg?

So for example when I kill an enemy I get +1 experience. But that isn't shown on the adv. hint. It will still say 0 xp.

Also yes. It just loads up at the start and never loads again right?

 

34 minutes ago, Grumpy Old Man said:

On a sidenote, any reason for using CfgAdvanced hint in the first place?

Why not just hint or hintSilent during mission runtime since you don't seem to use any of the features from CfgAdvancedHint?

 

Cheers

No, I just wanted to see if it would work honestly. I am using normal hints now but I like the design of the adv. hint.

Share this post


Link to post
Share on other sites
1 hour ago, Tostm8 said:

So for example when I kill an enemy I get +1 experience. But that isn't shown on the adv. hint. It will still say 0 xp.

The hint will need to be re-shown, just in case your leaving it up for extended periods and thinking it will update on the fly.

 

1 hour ago, Tostm8 said:

Also yes. It just loads up at the start and never loads again right?

No, every time you show the hint the values are re-assessed.

Quote

"name player" // Simple string will be simply compiled and called

 

Why use a adv. hint when you could make your own simple ui to accomplish showing the players money, xp.

Share this post


Link to post
Share on other sites

@Larrow I tried calling the advanced hint again. But it seems like the original never goes away. I couldn't find a way to un-call it.

 

I know it says:

Quote

OnlyOnce - [Bool] show the hint in a mission only once (true) or multiple times (false), optional - default false

 

But that doesn't seem to get rid of it after the 35 seconds or whatever when set to true.

Share this post


Link to post
Share on other sites
On 7/18/2018 at 4:31 PM, Tostm8 said:

But that doesn't seem to get rid of it after the 35 seconds or whatever when set to true.

I'm not sure what you think this option means but..

Think of it like any other games tutorial hints, when the player does something for the first time a tutorial hint is show ( equivalent of call BIS_fnc_advHint ). It lasts for a certain time ( equivalent of the 2nd and 4th parameters of BIS_fnc_advHint depending on what is displayed short or full hint  ). If the player does the same thing again you do not want to keep spamming them the tutorial hint as you have already notified them about it once.

This is what this ( the 8th parameter "Show the hint in a mission only once"  ) does, once it has been shown if BIS_fnc_advHint is used again to show the same hint it will not display, as it has already been shown "Show the hint in a mission only once".

So this setting, if you need to update the hints arguments by showing it again, should be False.

 

On 7/18/2018 at 4:31 PM, Tostm8 said:

I tried calling the advanced hint again. But it seems like the original never goes away. I couldn't find a way to un-call it.

Can you show me the parameters you pass when calling the function, as so far all you have shown us is the config entry.

 

Can you also be a little more verbose in the functionality you are looking for from advHint?

Do you want it to show all the time?

Do you want it to only appear every time there is an update to money or expe?

Do you want the ability for the player to recall the hint if hides by using the 'last help' binding (default behaviour)

etc

 

There is also a property of your CfgHints class you may want to add that I see is not mentioned in the wiki page (added)...

dlc = -1;

As every time an advHint is shown there is also an update made in the players diary log. If you keep displaying this advHint then the players log will get spammed with an update every time if this option is 0 (default when not set).

 

 

Here is a default advHint that updates every time you change money or expe and will show for 35 seconds before hiding as an example.

  • Like 1

Share this post


Link to post
Share on other sites

Okay, so I've realised how special I am. The thing that was screwing me over was the 8th parameter. I need to learn how to read good. Thank you for everyone's help! All sorted now.

 

Also a special thank you to you Larrow for pointing that out :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×