Alzheimer1992 Posted January 18, 2014 Posted January 18, 2014 Hey guys, I just scipted a little program for print Texts on paper. My problem was that the read() command doesn't start a new line when the line is full, so I tried to fix that with the parallel API. In the following screenshots you can see my code and the error message. I hope you can help me fix that^^
badkruka Posted January 20, 2014 Posted January 20, 2014 Use print() everytime you need text on a new row istead of read(). It jumps down one row and you can skip term.setCursorPos() For you error, I can't help you. :(
Alzheimer1992 Posted January 25, 2014 Author Posted January 25, 2014 Thanks for that =) Anyone else who maybe could help me?^^
Niverton Posted January 27, 2014 Posted January 27, 2014 Hey, I'll try my best helping you ! It crashes because what your function typeToPaper() does is wait the user to write something and hit enter, it does not write on the paper, then it returns true (you will not be able to get the text entered, because your variable is local so it can only be accessed in the function, and its content will be deleted after the return), while your checkPosition() function loops until there are too many lines written on the paper, but nothing is never written on it, so it never stops, and the error is triggered because it loops for too long. The only way you could do exactly what you event is through the event system, your program waits until the user hits a char key for example ( os.pullEvent("char") ), then write the char on the screen (and on the paper if you want your program to work like a typewriter). But you could go further and wait for the user not only to hit a char key, but a key ( os.pullEvent("key") ), and treat the key pressed with the Keys API so you can do carriage returns, tabulations, and cool stuff like that. In facts, this is exactly how the read() function works ! Hope this will help, I will be happy to write an example program if you need one. If someone know how to write on a new line on this forum, tell me, I'm sorry this must be a pain to read me, and I have a bad English
Timendainum Posted January 27, 2014 Posted January 27, 2014 Please post the code to pastebin. I'll look at it later tonight if you can. Assuming Niverton hasn't solved your issue.
Alzheimer1992 Posted January 28, 2014 Author Posted January 28, 2014 Thank you Niverton, I'll fix it tomorrow. If it doesn't work after all I'll upload the code to pastebin for you Timendainum.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now