Im so fucking based im the hecking best

This commit is contained in:
UndeadMaelys
2022-05-04 23:07:36 +02:00
parent c22ab0b7a9
commit 77303a288a
11 changed files with 151 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
require "R2H2"
function strip_symbols(str)
local symbol_table = "'~()!?:></.\t"
for i=1, #symbol_table do
@@ -30,7 +31,32 @@ function apply_html(path)
print(html)
end
function convo_image(string,alt_text)
if string then
apply_html("html/convo/header/image/start.html")
print(string)
apply_html("html/convo/header/image/middle.html")
print(alt_text)
apply_html("html/convo/header/image/end.html")
end
end
function convo_header_start()
if not header then
header = true
apply_html("html/convo/header/start.html")
end
end
function convo_header_end()
if header then
header = false
apply_html("html/convo/header/end.html")
end
end
function convo_start(color)
convo_header_end()
if not convo then
if color then
apply_html("html/convo/start_green.html")
@@ -42,6 +68,7 @@ function convo_start(color)
end
function convo_end()
convo_header_end()
if convo then
apply_html("html/convo/end.html")
convo = false
@@ -61,20 +88,23 @@ local content = ""
local p = 0
local s = 0
local convo = false
local header = false
local green = true
local skip = 1
local user = {}
while p ~= nil do
s = s + 1
local np = string.find(text,"\n",p+1)
if np and p - np ~= 1 then
if p then
skip = 1
if string.sub(text,p+1,p+1) == "\n"
or string.sub(text,p+1,p+1) == "/" then
-- end of new bubble
convo_end()
elseif string.sub(text,p+1,p+1) == "\t" then
-- its tabbed so its spoken?
convo_start(
)
convo_start()
apply_html("html/convo/text/start_roman.html")
print(string.sub(text,p+2,np-1))
--content = content .. " " .. reverse_verbs(strip_symbols(string.sub(text,p+2,np-1)))
@@ -84,6 +114,10 @@ while p ~= nil do
apply_html("html/convo/text/start_heonian.html")
print(convertToHeonian(string.sub(text,p+2,np-1)).."")
apply_html("html/convo/text/end.html")
elseif string.sub(text,p+1,p+1) == "i" then -- independant image, no username
convo_start(green)
convo_header_start()
convo_image(string.sub(text,p+3,np-1))
else
-- new user name
convo_end()
@@ -92,15 +126,32 @@ while p ~= nil do
else
green = true
end
convo_start(green)
apply_html("html/convo/header/start.html")
convo_start(green)
-- this is a header section
convo_header_start()
-- lets check for images
local nl = string.find(text,"\n",p+1)
local nlp = string.find(text,"\n",nl+1)
current_user = string.sub(text,p+1,np-1)
user[current_user] = user[current_user] or {image = nil}
if nlp and string.sub(text,nl+1,nl+1) == "i" then
user[current_user].image = string.sub(text,nl+3,nlp-1)
skip = 2
end
convo_image(user[current_user].image)
apply_html("html/convo/header/name/start.html")
print(string.sub(text,p+1,np-1))
apply_html("html/convo/header/name/end.html")
apply_html("html/convo/header/end.html")
header = true
end
end
p = string.find(text,"\n",p+1)
while skip > 0 do
p = string.find(text,"\n",p+1)
skip = skip - 1
end
else
break
end