Ref: a. My beginnings - http://www.gammon.com.au/forum/?id=14661
b. Tabbed Miniwindow - https://www.gammon.com.au/forum/?id=14161
c. Scrolling Text - http://www.gammon.com.au/forum/?id=13916
d. Fiendish's tabbed miniwindow - https://github.com/fiendish/aardwolfclientpackage/blob/MUSHclient/MUSHclient/worlds/plugins/aard_channels_fiendish.xml
e. My miniwindow chat - https://github.com/DBNU-Braska/DBNU/blob/non-msdp/DBNU_Chat_Miniwindow.xml
f. my_chat.lua - https://github.com/DBNU-Braska/DBNU/blob/non-msdp/My_Chat_Window.lua
Good day!
I'm back at it again and as always a little lost.
I was looking into how Fiendish does his tabbed miniwindow over on Aardwolf (ref d), but that I believe is much too big of a jump for me from what I have right now, ref e/f.
Some background. I started with having a single miniwindow that had all the different channels being captured into it. I moved on to using a couple of different miniwindows, each with different channels. What I would like to do now is to be able to put these all back into '1' miniwindow that is tabbed.
Of course the way that Fiendish has done it is so elegant and works great for Aardworlf, though it's a huge jump.
Some of the features I would like right now are:
Scrolling text with mousewheel
resiseable miniwindow
add/remove tabs
selectable text within tabs (for copy/paste)
I think that the add/remove tabs part is probably not within my knowledge right now, I tried to read what Fiendish has done but with the untagged_channels, and non-channels bits, I got a bit overwhelmed when having to deal with so many different xml/lua files. Maybe I'm biting off too much at once.
I currently have a miniwindow that works and grabs all the info I want it to... I just can't select text (other than it copies the full line) nor does it mousewheel scroll.
Where should I start when it comes to working with this? I am unsure but believe that my current chat_miniwindow might be a bit out of date and may need to be redone to accommodate the features that I would like.
In my mind, I know this is completely possible, it's just taking me awhile to get things put into perspective. I thought if I would share my idea, I could get some insights and wisdom along with motivation to help me move forward.
Thanks for your help folks. (also for fiendish, whom received an unsolicited email from me, I apologise for that. You were kind and answered my questions, but I have stopped myself countless times from sending you more questions!... )
Selectable text in a miniwindow is a huge amount of work if you want to invent it from scratch, but you can use mine. It's entirely modular except for the dependency on my color functions, which you'd have to customize for any MUD that doesn't do color codes the same way Aardwolf does. It does wrapping, selecting, copying with or without color codes, wheel scrolling, scrolling while selection dragging, clickable hyperlinks, custom callbacks on display update, custom extendable right-click menu, and bold font display.
which you'd have to customize for any MUD that doesn't do color codes the same way Aardwolf does.
Looking at the two files, you said that I'd have to rewrite the custom colours to work with my specific MUD.
I suppose the colours.lua file is the best place to start...
In my specific MUD - the ANSI colours are called with the & (amp) prefix character and the xterm colours with the ` (tilde?) prefix character.
Like your file, &r would be red, and &R would be bright red (bold ansi).
For xterm, `y being dark yellow (i.e. ansi orange) and `Y being bright yellow (i.e. ansi bright yellow). You can also use xterm by using the full colour codes such as `[F005] being bright blue (i.e &B or ansi bright blue).
That being said, before I even get into the functions within the file, I seem to have an ansi prefix and a different xterm prefix. But I should be able to define an XTERM_PREFIX and redefine XTERM_CODE, right?
I don't believe I have a 300, 260, 250 pattern differences, only X_NONNUMERIC_PATTERN and X_DIGITS_CAPTURE_PATTERN.
What does TILDE_PATTERN define in your case?
Ok, enough questions for one post. I will upload my version of this to Git here: https://github.com/DBNU-Braska/DBNU/blob/non-msdp/DBNU_colours.lua
I'm looking at the aardwolf_colours.lua file and how it relates to text_rect.lua.
From what I can see, and from what I was able to test while logged into Aardwolf was that the colours.lua file enables the ability to copy/paste text/characters within the communications log WITH Aardwolf colourtags. When you right click you get either copy, copy no colour, or copy all.
I am not sure I have a use case that requires me to get the colour tag from the comm log. Thus, if I were to not need that functionality, would I be able to remove the functions used within text_rect.lua that call to aardwolf_colours.lua?
Sooo, I may have did a "daddy biiig mess" as my daughter would say.
I have went through the following files and made an effort to remove the requirement to do any colour formatting functions from within aardwolf_colors.lua.
I've renamed some of them, just so I can track which ones I am working on. I have also removed the parts that reference GMCP as I don't have that in the MUD at this time. Lastly, I have not updated the triggers yet, which is going to be the main method at the moment in how I will grab the MUD Channel texts.
The files I've went through and taken a look at are:
aardwolf_colors.lua
aard_channels_fiendish.xml
aard_miniwindow_z_order_monitor.xml
aard_register_on_z_create.lua
mw_theme_base.lua
repaint_buffer.xml
scrollbar.lua
text_rect.lua
aard_theme_controller.xml
I have moved/loaded all the files, to try and see if I could at least get the aard_channels_fiendish to load (and not do anything yet...), without success. There were a few bugs of where I didn't comment out the closing of an if/end etc, but now I am stuck with a different error and I don't know how to find it.
When I load DBNU_channels_fiendish.xml I get:
Line 87: Attribute name must start with letter or underscore, but starts with "-" (Cannot load)
I've looked through the code but cannot seem to locate this error at this time.
Is it too much to ask for someone to have a look at this for me? I'm using a fresh install of MUSHClient 5.06. I've added the above files into their respective folders.
If you want to have a look at it within my MUD, it can be found at: dbnumud.com:4321 I'm usually logged in and can be found as Braska(IMM IGN). I am not the owner of this one, but it is the primary one I am doing work on at this time.
You've tried to comment out a section of the plugin XML using Lua comment indicators instead of XML comment indicators. XML doesn't use -- for comments.
You are absolutely correct! Thank you for pointing that out.
I have a couple more errors and questions to ask.
First thing was that I had to add banker_round() to the file as it didn't seem to exist anywhere. I found a post on the forums here that had it, so I just used it from there.
The next thing I have now is that rightclick is not working correctly.
Error number: 0
Event: Run-time error
Description: C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:844: attempt to index local 'ems' (a nil value)
stack traceback:
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:844: in function 'rightClickMenu'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:659: in function <C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:655>
Called by: Function/Sub: TextRect.mouseUp called by Plugin DBNU_Chat_Capture_Miniwindow
Reason: Executing plugin DBNU_Chat_Capture_Miniwindow sub TextRect.mouseUp
When I take a look at text_rect, I can't seem to find the function that ems is supposed to be tied to
local ems = self.external_menu_string_generator()
--- (and further up the file) ---
function TextRect:setExternalMenuFunction(menu_string_generator, menu_result_function)
self.external_menu_string_generator = menu_string_generator
self.external_menu_result_function = menu_result_function
end
Where can I find this external... function? I looked throughout the client folders but didn't seem to be able to locate it..
I just finished adding in all of my triggers for each channel.
I went through and worked out which of my channels are non-channels vs channels like the original so that I could mimic the same functionality.
I give it a run, and first time logging in, I get:
Error number: 0
Event: Run-time error
Description: C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:100: bad argument #1 to 'gmatch' (string expected, got table)
stack traceback:
[C]: in function 'gmatch'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:100: in function 'findURLs'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:115: in function 'addStyles'
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:704: in function 'storeTab'
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:723: in function 'storeNonChannel'
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:632: in function 'stampAndStore'
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:685: in function <[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:684>
Called by: Function/Sub: chats called by trigger
Reason: processing trigger "Info" when matching line: "[Info] -> Alucard has joined the game!"
Looking at gmatch, it is being supplied a table from 'rex'?
Also, the matching line is NOT a url, so is it thinking it is for some reason?
Quote: First thing was that I had to add banker_round() to the file as it didn't seem to exist anywhere.
It's round_banker, and I put it in my copy of commas.lua for some reason. I don't remember why.
Quote: Where can I find this external... function?
You must have called setExternalMenuFunction in your plugin.
Quote: Looking at gmatch, it is being supplied a table from 'rex'?
No it isn't. findURLs expects plain text, not a table. You've removed my color functions so now you have nothing converting the styles into plain text anymore. You can't just remove function calls and expect things to keep working without dealing with the results from your changes.
You've removed my color functions so now you have nothing converting the styles into plain text anymore.
Point taken.
Is it possible that you could provide examples for the patterns within aardwolf_colors.lua?
I think I am going to have to modify some of the code to accommodate for how my MUD does ansi colour (using prefix "&") vs xterm colour (using prefix "`").
I tried looking at helpfiles within Aardwolf, but I can't seem to find an example of how it shows ansi vs xterm colours. (X_NONNUMERIC_PATTERN, X_THREEHUNDRED_PATTERN, X_TWOSIXTY_PATTERN, X_TWOFIFTYSIX_PATTERN, X_DIGITS_CAPTURE_PATTERN, X_ANY_DIGITS_PATTERN)
I am trying to understand how to make my own colourtostyles (and vice-versa) with the fact that not all my colours use the same prefix. In aardwolf_colors.lua it has
if code == XTERM_CODE then -- xterm 256 colors
already inside CODE_PREFIX. I think I need to modify mine here since my xterm colours are in the form `[%D%d%d%d].
If you look at the xterm helpfile ref'd earlier you can see that all my xterm colours are in the form `%s for a few presets, and then in the form `[(F or B)%d%d%d], so they are all in the form of 3 digits preceded by a F (foreground) or B (background).
Is that right? I'm trying to understand this correctly and write my own file based on the aardwolf one here.
Quote: Is it possible that you could provide examples for the patterns within aardwolf_colors.lua?
I thought you said you weren't going to bother with colors at all? Anyway, you don't need to know how color codes work to extract plain text from styles as is needed for the findURLs function. Just iterate over the styles and pull out the .text fields and concatenate them.
Quote: I tried looking at helpfiles within Aardwolf, but I can't seem to find an example of how it shows ansi vs xterm colours
@r and @R and @b and @B etc. are regular colors.
@x1 and @x01 and @x001 are xterm colors. Aardwolf allowing non-zero-padded forms makes things more complicated.
Quote: B (background)
Aardwolf doesn't do background colors. Good luck! The extra work to add background colors may be nontrivial.
Well, I really like your plugin. The more I can learn from it and actually implement it's capabilities, the better set I am for other plugins I want to write.
So, my mud has used Kavir's snippet to implement xterm 256 colours. Not a huge thing but there is a bit of a problem in that the sequencing of numbers used to show colors goes from 000-555 but in base 6. For example, the first set of colours uses 000-005, 010-015, 020-025, 030-035, 040-045, 050-055. Then it jumps to 100.. all the way to 155, then 200 to 255, up to 555.
All I have right now, is a box that won't grab text and throws an error when I right-click it. But hey, I have a box! And it's glorious!
Well, I'd start by putting my color functions back in place and then replacing or updating only the ones that deal with codes. Some of those functions like TruncateStyles and strip_colours_from_styles are critical and not affected by different color code schemes.
The only part of text_rect that cares about color codes is the OPTIONAL addColorLine method and the OPTIONAL copying with color codes.
So I am trying to trace the path of information through the script so that I can understand where things may be going wrong for me. I've been trying to remove some of the colour stuff, but it is hard as some functions in the colour file don't necessarily do 'only' colour stuff.
I'm trying to trace the error from Reply #9. And in doing so, try to understand how the miniwindow prints the text.
When I run a test trigger in MUSHClient (all my files can be found at ref), the information is right away picked up and sent to my first function (non_channel) as it should, sent to stampAndStore and then storeNonChannel. I get(i just did some prints):
-Non-Channel-
Name: Info
Line: [Info] -> Alucard has left the game.
Wildcards: table: 07781C20
Styles: table: 077860B0
-stampAndStore-
msg sent to filter_as_needed
-filter_as_needed-
msg sent to ColoursToStyles:
Sent to storeNonChannel
-storeNonChannel-
styles: table: 07785E10
label: Info
I'm not yet very good with tables, I understand them, but I don't know how gmatch is supposed to get a string when all along styles is a table (line 100 in text_rect.lua). Can someone explain/teach/enlighten me on how this works?
Quote: some functions in the colour file don't necessarily do 'only' colour stuff
There are your server's color codes embedded into text, and there are ANSI sequences embedded into text, and there are MUSHclient's style run tables, and they are all different, and manipulating them requires navigating the different ways that they encode color information.
Quote: I don't know how gmatch is supposed to get a string when all along styles is a table
Notice the word "text" in
re:gmatch(text,
Also the word "text" in
function TextRect:findURLs(text)
You've done:
local urls = self:findURLs(styles)
Notice the word "styles".
I do
local urls = self:findURLs(strip_colours_from_styles(styles))
See the difference?
This is why I said that you can't just remove functions calls and expect things to keep working without dealing with the results from your changes.
Oh gosh, I thought I had reverted all your colour stuff. Thank you.
So, the miniwindow prints the line of text that I throw at it. (almost perfectly)
I don't think I fully understand the extent of what your colour files do compared to the original chat_miniwindow that I have.
When I use the test trigger function within MUSHClient, I send/receive the following:
Send:[Info] -> Alucard has left the game.
Receive: &w[Info] -> Alucard has left the game.
It seems to be spitting out the code_prefix and w (white?).
Also, when I actually login and see how it performs, it works, but I don't understand how/why it is striping all the colours? I'm going to try and trace this one down now.
I don't believe this is going to work out very good for me. I'm still trying to figure out if I am able to do colours the way you have. Ansi colours are easy, but the xterm stuff is not trivial for my MUD, and this function will undoubtedly be the death of me.
Then that split. In my MUD, colours are shown with both &%D format for ansi and `[F%d%d%d] format for xterm.
All my triggers are working (it seems) except for one:
match="[DBNU Auction House] (.+)$", and example being: [DBNU Auction House] -> The item [Some Instant Rice] is being auctioned for [0] Zeni by the player Braska
Function/Sub: non_channel called by trigger
Reason: processing trigger "Aution_House" when matching line: "[DBNU Auction House] -> The item [Some Instant Rice] is being auctioned for [0] Zeni by the player Braska"
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:726: attempt to index field '?' (a nil value)
stack traceback:
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:726: in function 'storeNonChannel'
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:630: in function 'stampAndStore'
[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:685: in function <[string "Plugin: DBNU_Chat_Capture_Miniwindow"]:684>
Any ideas what it is thinking here? the regex works since it is taken from my other miniwindow plugin, but it doesn't seem to like it here.
Lastly, I'm going to start looking at this right-click issue. Seems hotspots (which I don't fully understand) may not all be working? the scroll-wheel doesn't seem to be working yet either - doesn't throw any errors, but doesn't scroll other than with the scroll-bar.
Function/Sub: TextRect.mouseUp called by Plugin DBNU_Chat_Capture_Miniwindow
Reason: Executing plugin DBNU_Chat_Capture_Miniwindow sub TextRect.mouseUp
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:844: attempt to index local 'ems' (a nil value)
stack traceback:
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:844: in function 'rightClickMenu'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:659: in function <C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:655>
That's the right-click error. I had mentioned it earlier. Where do I find
It looks like there was a bug in my plugin where the right-click menu text didn't get returned if my echo plugin wasn't loaded. Move https://github.com/DBNU-Braska/DBNU/blob/non-msdp/DBNU_channels_fiendish.xml#L1349 one line down.
Thanks Fiendish, that certainly made things start to look a lot more interesting.
As stated earlier, it seems to be catching everything except the auction house channel. Not sure what is causing that one yet, but I haven't looked into it much actually.
I wanted to keep moving forward with the capabilities of the plugin. I am working on adding the echo capability. It seems that the plugin works so far as it removes echo for my non-channels, but not for the channels. I believe because I am not getting the channels from gmcp, I may have missed a few things when rewriting? I have added all the triggers, from the channels.xml. I don't believe I have added all the functionalities for channels yet and may still have some stuff commented out that I shouldn't.
Another question I have is ref addDefaultchannels or addDefaultnonchannels: Since all of my info is coming from triggers, should I be enabling all the channels and nonchannels within the respective function or can I just have them set to enabled="y" right from the beginning?
Ref: a. https://github.com/DBNU-Braska/DBNU/blob/non-msdp/DBNU_chat_echo.xml
b. https://github.com/DBNU-Braska/DBNU/blob/non-msdp/DBNU_channels_fiendish.xml
Working through the two plugins (chat_miniwindow, chat_echo), I've run into two issues.
1. With the Chat_miniwindow: I can't seem to get the trigger for my auction channel to work. It works in a regular chat miniwindow, but doesn't seem to want to in this plugin.
Is this something to do with it having more than one set of "[]" in the string? I can't seem to find the error.
2. With chat_echo: I somehow have mixed the tables up. My non-channels work just fine, but the channels do not work at all. I added a check within the code (ref a), 449-455, and notice that my channels are being included in my non-channels.
Can someone show me how/where I have gone wrong with the channels_table vs nonchannels_table?
Quote: I can't seem to get the trigger for my auction channel to work. It works in a regular chat miniwindow, but doesn't seem to want to in this plugin.
You misspelled the name of the trigger.
Quote: My non-channels work just fine, but the channels do not work at all.
You enable your nonchannel triggers but not your channel triggers.
To elaborate on my second problem. If you saw within my DBNU_channels, I had tried to do a enabletrigger/check_channel_trigger in extend_rightclick_menu_result. When I did this, I cannot change any of the "edit channel captures" under "Tab capture settings". They all just stay enabled.
The table issue as mentioned in my last post, I cannot seem to add/remove echo for my channels. The tables somehow are mixed up and can't find it. From the check I added, this is what shows up when I do "chats echo" and have "Echo none"
See how in the nonchannel echos the channel echos are in there? I can't find where I mixed those up. Note that it does not change the echo state of the channels at all. They still do not echo.
No change. Still cannot change the echo settings for my channels. Non channels seems to work fine.
I don't understand how the end_gag trigger group interacts with all the triggers. I see that it is set whenever I use the non-channels, but I don't have the same for channels.
Is this what I should have when I enable/disable echo for channels?
You aren't using GMCP for channels, so your channels and non-channels are split entirely arbitrarily. You should be doing exactly the same thing for both of them. If you're not, where and why not?
The only reason any of _my_ settings are handled differently from each other is that Aardwolf use GMCP for channels and not for other things. You're not doing that so you should not be handling them differently. You can have as many groups of things as you want, but if all you're doing is toggling triggers, they should all end up in the same code doing the same things.
Yes, I understand that getting the info from GMCP will be different. I was trying to keep channels (you can talk/influence these) and nonchannels (broadcasts/events/non-discussion) separate.
I believe I have chat_echo working the way I would like from a functionality sense. However, in the background I am still getting a mixup in tables. Not sure how to clear all the 'cache' maybe to fix things? When I print out the channel table, and the nonchannel table, I get channels included in the nonchannels.
Is there something I am doing wrong here? I still haven't been able to decipher the tables in knowing why they get included in each other...
I am working on the copy ability within the plugin. I have been able to get copy all working without copying colour codes. However, I can't seem to understand what my problem is with copying a selection of text.
I believe that my error is somewhere within TextRect:selected_text() but I'm not exactly sure.
The error suggests it is coming from table.concat(). I do believe it is coming from line 953 where I, like stated before, I'm not fully comfortable with how to manipulate tables.
Here is the error:
Function/Sub: TextRect.mouseUp called by Plugin DBNU_Chat_Capture_Miniwindow
Reason: Executing plugin DBNU_Chat_Capture_Miniwindow sub TextRect.mouseUp
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:990: invalid value (table) at index 1 in table for 'concat'
stack traceback:
[C]: in function 'concat'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:990: in function 'selected_text'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:930: in function '?'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:868: in function 'rightClickMenu'
C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:659: in function <C:\Program Files (x86)\MUSHclient\lua\text_rect.lua:655>
The problem as ever is that you've made a change that doesn't account for what the original was doing. StylesToColours takes a table and produces a string. That means that current_message is a table and s_text is supposed to be a table of strings. But now you're generating a table of tables instead of a table of strings. Tables cannot be concatenated together by "\n". Only strings can.
StylesToColours takes a table and produces a string.
Thank you for the nudge in the right direction. I don't think I know how to create this on my own, but I can at least read StylesToColours and remove the parts that are causing me this problem now.
I'm going to read through chat_echo again and try to see if I can pinpoint the issue with the combining tables...
Ok, so a fresh install fixed the tables issue. If at all possible, is there a way to do this type of reset/refresh without that?
Onto scrollbar.lua, it seems that I can't scroll with my mousewheel. Is there something in MUSHClient settings that I need to change to enable this? It works out of the box within AardMUSH, but having it included/required for my DBNU_Channels_fiendish.xml doesn't make any difference.
Sorry, I'm getting mixed up with my scroll research.
I'm looking through text_rect.lua for the scrollable parts. Trying to see where maybe I have gone wrong here? But I don't think I've changed anything wrt scrolling.
I did delete the files within state, and it did not seem to do anything. In fact, now there just are no files in there at all. Is there somewhere else I am supposed to find them?
This might be useful as I am also looking to figure out where some of the tables are saved, or how to save things like (different topic...) maps. I'll most likely make a different post for that plugin, but wondered where I am supposed to find saved items like that.
WRT the mouse-wheel scrolling, is there anything someone can help me with here? It seems perhaps it has to do with hotspots, but I haven't changed anything about them in any of the files compared to the originals.
Quote: I did delete the files within state, and it did not seem to do anything. In fact, now there just are no files in there at all. Is there somewhere else I am supposed to find them?
Where are you looking? Where is your MUSHclient folder?
When I originally removed the state files, they were within \MUSHclient\worlds\plugins\state. My MUSHClient is installed as a normal install and is in C:\Program Files (x86)\MUSHclient
Quote: My MUSHClient is installed as a normal install and is in C:\Program Files (x86)\MUSHclient
Don't put it there.
Windows will hide the files from you if an application tries to write to "C:\Program Files\" and put them under C:\Users\<My Account>\AppData\Local\VirtualStore\
Try these links for more info
https://domainwebcenter.com/invisible-files-in-windows-7-program-files/
https://www.networkinghowtos.com/howto/windows-virtual-store-location/
Put it anywhere that isn't protected by the OS. Many people choose their desktop or documents folders. I make my installer default to the desktop for this reason.
Alright, so fresh install in a nice non-windows protected area. State files are being created and I can delete them, etc.
mouse-wheel scrolling... :( I am at a loss to why it does not work.
It works in AardMUSH, but not in regular mushclient. Is there a plugin I am not using correctly or a file I am missing? I feel that I have traced it all down to the right ones.