This works fine:
Code: Select all
in base-language.txt
tooltip_mine This is my tooltip
in the .lua script:
Object.SetProperty(this,"Tooltip","tooltip_mine")
However, when a tooltip contains other stuff as well, it seems impossible to get it in there?
It works fine for buttons, here is the snip from the post in another topic:
You can put flags into your interface buttons and captions in the same way other language strings work. If you have a language string file that containsCode: Select all
my_language_string This is *X string
my_language_string_my my
In the lua code you can do any of the following:Code: Select all
- Interface.AddComponent( "MyButton", "Button", "my_language_string", "my_language_string_my", "X" ) -- Caption is set to "This is my string"
- Interface.AddComponent( "MyButton", "Button", "my_language_string", "your", "X" ) -- Caption is set to "This is your string"
- Interface.AddComponent( "MyButton", "Button", "my_language_string", 4, "X" ) -- Caption is set to "This is 4 string"
You can also include multiple flags in the same stringCode: Select all
my_other_string This is *X other *Y
for example.
But trying to do stuff like that for a tooltip setting like this:
Code: Select all
Object.SetProperty(this,"Tooltip", "Used by Utility Booth nr. "..this.HomeUID.."\n\nClick me for more options")
is what all the brain damage is about.
So far I've tried this for base-language.txt:
Code: Select all
tooltip_clickforoptions Used by Utility Booth nr. *X\n\nClick me for more options
... and then these failed attempts in the .lua script:
Code: Select all
Object.SetProperty(this,"Tooltip","tooltip_clickforoptions",this.HomeUID,"X")
Object.SetProperty(this,"Tooltip","tooltip_clickforoptions"..this.HomeUID.."X")
Object.SetProperty(this,"Tooltip","tooltip_clickforoptions,this.HomeUID,X")
Object.SetProperty(this,"Tooltip",tooltip_clickforoptions,this.HomeUID,X)
this.Tooltip = "tooltip_clickforoptions",this.HomeUID,"X"
this.Tooltip = ("tooltip_clickforoptions",this.HomeUID,"X")
this.Tooltip = "tooltip_clickforoptions"..this.HomeUID.."X"
Object.SetInterfaceCaption(this,"Tooltip","tooltip_clickforoptions",this.HomeUID,"X")
Object.SetProperty(this,"Tooltip",string.format("tooltip_clickforoptions",this.HomeUID,"X")
Object.SetProperty(this,"Tooltip",string.format("tooltip_clickforoptions",this.HomeUID)
local tmptooltip = string.format("tooltip_clickforoptions",this.HomeUID)
Object.SetProperty(this,"Tooltip",tmptooltip)
But all of the options above either output this:
Code: Select all
Used by Utility Booth nr. *X
Click me for more options
or this
Code: Select all
tooltip_clickforoptions62352X
(where the number represents the HomeUID number)
One interesting line I tried was:
Code: Select all
Object.SetProperty(this,"Tooltip",string.format("tooltip click for %d options",this.HomeUID))
it will output
Code: Select all
tooltip click for 62352 options
But when trying to use %d in the base-language file like this
Code: Select all
tooltip_clickforoptions Used by Utility Booth nr. %d\n\nClick me for more options
with code like this
Code: Select all
Object.SetProperty(this,"Tooltip",string.format("tooltip_clickforoptions",this.HomeUID)
it will output
Code: Select all
Used by Utility Booth nr. %d
Click me for more options
And unfortunately pumping the tooltip in another variable first wont help, so we get same results from above when using these two lines:
Code: Select all
local tmptooltip = "tooltip_clickforoptions"
Object.SetProperty(this,"Tooltip",string.format(tmptooltip,this.HomeUID))
Also merging the tips together like this
Code: Select all
Object.SetProperty(this,"Tooltip","tooltip_usedbybooth"..this.HomeUID.."tooltip_clickforoptions")
Does not work... it will output
Code: Select all
tooltip_usedbybooth62352tooltip_clickforoptions
Any suggestions are very welcome, I haven't seen mods yet using this kind of stuff...
And when you got the simple example above to work, have a crack on this one as well:
Code: Select all
Object.SetProperty(this,"Tooltip", "Used by Utility Booth nr. "..this.HomeUID.."\n\nFIRE DETECTED!\nSending "..entity.Category.." "..entity.Type.." at "..string.sub(tostring(_),0,4).."m\nto the Evacuation Area")
The base-language.txt entry you'll get for free (I'm guessing it's this):
Code: Select all
tooltip_evacprisoner Used by Utility Booth nr. *W\n\nSending *X *Y at *Zm\nto the Evacuation Area
..but how on earth get that into a tooltip?