moveCursor()

Post Reply
Caled
Posts: 403
Joined: Thu Apr 09, 2009 4:45 am

moveCursor()

Post by Caled »

Code: Select all

You cough softly.
H:4260|5191 B:100% Exp:37 [kcsdb eb]

Code: Select all

Pattern: You cough softly.
Script:
local currentLine = getLineCount()
moveCursor("main", 100, currentLine)
echo("Test")
moveCursorEnd("main")

Code: Select all

You cough softly.Test
H:4260|5191 B:100% Exp:37 [kcsdb eb]
Excuse me if I am wrong, but shouldn't "Test" be displayed at column 100, which is to say 83 spaces to the right of where it is? I'm obviously getting something wrong, so could someone please help me fix it?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: moveCursor()

Post by Heiko »

The echo() function has been changed to always print at the end of the current line. The moveCursor() function has no effect on anything printed with echo().
You need to use insertText() to use cursor placement. Without a prior cursor movement insertText() prints at column 0 i. e. insertText() will print at the beginning of the line unless you have moved the cursor to a different position.

Code: Select all

moveCursor( "main", 6, getLineNumber() )
insertText( "######### heydo! #######" )
PS: moveCursor() doesn't yet accept an empty first parameter to print on the main screen like the rest of the relevant functions. It should be moveCursor( x, y ) instead of moveCursor( "main", x, y ). I've added this to my todo list.

Post Reply