#Getting the format of hint parameters.

1 messages · Page 1 of 1 (latest)

real ridge
#

In SSKeybindHintParameter there is the const DefaultKeybindFormat that shows us that if we add {0} to our string, it will get replaced with the keybind, but I am looking at all parameters and I don't seen an indicator of what the format is, or what is actually replaced with what. Is there any documentation on this stuff?

bitter marten
#

You have a base message string, eg:
Hello this is a test message, press {0} to give yourself {1} ammo
For this, you make an array of hint parameters
[new SSKeybindHintParameter(1), new IntHintParameter(15)]
Index of the array = formatting number
SSKeybind => {0}
IntHint => {1}

If this is what you mean?

#

Resulting in
Hello this is a test message, press [YourKeybind] to give yourself 15 ammo

bitter marten
#

then I dont know what you mean

real ridge
# bitter marten _then I dont know what you mean_

I am making a hint management plugin that makes it possible to send multiple hints, but right now it doesn't take into account hint parameters. I was told that some hint parameters have more than 1 value to replace so I need to know the count of values that can be replaced within each hint parameter so I can take into account the parameters once I replace them

drifting flicker
#

oh this is what you were trying to say earlier to me

#

who said a hint parameter takes more than one? because afaik its one parameter per replacement

bitter marten
#

Yea

real ridge
#

but if there is only 1 replacer per hint param then cool

#

even better

drifting flicker
real ridge
#

i misunderstood ig

#

that's my bad

drifting flicker
#

icic

real ridge
#

Ok so this is my solution to the issue then

int usableParam = 0;
            List<HintParameter> allParameters = new();
    
            foreach (TextHint hint in Hints)
            {
                string text = hint.Text;
                HintParameter[] parameters = hint.Parameters ?? Array.Empty<HintParameter>();
        
                if (parameters.Length > 0)
                {
                    for (int i = 0; i < parameters.Length; i++)
                    {
                        text = text.Replace($"{{{i}}}", $"{{{usableParam + i}}}");
                    }
            
                    allParameters.AddRange(parameters);
            
                    usableParam += parameters.Length;
                }
        
                stringBuilder.Append(text);
                stringBuilder.Append("<line-height=0%>\n</line-height>");
            }```
bitter marten
#

Yep seems good

real ridge
#

turns out it wouldnt work because usableParam would end up starting at 1 TrollDespair