Text

» Siedler Map Source Forum » Siedler DEdK Script Forum » Text

Seiten: 1

SH
#1
01.08.2018 14:58
Beiträge: 127

Text

Hi!
I want to change the text of Yuki's fireworks motivate. I tried do it by using this code

function InitYuki()
GUITooltip_NormalButtonOrig = GUITooltip_NormalButton;
GUITooltip_NormalButton = function(a,b)
local newString, numberOfChanges = string.gsub( a, "AOMenuHero11/", "" );
if numberOfChanges == 1 then
if newString == "command_fireworksmotivate" then
XGUIEng.SetText( gvGUI_WidgetID.TooltipBottomText, "text" );
end
end
end
end



but now other buttons have also this text. What's wrong?

____________________
Sorry for my German

mcb
#2
01.08.2018 15:54
Beiträge: 1472

1) When changing tooltips always call the original function first, because it handles all 3 text fields.
2) Always call the original function if you don't want to change anything, because it handles other tooltips as well.
3) Compare the whole string, not parts of it. "AOMenuHero11" is part of all of yukis ability buttons.

So it should look like this:

GUITooltip_NormalButtonO = GUITooltip_NormalButton
function GUITooltip_NormalButton(stt, shortcut)
   GUITooltip_NormalButtonO(stt, shortcut)
   if stt=="AOMenuHero11/command_fireworksmotivate" then
      XGUIEng.SetText("TooltipBottomText", "foo")
   end
end

SH
#3
01.08.2018 16:32
Beiträge: 127

Thank you

____________________
Sorry for my German

Seiten: 1

SiteEngine v1.5.0 by nevermind, ©2005-2007
Design by SpiderFive (www.siedler-games.de) - English translation by juja

Impressum