PDA

View Full Version : Some Profanity-related Questions



Samire
07-08-2018, 10:13 PM
Looking for some help to accomplish a couple things with Profanity if anyone can assist.

1. I want thoughts, LNet, Voln, etc messages to show up in both the main window and their own dedicated window. This way I can keep up as I am staring at combat scroll without losing the consolidation of messages.

2. I want to display customized script content in its own window. I figure I can either get the profanity.rb file to recognize lich methods (like GameObj.npcs) or, in a separate lich script, push content into the profanity window. But, I'm not sure how to approach either.

Any help is appreciated.

Samire
07-12-2018, 11:38 PM
I'm hoping to try again and see if anyone has any guidance they can provide here since I am stumped.

Re: #1

It's definitely possible to repost the line to the main window with something like this:

if current_stream =~ /^(?:thoughts|voln|lnet)$/
stream_handler['main'].add_string(text, line_colors)
end

The problem is that every time you call the add_string method it wipes out the line_colors array resulting in the second time it is called for the same text line (whether it is for the main window or the thoughts window), the start position is off and the text begins off screen.

I have tried redefining line_colors again before calling add_string, saving into another variable, and attempting to post directly from within the window class, but can't get this displaying right.


Re: #2

Requiring the lich.rbw file in the profanity.rb file straight up fails. So I can't put my script directly into the profanity.rb file. It's preferred for it to be external anyway and I can require the profanity.rb file, but I probably need to split that file for it to work. Perhaps all of the methods into a single file and a separate file that starts the thread. I've played with this bit but can't get profanity to load when the file is split.


Any thoughts that would give me a different direction to pursue?

Thanks

BigWorm
07-13-2018, 03:06 AM
Take a look at ;showxml in the repo. It demonstrates how to send XML to an arbitrary window. You can create another <window ... value="custom_window_name" ... > to your profanity config for your custom script.

Samire
07-14-2018, 02:01 AM
Thank you for your response and direction. Do you use puts to insert xml that can be picked up by the script? It looks like that is what the showxml script is doing. But in profanity, it just scrolls the output taking over the whole terminal. I tried to target the output to the main window using ;showxml id=main but that didn't work.

I added the window in .profanity.xml with class='text' value='npcs'. In my script if I do something like

puts "<component id='npcs' />#{npcs}</component/>\n"

it just pastes the string in the quotes in the terminal (in no specific window) as if it were a respond.

Donquix
07-14-2018, 03:07 AM
Thank you for your response and direction. Do you use puts to insert xml that can be picked up by the script? It looks like that is what the showxml script is doing. But in profanity, it just scrolls the output taking over the whole terminal. I tried to target the output to the main window using ;showxml id=main but that didn't work.

I added the window in .profanity.xml with class='text' value='npcs'. In my script if I do something like

puts "<component id='npcs' />#{npcs}</component/>\n"

it just pastes the string in the quotes in the terminal (in no specific window) as if it were a respond.

use _respond (with the underscore) to poop things with tags back out from a lich script that profanity will digest correctly.

Samire
07-14-2018, 09:39 PM
Oh, you're beautiful! I've got this working. Thank you so much.

_respond "<pushStream id='npcs'/>#{npcs}<popStream/>\n"