It looks like the problem is in the format of your text file to me. Here is a working example of a text file from my own map:
Code: Select all
"I've got <value=numSlaves> fine mistresses for sale this week. But,you gotta buy 'em as a set, which is going to cost you <value=gold> gold. Do you want to buy them?"
Notice that the format is: <value=xxx>
where xxx is name of a variable that is to be passed from the calling function. (In other words, I think "You have lost <value=gold> gold!" should work for you, but I haven't actually run a test on my end.)
To complete the example, the calling function from my script is a HOF QuestionBox, but it works the same way as the simpler MessageBox. It looks like this:
Code: Select all
QuestionBox({path.."sellSlaves.txt"; numSlaves = slaverSlaves, gold = slaveCost}, "slaveBuyYes", "slaveBuyNo");
Notice the correspondence between the the variables being passed by the calling function (numSlaves and gold) and the variable names (numSlaves and gold) in the text file.
BTW, you should be able to use hard-coded numbers in the calling function like you are trying to do instead variable values like I did.
Side Note: in my QuestionBox code, I store the Resource path in a global variable (path) and use the Lua concatenation operator (..) to create the path for the "sellSlaves.txt" file.