Here's mine. It allows you to backspace, enter, and hold down keys.
Code:
@name Console Screen Writer, by -HP-
@inputs Keyboard Scr:wirelink
@persist String:string X Y LineLength:array Timer:string
if (first()) {
X = 0
Y = 0
Scr:setNumber("Clk",1)
Scr:setNumber("Reset",1)
LineLength = array()
}
if (clk(toChar(Keyboard))) {
timer(toChar(Keyboard),100)
Timer = toChar(Keyboard)
} elseif (~Keyboard) {
stoptimer(Timer)
timer(toChar(Keyboard),500)
Timer = toChar(Keyboard)
}
if (clk(toChar(Keyboard)) | ~Keyboard) {
if (Keyboard >= 32 & Keyboard <= 126) {
if (X == 29 & Y == 17) { exit() }
Scr:writeString(toChar(Keyboard),X,Y)
X++
LineLength:setNumber(Y,X)
if (X == 30) {
Scr:writeString(" ",X,Y,0,0,0)
X = 0
Y++
}
String = String + toChar(Keyboard)
}
if (Keyboard == 13) {
Scr:writeString(" ",X,Y,0,0,0)
Y++
X = 0
String = String + " "
}
if (Keyboard == 127) {
Scr:writeString(" ",X,Y)
if (X == 0 & Y > 0) {
Y--
X = LineLength:number(Y)
} elseif (X > 0) {
X--
LineLength:setNumber(Y,X)
}
Scr:writeString(" ",X,Y)
String = String:sub(1,String:length()-1)
}
}
Scr:writeString(" ",X,Y,999,0,1)
Bookmarks