[Solved] How to assign a string variable to text object

Need help with:

What would be the correct way apply text scene valriable to text object?

The scenario

As a player, when you go to a shop to buy a sword,
if you have gold between 10 to 50, the merchant says, “You must have more gold to enter”
if you have gold between 51 to 100, the merchant says, “Welcome to the shop!”
if you have gold above 101, the merchant says, “We always welcome wealthy travellers like you!”

What I’m trying?

Check the value of variable “intGold”.
Store the text in “strMerchantDialog”.
Change the string of text object "Mechant says: "
Using ToString(Variable(strMerchantDialog))

What is the expected result

When intGold is in above values, the merchant says the above lines.

What is the actual result

0

What might be wrong?

Maybe, the ToString(Variable(strMerchantDialog)) is not the right method?

Well I’m not sure what you’re doing but VariableString(strMerchantDialog) will put the text of that variable into the text box and ToString(Variable(strMerchantDialog)) will put the number of that variable into the text box.

3 Likes

Thanks @Lucky-j
This solved my problem :smiley:

1 Like