A few small issues

Post Reply
fordpinto
Posts: 3
Joined: Wed Sep 25, 2019 4:59 pm

A few small issues

Post by fordpinto » Wed Sep 25, 2019 7:05 pm

Started using Mudlet a month ago, very happy so far. Mostly smooth, but there are a few things here and there. Wanted to share my thoughts on the few little snags I encountered so far.

Yesterday, I was trying to do a simple thing - grab a line from main buffer on a trigger, and move it to a separate mini-console, and also add a command-firing link to that line as well. I have encountered a couple of things that may or may not be recognized as problems by developers, but caused me trouble:

The combination of copy() and paste()/appendBuffer() seems to remove command link info. The command link that I have added to the line via cinsertLink() call was not re-created in the miniconsole. Not sure what the reasoning is, it would be nice to have that copied over as well as formatting etc, in line with overall HTML-like structure of mudlet.

Cursor in miniconsole is not advanced by appendBuffer() To clarify a little further, I was inserting a command link by first executing selectString() to find the right spot for it. In the main buffer, that worked seamlessly, since on trigger the cursor is on the line I am working on - the one that triggered the action. What I found out is that in the miniconsole, selectString() was always searching the very first line of the miniconsole buffer. I was filling the miniconsole with many appendBuffer() calls but the cursor stayed on line 1. Which means that at least this output call doesn't update the cursor position. Did not check if cursor is advanced by echo/cecho etc... Again, do not know if it's intended this way, but it seems it could be more intuitive if the cursor is advanced with new output, same as it is in the main buffer. I am working around this by using getLastLineNumber().

Also, while I am at it :) . There is one more item that tripped me up for a few days in the beginning - the line wrap. It seems that Mudlet is breaking up the line for line wrap before executing the triggers. Which means that the trigger functionality is affected by the line wrap setting. That affects portability. Also, Mudlet will break the line in different spots if string varies, which of course it does most of the time. So, triggers can become (IMO) unnecessarily complicated. I work around this by not using line wrap on the main buffer (set it to something ridiculous, like 1000 chars). I try to funneloutput into miniconsoles or gag altogether, so it's not a big deal for me. But, ideally it would be nice to have line wrap done transparently. For example, a 200 char string broken into 3 output lines with linewrap of 80 chars, but they would all be one line for triggers and for cursor positioning. So I could move the cursor from x=5 to x=180 and it would simply move it to the 3rd "level" of the wrapped line, but it would correspond to the same y-value (and same line number) for the cursor position.

User avatar
Vadi
Posts: 4729
Joined: Sat Mar 14, 2009 3:13 pm

Re: A few small issues

Post by Vadi » Wed Sep 25, 2019 7:14 pm

Hi, welcome!

1) This issue is known: https://github.com/Mudlet/Mudlet/issues/650.

2) Not sure about the right thing here right now, it's late

3) Definitely not, that would be your game wrapping it! Mudlet's triggers aren't affected by Mudlets own linewrapping, that would be hell. In fact one of the best thing you can do is turn off the game's linewrapping to let Mudlet handle it instead so it is easier to make triggers :D

fordpinto
Posts: 3
Joined: Wed Sep 25, 2019 4:59 pm

Re: A few small issues

Post by fordpinto » Wed Sep 25, 2019 11:26 pm

Vadi wrote:
Wed Sep 25, 2019 7:14 pm
3) Definitely not, that would be your game wrapping it! Mudlet's triggers aren't affected by Mudlets own linewrapping, that would be hell. In fact one of the best thing you can do is turn off the game's linewrapping to let Mudlet handle it instead so it is easier to make triggers :D
That was a fast response!

I do not remember the exact nature of my difficulties, but I remember that changing the wrap width to 1000 chars fixed them. Maybe it was trigger modifying the initial line, but the second trigger getting 2 lines instead of 1 because the modified line got longer than wrap and got split in 2? I do not remember all that well now. I will try to remember and replicate.

The other half of my remark there was what do x,y coordinates of the console cursor mean to Mudlet? Is it position_in_a_line & line_number or is it purely x & y terminal window coordinates? If the line got wrapped around, does that affect cursor movement? I am note quite certain in the underlying concept, but since I wasn't allowing for line wrap anyway, the distinction wasn't important.

User avatar
Vadi
Posts: 4729
Joined: Sat Mar 14, 2009 3:13 pm

Re: A few small issues

Post by Vadi » Thu Sep 26, 2019 2:18 am

It'd be the former :)

Let us know of any other questions you've got!

fordpinto
Posts: 3
Joined: Wed Sep 25, 2019 4:59 pm

Re: A few small issues

Post by fordpinto » Thu Sep 26, 2019 6:21 pm

Makes perfect sense, thank you!

Edit: Removed Geyser possible issue description. If I can verify it, will post on Geyser subforum.

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests