The way my system is currently set up is it stores all the lines, then when a prompt is gained, parses them. The problem i'm having is retro-actively adding echo's etc to lines that have already been processed. I am thinking about two options (neither of which I seem to be able to make work).
1 - Some method of inserting an echo/cecho onto lines that have already been processed.
2 - Storing the Lines with colour formatting in a table, hiding the original output from the mud then displaying each line with any neccessary additions once all the proccessing has been done. (Problems arising being multiple colours per line etc)
I've tried using copy/paste functions but those seem to be unable to pass the line info to variables etc for storage so i'm pulling a blank. Would anyone have any advice on how to make either of these work? Or failing that another possible solution?
Copying Line Colours
Re: Copying Line Colours
There's a moveCursor() function that can be used to put echo's for previous lines.
Re: Copying Line Colours
Thanks, will look into that.
Getting closer I guess but it still refuses to work. I'm sure the movecursor is fine as the debug is putting out...
...but I only see this on screen...
...the numbers being the column/line number. with Test being the actual echo.
This is how i'm doing it.
Any thoughts? :/
Getting closer I guess but it still refuses to work. I'm sure the movecursor is fine as the debug is putting out...
Code: Select all
current user cursor: 9843#:
Code: Select all
Golden Walk next to Philosopher's Plaza.
The stars twinkle in the clear night sky. A runic totem is planted solidly in
the ground.
You see exits leading east and northwest. 41, 9843, Test
This is how i'm doing it.
Code: Select all
function suffix(line, data)
moveCursor("main",tonumber(line_table["Data"][line].last_length + 1 ),tonumber(line_table["Data"][line].ended))
echo(data)
end
Re: Copying Line Colours
Mudlet has buffers to store text with format and color information. You create one -> createBuffer(name) and then use copy() and paste() to copy the text + colors to your buffer. The buffer can be accessed just like a regular console buffer (=text window) - and it can even be shown on the screen with showWindow(buffername) which will show the buffer in a popup console window. You can then retrieve the content stored in the buffer and copy it back to the main screen or any other console window. You can also do your echos before copying the line to the buffer. There's a special select function that selects the actual buffer line that contains your echos and not just the currently processed data from the MUD.
Re: Copying Line Colours
I don't want a pop up window though, i want to do all this on screen. Never been a fan of sparkly Interfaces.Heiko wrote:Mudlet has anonymous buffers for this type of task. You create one -> createBuffer(name) and then use copy() and paste() to copy the text + colors to your buffer. The buffer can be accessed just like a regular console buffer (=text window) - and it can even be shown on the screen with showWindow(buffername) which will show the buffer in a popup console window.
Re: Copying Line Colours
The option to make the buffer a popup is simply a debug tool. The primary objective of anonymous buffers is to temporarily store text without losing format information.
Re: Copying Line Colours
So i can store the lines, plus colours in a buffer...the call it back at the end of the paragraph (with additions)? If so...how? (no directing to that insane mudlet manual! Its more confusing than the program is )
Re: Copying Line Colours
this is just a theory, but could you trigger "\n" to echo a variable that is the saved text?
edit* It wouldn't deal with colours well, but would give you the text echoed again
edit* It wouldn't deal with colours well, but would give you the text echoed again
Re: Copying Line Colours
Sani wrote:So i can store the lines, plus colours in a buffer...the call it back at the end of the paragraph (with additions)? If so...how? (no directing to that insane mudlet manual! Its more confusing than the program is )
Yes, buffers can be manipulated via moveCursor(), insertText(), the various select functions, replace(), copy() and paste(). I've edited my first posting for more information on how to work with buffers. Note that you need to use insertText() instead of echo() if you use moveCursor() because echo purposely ignores the current cursor position.
There are a bunch of people with large scripts who have learned to use Mudlet exclusively by reading the manual and reading the forum without ever makeing a single posting here. It's possible, but I agree that the manual needs to be finished and partly rewritten as some info is slightly outdated. However, it's still the best way to get to grips with the API as the API reference is updated regularly. The manual is fine for a first introduction on some of Mudlet's more advanced features, but you really need to read my postings on those things in the forum because they contain much more information than the manual.