Need help with in game dialog code
Posted: Thu Sep 22, 2016 6:23 pm
So, before I give my problem or anything I just want to say this community is awesome and I really enjoy working with love and reading the awesome and helpful replies from members of this forum. I've never posted on a forum before, so if i've done anything wrong or incorrect I apologize and you can just call me out on it.
Recently ive been working on a way to implement dialog into a game ive been working on.... and after alot of searching i've found that io.lines reading through lines of a text file for each part of a dialog as a solid way to implement this. After alot of testing and modifying code all night, I've come up with a solution... but when I try to change the line number to read the dialog I want to diplay, the variable lineno changes, but the printed dialog wont..... can anybody tell me what i'm doing wrong or give me a better way to do it???
This is the dialog code using io.lines
and the .txt file is just
Thanks for your time.
Recently ive been working on a way to implement dialog into a game ive been working on.... and after alot of searching i've found that io.lines reading through lines of a text file for each part of a dialog as a solid way to implement this. After alot of testing and modifying code all night, I've come up with a solution... but when I try to change the line number to read the dialog I want to diplay, the variable lineno changes, but the printed dialog wont..... can anybody tell me what i'm doing wrong or give me a better way to do it???
This is the dialog code using io.lines
Code: Select all
lineno = 1
local n=0
for Lr in io.lines("C:\\Program Files\\LOVE\\games\\points\\dialog.txt") do-------UPDATE 9/21/16 lineno wont change the displayed dialog when it chanes.... DX
n=n+1
if n==lineno then print(Lr) LineRead = Lr
; break end
end
Code: Select all
line1
line2
line3
line4
line5