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^^ Quote
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. :( Quote
Alzheimer1992 Posted January 25, 2014 Author Posted January 25, 2014 Thanks for that =) Anyone else who maybe could help me?^^ Quote
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 Quote
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. Quote
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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.