SetText convert integer to text?

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
adamkooo2
Posts: 1318
Joined: 13 Jun 2014, 08:43
Location: Slovakia
Contact:

SetText convert integer to text?

Post by adamkooo2 »

Hello guys!

I have problem with integers when I want to use them in SetText function.

Code: Select all

main() 
{
	(Page.GetFirstChild("SP") as CMlLabel).SetText(LocalUser.LadderPoints);
	(Page.GetFirstChild("Rank") as CMlLabel).SetText(LocalUser.LadderRank);
	yield;   
}

--></script>
This doesn't work too:

Code: Select all

main() 
{
	(Page.GetFirstChild("SP") as CMlLabel).SetText(LocalUser.LadderPoints as Text);
	(Page.GetFirstChild("Rank") as CMlLabel).SetText(LocalUser.LadderRank as Text);
	yield;   
}

--></script>
Do you have a solution?
Thanks :thx:
/\rkady
Image
User avatar
undef.de
Posts: 2095
Joined: 06 Apr 2011, 21:57
Location: Germany, North Sea Coast
Contact:

Re: SetText convert integer to text?

Post by undef.de »

This works (auto convert):

Code: Select all

main() 
{
	(Page.GetFirstChild("SP") as CMlLabel).SetText(""^ LocalUser.LadderPoints);
	(Page.GetFirstChild("Rank") as CMlLabel).SetText(""^ LocalUser.LadderRank);
	yield;   
}

--></script>
or convert it with TexLib::ToText():

Code: Select all

#Include "TextLib" as TextLib
main() 
{
	(Page.GetFirstChild("SP") as CMlLabel).SetText( TextLib::ToText(LocalUser.LadderPoints) );
	(Page.GetFirstChild("Rank") as CMlLabel).SetText( TextLib::ToText(LocalUser.LadderRank) );
	yield;   
}

--></script>
Last edited by undef.de on 30 Jun 2017, 12:25, edited 1 time in total.
Developer of UASECO, a controller with support of the Modescript Gamemodes for TM².
Visit the official website for more: UASECO.org


Developer of various plugins for XAseco/XAseco2 and MPAseco, visit my lab: www.undef.name

You like what I do? Then award a ManiaStar.
User avatar
adamkooo2
Posts: 1318
Joined: 13 Jun 2014, 08:43
Location: Slovakia
Contact:

Re: SetText convert integer to text?

Post by adamkooo2 »

Thanks, it works! :thx:
/\rkady
Image
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest