Hi just postin an bug
When you do textutil slowPrint, if the line is too long, it will half write an word and then it does not fit so it re writes it:
Code:
Textutils.slowPrint ("hello I am writing a long line of text to be written")
Output: (] means the side of the computer screen )
hello I am writing a long line of te --cuts out
text to be written
Cheers
Textutils.slowPrint not rendering properly [1.5.2]
Started by Galactica4, Jul 14 2013 02:39 AM
10 replies to this topic
#1
Posted 14 July 2013 - 02:39 AM
#2
Posted 14 July 2013 - 03:14 AM
I don't think it's a bug.
#3
Posted 14 July 2013 - 11:15 AM
Picture:
#5
Posted 14 July 2013 - 08:38 PM
not really much of a bug, just check if the string is greater then max horozontal if its really that much of a problem
#6
Posted 15 July 2013 - 09:45 AM
PixelToast, on 14 July 2013 - 08:38 PM, said:
not really much of a bug, just check if the string is greater then max horozontal if its really that much of a problem
#7
Posted 15 July 2013 - 10:30 AM
I think it's a bug, I think it should either output
hello i am writing a long line of text to be writte
n
Or,
hello i am writing a long line of text to be
written
hello i am writing a long line of text to be writte
n
Or,
hello i am writing a long line of text to be
written
#8
Posted 15 July 2013 - 10:38 AM
Ofcourse its a bug!
#9
Posted 15 July 2013 - 11:44 AM
It is a bug, but it's not like it's something you can't fix yourself with your own slowPrint function. Simply check if the next word will fit, and if not, go to the next line.
I doubt it's going to be fixed that quickly, considering the minor impact this has.
I doubt it's going to be fixed that quickly, considering the minor impact this has.
#10
Posted 03 May 2014 - 04:59 AM
I've been looking around for a solution for this issue myself.
I'm not good enough with LUA to know how to write a program to replace the slowprint program to resolve the issue of words that get cut off getting doubled.
Would anyone be up to writing a fix for this? So far my only solution is to manually line break every sentence every 18 characters myself in a program that has many, many lines of slowprint text.
Thanks in advance.
I'm not good enough with LUA to know how to write a program to replace the slowprint program to resolve the issue of words that get cut off getting doubled.
Would anyone be up to writing a fix for this? So far my only solution is to manually line break every sentence every 18 characters myself in a program that has many, many lines of slowprint text.
Thanks in advance.
Edited by DavEdward, 03 May 2014 - 04:59 AM.
#11
Posted 03 May 2014 - 05:11 PM
A friend of mine who's a programmer was able to make a solution.
His version of the slowWrite command works like the old one but includes a 3rd argument that if 'true' it makes a new line like SlowPrint does.
Just for convenience I added a slowPrint function that adds the new line without an argument for those that want to easily swap out existing code.
The code is as is, as frankly I don't entirely understand all of it. It's a level well over my skill.
It seems to work great for me.
The only bug I know of is if you enter a single word that is longer than the screen it may throw an error. Just make sure no single word is longer than space on your terminal or monitor and you should be fine.
His version of the slowWrite command works like the old one but includes a 3rd argument that if 'true' it makes a new line like SlowPrint does.
Just for convenience I added a slowPrint function that adds the new line without an argument for those that want to easily swap out existing code.
The code is as is, as frankly I don't entirely understand all of it. It's a level well over my skill.
It seems to work great for me.
The only bug I know of is if you enter a single word that is longer than the screen it may throw an error. Just make sure no single word is longer than space on your terminal or monitor and you should be fine.
function slowWrite( sText, iRate, bNewLine )
local iSleep = (1 / 20) -- Default rate
local iScrWidth,iScrHeight = term.getSize()
local iScrPos,y = term.getCursorPos()
local sWord
local bFirst = true
local iLen
if (iRate and iRate > 0) then --If nil ignore iRate
iSleep = 1 / iRate
end
sText = tostring( sText )
for sWord in string.gmatch(sText, "%S+") do
iLen = string.len(sWord)
if ((iLen + iScrPos) > iScrWidth) then
write("\n")
iScrPos = iLen
else
if not bFirst then
sWord = " "..sWord
iLen = iLen + 1
else
bFirst = false
end
iScrPos = iScrPos + iLen
end
for i=1,iLen do
sleep(iSleep)
term.write(string.sub(sWord,i,i))
end
bFirst = false
end
if bNewLine then
write("\n");
end
end
function slowPrint( sText, iRate )
slowWrite( sText, iRate, true)
end
Edited by DavEdward, 03 May 2014 - 05:18 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











