Next small issue in your help file...
I checked out that AppendToNotepad... Works, but not quite the way the helpfile shows.
Quote:AppendToNotepad("Nick's window", "More stuff\r\n",
"another line")
Now, the \r\n is to make a new line? Doesn't seem to work properly, I keep getting errors.
Quote: Still, changing to ColourTell should do it, followed by a final ColourNote to finish off the line. Not sure where you gotta put the final ColourNote in there, it's seeming to be working just fine with only ColourNote.
Quote: If you want to do it that way, it has to go into the script file. As Flannel says, the alternative is to use the preprocessing at the packet level.
reprocessing on the packet level would work, but I don't want to mess with the ANSI coding on it, I like the colours as it is for now. Perhaps in the future.
Quote: No, it won't work in "send to script".
For one thing, notes done in "send to script" are not displayed, if the line is omitted from output.
For another thing, there is no fourth argument in "send to script". It isn't called as a function with arguments.
If you want to do it that way, it has to go into the script file. As Flannel says, the alternative is to use the preprocessing at the packet level. That isn't a problem for me, the question is of course, how do we modify a table/metatable from an alias?
Quote: Everything below this quote is an off shoot of our discussion about replacing text. First. Alias to add word replacements into a script file.
Alias match on: set replace text "*" "*"
That's all I got so far(Upon editing, re-editing, and editing the edits... I note that this isn't accurate any longer, but the alias is still important.)
I think a merger of two idea's here will work well. Can you use a table to define the replace text? Hack code job to follow the real code:
function ToTextReplace (name, line, wildcards, styles)
for _, v in pairs (styles) do
ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
(string.gsub (v.text, "Altair", "Dummy")))
end
end
here's the pseudo table:
text = {}
text.list = {
1 = 'Altair',
2 = 'Ceriloch',
3 = 'Ragnar'
}
text.replacelist = {
1 = 'Moe',
2 = 'Larry',
3 = 'Curly'
}
Ok, time for a buncha pseudo-code of my own creation, of course it'll be wrong, but you'll get the idea
function textreplace (name, line, wildcards, styles)
Ok, first compare the wildcard to the text.list table, does any of them match the criteria?
Yes, Ok, then set it as text.match(see below)
text.match = text.list.1
Compare the text.list table, to the text.replace table.
Match them up accordingly, and set text.replacetext to the corresponding text.list match.
text.replacetext = text.replace.1
Continue with rest of the code, but with the modification as follows
for _, v in pairs (styles) do
ColourTell (RGBColourToName (v.textcolour),
RGBColourToName (v.backcolour),
(string.gsub (v.text, text.match, text.replacetext)))
end
else -- Pseudo code is basically an if statement.
end -- if statement
end -- function
I'm certain there is an easier way, I'm can't seem to think of it at the moment, but this seems pretty straight foreward.
Make a table with the matches, make that table with the replace text, when a trigger, which is setup by the alias, goes off, it runs the script, which checks the lists(gonna find out who's naughty or nice), converts into text.match and text.replacetext, and substitutes it. Hell, I got most of the idea down, the problem is coding it, which I'm not sure about.
Alias sets up trigger to match on the match word.
Alias adds to tables text.list and text.replace
Trigger goes off, runs through script.
Script checks its text.list table, converts to text.match(for the match)
Script checks its text.replace table, converts the corresponding replace text to text.replacetext
Script runs through the gambit, and bam, you have a fully customizable auto-word replacement script.
A second alias, would remove the Trigger, and the appropriate information within the tables.
Alias match on: remove replace text "*" |