-
Posted by Bonewalker on Mon, 14 Dec 2009 23:25:13
How do I create a new line for text? For example, in the code below, I want to list my auctions in a frame I have created. It always overwrites with the most recent line in the loop. What is the best way of doing this?
Thanks.
function Button1_OnClick() --Frame1:Hide(); local o="owner" n=GetNumAuctionItems(o)for i=1,n do itemlink=GetAuctionItemLink(o,i); name, buyoutPrice, highestBidder, owner, sold = GetAuctionItemInfo("owner", i) FontString1:SetText("Auc: " .. i .. " of " .. n .. " " .. name .. " " .. sold); end end
-
Posted by jnwhiteh on Tue, 15 Dec 2009 12:08:56
How do I create a new line for text? For example, in the code below, I want to list my auctions in a frame I have created. It always overwrites with the most recent line in the loop. What is the best way of doing this?
You could try just adding to the string with a newline, i.e.
function Button1_OnClick() --Frame1:Hide(); local o="owner" n=GetNumAuctionItems(o) local txt = "" for i=1,n do itemlink=GetAuctionItemLink(o,i); name, buyoutPrice, highestBidder, owner, sold = GetAuctionItemInfo("owner", i) txt = txt .. "Auc: " .. i .. " of " .. n .. " " .. name .. " " .. sold .. "\n"; end FontString1:SetText(txt); end
-
Posted by Bonewalker on Tue, 15 Dec 2009 15:53:27
Yes, I did find that option and tried it, but it didn't work at all. However, I see you have set a variable, txt, and then used Settext(txt). Would that somehow make it function differently?
I will try it out as soon as I can.
Thanks.
-
Posted by Bonewalker on Wed, 16 Dec 2009 16:14:39
How do I create a new line for text? For example, in the code below, I want to list my auctions in a frame I have created. It always overwrites with the most recent line in the loop. What is the best way of doing this?
You could try just adding to the string with a newline, i.e.
function Button1_OnClick() --Frame1:Hide(); local o="owner" n=GetNumAuctionItems(o) local txt = "" for i=1,n do itemlink=GetAuctionItemLink(o,i); name, buyoutPrice, highestBidder, owner, sold = GetAuctionItemInfo("owner", i) txt = txt .. "Auc: " .. i .. " of " .. n .. " " .. name .. " " .. sold .. "\n"; end FontString1:SetText(txt); end
Unfortunately, the code above did not create new lines. How do others go about doing this? Or where in your book would it cover this subject?
Thanks much.
-
Posted by corveroth on Thu, 17 Dec 2009 21:11:22
The character used to escape in WoW's FontStrings is the pipe, not the backslash. Try concatenating "|n" onto the end of txt instead.