Files
Mush-Soundpack/cosmic rage/worlds/plugins/output_functions.xml
2025-07-01 23:28:00 +03:00

442 lines
8.0 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Tuesday, April 06, 2010, 8:39 AM -->
<!-- MuClient version 4.46 -->
<!-- Plugin "output_functions" generated by Plugin Wizard -->
<muclient>
<plugin
name="output_functions"
author="Weyoun"
id="54846c23d8b15594e7eb4b8a"
save_state="y"
language="Lua"
purpose="provides functions to help tts users."
date_written="2010-04-06 08:37:40"
requires="4.46"
version="1.0"
>
</plugin>
<!-- Aliases -->
<aliases>
<alias
match="Line_Get *"
enabled="y"
script="LineGet"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="clearoutputbuffer"
enabled="y"
script="clearlines"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="clearoutputwindow"
enabled="y"
script="clearwindow"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="prevline"
enabled="y"
script="prev_line"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="toggleoutput"
enabled="y"
script="output_toggle"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="toggleinterrupt"
enabled="y"
script="interrupt_toggle"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="curline"
enabled="y"
script="cur_line"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="select *"
enabled="y"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
<send>
if "%1" == "space" then
selectscr(" ")
else
selectscr("\\r\\n")
end
</send>
</alias>
<alias
match="nextline"
enabled="y"
script="next_line"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="whichline"
enabled="y"
script="which_line"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="topline"
enabled="y"
script="top_line"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="snap_shot"
enabled="y"
script="snapshot"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
<alias
match="endline"
enabled="y"
script="end_line"
omit_from_output="y"
omit_from_log="y"
omit_from_command_history="y"
send_to="12"
sequence="100">
</alias>
</aliases>
<!-- Get our standard constants -->
<include name="constants.lua"/>
<!-- Script -->
<script>
<![CDATA[
for i = 1, 9 do
Accelerator("ctrl + "..tostring(i), "Line_Get "..tostring(i))
end
Accelerator("ctrl +0", "Line_Get 10")
Accelerator("ctrl + shift + c", "clearoutputbuffer")
Accelerator("ctrl + alt + shift + c", "clearoutputwindow")
Accelerator("ctrl+shift+o","nextline")
Accelerator("ctrl+alt+enter","toggleinterrupt")
Accelerator("ctrl+alt+o","toggleoutput")
Accelerator("ctrl+shift+i","curline")
Accelerator("ctrl+shift+space","select line")
Accelerator("ctrl+shift+alt+space","select space")
Accelerator("ctrl+shift+u","prevline")
Accelerator("ctrl+shift+n","endline")
Accelerator("ctrl+shift+y","topline")
Accelerator("ctrl+shift+h","whichline")
Accelerator("ctrl+shift+alt+s","snap_shot")
function selectscr(eol)
buffercheck()
if selecting ~= 1 then
selecting = 1
Execute("tts_interrupt selection start.")
tselect = {}
sline = cline
else
if eol == " " then
Execute("tts_interrupt Selection coppied without line breaks.")
else
Execute("tts_interrupt Selection coppied.")
end
for i = sline, cline do
table.insert(tselect, GetLineInfo(i, 1))
end
SetClipboard(table.concat(tselect, eol))
selecting = 0
tselect = {}
end
end
function output_toggle()
if GetVariable("output") ~= "1" then
SetVariable("output", "1")
Note("output notepad on")
else
SetVariable("output", "0")
Note("output notepad off")
end
end
function interrupt_toggle()
if GetVariable("interrupt") ~= "1" then
SetVariable("interrupt", "1")
Note("interrupt on enter on")
else
SetVariable("interrupt", "0")
Note("interrupt on enter off")
end
end
function LineGet(name, line, wc)
lines = GetLinesInBufferCount()
line = GetLineInfo(lines - wc[1], 1)
if line == nil then
Sound(GetInfo(67).."sounds/pm/bonk.ogg")
return
end
wc = wc[1]
local timeout = 0.4 -- in seconds
if modes[wc] == nil then
modes[wc] = {os.clock(), 1}
elseif os.clock()-modes[wc][1] >= timeout then
modes[wc][1] = os.clock()
modes[wc][2] = 1
else
modes[wc][1] = os.clock()
modes[wc][2] = modes[wc][2] + 1
end
if modes[wc][2] >= 3 then
PasteCommand(line)
Execute("tts_interrupt pasted.")
end
if modes[wc][2] == 2 then
SetClipboard(line)
Execute("tts_interrupt copied.")
end
if modes[wc][2] == 1 then
Execute("tts_interrupt "..line)
end
end
function OnPluginCommandEntered(s)
if world.GetVariable("interrupt") == "1" then
Execute("tts_stop")
end
end
function OnPluginInstall()
if GetVariable("output") == nil then
SetVariable("output","1")
end
modes = {}
msgbuffer = {}
cline = 1
lastcount=0
line = 0
selecting = 0
end
function OnPluginScreendraw(t,l,line)
buffercheck()
if(GetVariable("output")=="0") then
return
end
if GetInfo(113) then
AppendToNotepad("output", line.."\r\n")
else
table.insert(msgbuffer, line)
end
end
function OnPluginGetFocus()
if GetVariable("output") == "0" then
return
end
if #msgbuffer > 0 then
for i, buffered in ipairs(msgbuffer) do
AppendToNotepad("output", buffered.."\r\n")
end
msgbuffer={}
end
end
function prev_line()
buffercheck()
oline = cline
cline = skipblanklines(cline - 1, 'b')
line = GetLineInfo(cline, 1)
if cline == oline then
Sound(GetInfo(67).."sounds/pm/bonk.ogg")
end
Execute("tts_interrupt "..line)
end
function cur_line()
buffercheck()
line = GetLineInfo(cline, 1)
Execute("tts_interrupt "..line)
end
function next_line()
buffercheck()
oline = cline
cline = skipblanklines(cline + 1, 'f')
line=GetLineInfo(cline,1)
if cline == oline then
Sound(GetInfo(67).."sounds/pm/bonk.ogg")
end
Execute("tts_interrupt "..line)
end
function end_line()
cline = skipblanklines(GetLinesInBufferCount(), 'b')
line=GetLineInfo(cline,1)
Execute("tts_interrupt Bottom: "..line)
end
function which_line()
buffercheck()
Execute("tts_interrupt line "..cline.." of "..GetLinesInBufferCount() -1)
end
function top_line()
cline=skipblanklines(0, 'f')
line=GetLineInfo(cline,1)
Execute("tts_interrupt top: "..line)
end
function snapshot()
require "wait"
wait.make(function()
Execute("tts_interrupt Beginning snapshot, please wait....")
wait.time(0.5)
for snapline=1, GetLinesInBufferCount() - 1 do
AppendToNotepad("snapshot",GetLineInfo(snapline,1).."\r\n")
end
ActivateNotepad("snapshot")
end)
end
function clearlines(n,l,w)
world.DeleteOutput()
world.Note("output buffer cleared")
cline=1
lastcount=0
line=GetLineInfo(cline,1)
selecting = 0
end
function clearwindow()
ReplaceNotepad("output")
Execute("tts_interrupt output window cleared")
end
function skipblanklines(ln, dir)
count = GetLinesInBufferCount()
if ln < 1 then
return skipblanklines(1, 'f')
elseif ln > count - 1 then
return skipblanklines(count - 1, 'b')
end
i = ln
while i > 0 and i < count and GetLineInfo(i, 1) == "" do
if dir == 'b' then
i = i - 1
else
i = i + 1
end
end
if i == 0 or i == count then
if GetLineInfo(ln, 1) ~= "" then
return ln
elseif i == 0 then
return skipblanklines(1, 'f')
elseif i == count then
return skipblanklines(count - 1, 'b')
end
else
return i
end
end
function buffercheck()
curcount = GetLinesInBufferCount()
if curcount < lastcount then
if cline > 100 then
cline = cline - 100
else
cline = 1
end
if selecting == 1 then
if sline > 100 then
sline = sline - 100
else
sline = 1
end
end
end
lastcount = curcount
end
]]>
</script>
</muclient>