Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------
- --Font module------------------------
- -------------------------------------
- local Font = (function()
- local function split(str,sep)
- local fields={}
- str:gsub(("([^%s]+)"):format(sep),function(c)table.insert(fields,c) end)
- return fields
- end
- local function RAS(t)
- local st = split(table.remove(t,1),' ')
- local t = {Mode=table.remove(st,1)}
- for i,c in pairs(st) do
- local a = split(c,'=')
- t[a[1]] = a[2]
- end
- return t
- end
- --Char keys: id, x, y, width, height, xoffset, yoffset, xadvance
- local Functions = {
- GetChar = function(Font,byte)
- return Font.Chars[byte] or error("Unsupported char: "..string.char(byte))
- end,
- CreateCharImage = function(Font,Char)
- local Image = Instance.new("ImageLabel")
- Image.BackgroundTransparency = 1
- Image.Size = UDim2.new(0,Char.width,0,Char.height)
- Image.Image = Font.Image
- Image.ImageRectOffset = Vector2.new(Char.x,Char.y)
- Image.ImageRectSize = Vector2.new(Char.width,Char.height)
- return Image
- end
- }
- return function(txt,img)
- local Font = {Image=img,Settings={},Chars={}}
- for i,c in pairs(Functions) do Font[i] = c end
- txt = split(txt,"\n")
- for i,c in pairs(txt) do
- local t = split(txt[i],' ')
- local mode = table.remove(t,1)
- if mode=="char" then
- local char = {}
- for i2,c2 in pairs(t) do
- local a = split(t[i2],'=')
- char[a[1]] = tonumber(a[2])
- end
- Font.Chars[char.id] = char
- else
- Font[mode] = {}
- for i2,c2 in pairs(t) do
- local a = split(t[i2],'=')
- Font[mode][a[1]] = tonumber(a[2]) or a[2]
- end
- end
- end
- return Font
- end
- end)()
- -------------------------------------
- --Drawer module----------------------
- -------------------------------------
- local Drawer = (function()
- --Char keys: id, x, y, width, height, xoffset, yoffset, xadvance
- local Functions = {
- LookAhead = function(Drawer)
- local length = 0
- for i=Drawer.Position+1,#Drawer.Text+1 do
- local ch = Drawer.Text:sub(i,i)
- if ch=="\n" then return false end
- if not ch or ch==" " or ch=="" then
- if Drawer.Cursor.X+length > Drawer.Frame.AbsoluteSize.X then
- return true
- else
- return false
- end
- end
- local byte = string.byte(ch)
- local Char = Drawer.Font:GetChar(byte)
- length = length + Char.xadvance
- end
- end,
- EatChar = function(Drawer)
- end,
- DrawNext = function(Drawer)
- if Drawer.Position>#Drawer.Text then return end
- local ch = Drawer.Text:sub(Drawer.Position,Drawer.Position)
- if not ch then return false end
- if ch=="\n" or (ch==" " and Drawer:LookAhead()) then
- Drawer.Cursor = Vector2.new(0,Drawer.Cursor.Y+Drawer.Font.common.lineHeight)
- else
- local byte = string.byte(ch)
- local Char = Drawer.Font:GetChar(byte)
- local CharImg = Drawer.Font:CreateCharImage(Char)
- local ImgPos = Drawer.Cursor + Vector2.new(Char.xoffset,Char.yoffset)
- CharImg.Name = tostring(Drawer.Position).."_"..ch
- CharImg.Parent = Drawer.Frame
- CharImg.Position = UDim2.new(0,ImgPos.x,0,ImgPos.y)
- Drawer.Cursor = Drawer.Cursor + Vector2.new(Char.xadvance,0)
- end
- Drawer.Position = Drawer.Position+1
- return true
- end,
- DrawAll = function(Drawer)
- repeat until not Drawer:DrawNext()
- end
- }
- return function(Font,Parent,Text,DrawAll)
- local Drawer = {Font=Font,Text=Text,Cursor=Vector2.new(),Position=1}
- for i,c in pairs(Functions) do Drawer[i] = c end
- if Parent:FindFirstChild("TextDrawer") then
- Parent.TextDrawer:Destroy()
- end
- Drawer.Frame = Instance.new("Frame")
- Drawer.Frame.Name = "TextDrawer"
- Drawer.Frame.Size = UDim2.new(1,0,1,0)
- Drawer.Frame.BackgroundTransparency = 1
- Drawer.Frame.Parent = Parent
- if DrawAll then Drawer:DrawAll() end
- return Drawer
- end
- end)()
- -------------------------------------
- --Font object------------------------
- -------------------------------------
- local FontObj = Font([[info face=VL_PGothic size=-20 bold=0 italic=0 charset= unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=1
- common lineHeight=25 base=20 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=2 redChnl=2 greenChnl=2 blueChnl=2
- page id=0 file="PGothic_20px_0.png"
- chars count=193
- char id=12 x=23 y=192 width=5 height=3 xoffset=-2 yoffset=23 xadvance=7 page=0 chnl=15
- char id=13 x=11 y=192 width=5 height=3 xoffset=-2 yoffset=23 xadvance=7 page=0 chnl=15
- char id=32 x=248 y=166 width=5 height=3 xoffset=-2 yoffset=23 xadvance=5 page=0 chnl=15
- char id=33 x=250 y=121 width=5 height=17 xoffset=1 yoffset=4 xadvance=7 page=0 chnl=15
- char id=34 x=122 y=175 width=8 height=8 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15
- char id=35 x=48 y=127 width=15 height=17 xoffset=-1 yoffset=4 xadvance=14 page=0 chnl=15
- char id=36 x=172 y=23 width=13 height=21 xoffset=-1 yoffset=2 xadvance=11 page=0 chnl=15
- char id=37 x=12 y=70 width=18 height=18 xoffset=-1 yoffset=4 xadvance=16 page=0 chnl=15
- char id=38 x=125 y=65 width=17 height=18 xoffset=-1 yoffset=4 xadvance=14 page=0 chnl=15
- char id=39 x=146 y=170 width=5 height=8 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=15
- char id=40 x=0 y=48 width=8 height=21 xoffset=0 yoffset=3 xadvance=8 page=0 chnl=15
- char id=41 x=223 y=23 width=9 height=21 xoffset=-1 yoffset=3 xadvance=8 page=0 chnl=15
- char id=42 x=67 y=177 width=12 height=10 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=43 x=188 y=139 width=15 height=14 xoffset=0 yoffset=7 xadvance=15 page=0 chnl=15
- char id=44 x=139 y=173 width=6 height=8 xoffset=0 yoffset=16 xadvance=6 page=0 chnl=15
- char id=45 x=237 y=168 width=10 height=4 xoffset=0 yoffset=12 xadvance=9 page=0 chnl=15
- char id=46 x=202 y=168 width=6 height=5 xoffset=0 yoffset=16 xadvance=6 page=0 chnl=15
- char id=47 x=13 y=109 width=12 height=18 xoffset=-1 yoffset=4 xadvance=10 page=0 chnl=15
- char id=48 x=206 y=65 width=14 height=18 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=49 x=117 y=142 width=9 height=17 xoffset=1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=50 x=152 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=51 x=168 y=84 width=13 height=18 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=52 x=94 y=125 width=14 height=17 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=53 x=196 y=84 width=13 height=18 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=54 x=236 y=65 width=13 height=18 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=55 x=0 y=146 width=13 height=17 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=56 x=176 y=65 width=14 height=18 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=57 x=221 y=65 width=14 height=18 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=58 x=248 y=139 width=5 height=13 xoffset=1 yoffset=8 xadvance=7 page=0 chnl=15
- char id=59 x=159 y=139 width=7 height=16 xoffset=0 yoffset=8 xadvance=8 page=0 chnl=15
- char id=60 x=144 y=156 width=13 height=13 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15
- char id=61 x=80 y=177 width=15 height=9 xoffset=0 yoffset=10 xadvance=15 page=0 chnl=15
- char id=62 x=129 y=159 width=14 height=13 xoffset=0 yoffset=8 xadvance=13 page=0 chnl=15
- char id=63 x=236 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=64 x=69 y=68 width=18 height=18 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=65 x=32 y=127 width=15 height=17 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=66 x=28 y=89 width=13 height=18 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=67 x=70 y=87 width=13 height=18 xoffset=-1 yoffset=4 xadvance=12 page=0 chnl=15
- char id=68 x=191 y=65 width=14 height=18 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=69 x=79 y=143 width=12 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=70 x=14 y=146 width=12 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=71 x=160 y=65 width=15 height=18 xoffset=-1 yoffset=4 xadvance=14 page=0 chnl=15
- char id=72 x=109 y=124 width=14 height=17 xoffset=0 yoffset=4 xadvance=14 page=0 chnl=15
- char id=73 x=248 y=103 width=5 height=17 xoffset=1 yoffset=4 xadvance=6 page=0 chnl=15
- char id=74 x=223 y=84 width=12 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=75 x=138 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=76 x=27 y=146 width=12 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=77 x=215 y=103 width=16 height=17 xoffset=0 yoffset=4 xadvance=16 page=0 chnl=15
- char id=78 x=79 y=125 width=14 height=17 xoffset=0 yoffset=4 xadvance=14 page=0 chnl=15
- char id=79 x=143 y=65 width=16 height=18 xoffset=-1 yoffset=4 xadvance=14 page=0 chnl=15
- char id=80 x=166 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=81 x=18 y=47 width=17 height=20 xoffset=-1 yoffset=4 xadvance=15 page=0 chnl=15
- char id=82 x=180 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=83 x=84 y=87 width=13 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=84 x=64 y=125 width=14 height=17 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=85 x=140 y=84 width=13 height=18 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=86 x=232 y=103 width=15 height=17 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=87 x=117 y=105 width=19 height=17 xoffset=-1 yoffset=4 xadvance=18 page=0 chnl=15
- char id=88 x=194 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=89 x=16 y=128 width=15 height=17 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=90 x=222 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=91 x=9 y=48 width=8 height=21 xoffset=1 yoffset=3 xadvance=9 page=0 chnl=15
- char id=92 x=0 y=109 width=12 height=18 xoffset=-1 yoffset=4 xadvance=10 page=0 chnl=15
- char id=93 x=243 y=23 width=9 height=21 xoffset=0 yoffset=3 xadvance=9 page=0 chnl=15
- char id=94 x=16 y=179 width=14 height=12 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=95 x=209 y=168 width=15 height=4 xoffset=-2 yoffset=20 xadvance=11 page=0 chnl=15
- char id=96 x=131 y=173 width=7 height=8 xoffset=-1 yoffset=2 xadvance=6 page=0 chnl=15
- char id=97 x=0 y=164 width=12 height=14 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=98 x=210 y=84 width=12 height=18 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=99 x=39 y=164 width=11 height=14 xoffset=-1 yoffset=8 xadvance=10 page=0 chnl=15
- char id=100 x=182 y=84 width=13 height=18 xoffset=-1 yoffset=4 xadvance=12 page=0 chnl=15
- char id=101 x=13 y=164 width=12 height=14 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=102 x=66 y=143 width=12 height=17 xoffset=-1 yoffset=4 xadvance=10 page=0 chnl=15
- char id=103 x=0 y=90 width=13 height=18 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=104 x=53 y=145 width=12 height=17 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=15
- char id=105 x=137 y=141 width=5 height=17 xoffset=1 yoffset=4 xadvance=6 page=0 chnl=15
- char id=106 x=97 y=24 width=9 height=22 xoffset=-2 yoffset=4 xadvance=7 page=0 chnl=15
- char id=107 x=40 y=145 width=12 height=17 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=15
- char id=108 x=249 y=84 width=5 height=17 xoffset=1 yoffset=4 xadvance=6 page=0 chnl=15
- char id=109 x=82 y=161 width=16 height=13 xoffset=0 yoffset=8 xadvance=16 page=0 chnl=15
- char id=110 x=200 y=154 width=12 height=13 xoffset=0 yoffset=8 xadvance=11 page=0 chnl=15
- char id=111 x=220 y=139 width=13 height=14 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=112 x=39 y=108 width=12 height=18 xoffset=0 yoffset=8 xadvance=12 page=0 chnl=15
- char id=113 x=154 y=84 width=13 height=18 xoffset=-1 yoffset=8 xadvance=12 page=0 chnl=15
- char id=114 x=237 y=154 width=10 height=13 xoffset=0 yoffset=8 xadvance=9 page=0 chnl=15
- char id=115 x=26 y=164 width=12 height=14 xoffset=-1 yoffset=8 xadvance=10 page=0 chnl=15
- char id=116 x=105 y=143 width=11 height=17 xoffset=-1 yoffset=5 xadvance=10 page=0 chnl=15
- char id=117 x=51 y=163 width=11 height=14 xoffset=0 yoffset=8 xadvance=11 page=0 chnl=15
- char id=118 x=172 y=154 width=13 height=13 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=119 x=63 y=163 width=18 height=13 xoffset=-1 yoffset=8 xadvance=16 page=0 chnl=15
- char id=120 x=213 y=154 width=11 height=13 xoffset=0 yoffset=8 xadvance=11 page=0 chnl=15
- char id=121 x=14 y=89 width=13 height=18 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=122 x=225 y=154 width=11 height=13 xoffset=0 yoffset=8 xadvance=11 page=0 chnl=15
- char id=123 x=211 y=23 width=11 height=21 xoffset=-1 yoffset=3 xadvance=10 page=0 chnl=15
- char id=124 x=0 y=0 width=5 height=24 xoffset=1 yoffset=2 xadvance=7 page=0 chnl=15
- char id=125 x=199 y=23 width=11 height=21 xoffset=0 yoffset=3 xadvance=10 page=0 chnl=15
- char id=126 x=170 y=170 width=14 height=6 xoffset=0 yoffset=11 xadvance=14 page=0 chnl=15
- char id=160 x=17 y=192 width=5 height=3 xoffset=-2 yoffset=23 xadvance=8 page=0 chnl=15
- char id=161 x=250 y=65 width=5 height=18 xoffset=1 yoffset=8 xadvance=7 page=0 chnl=15
- char id=162 x=51 y=47 width=12 height=20 xoffset=-1 yoffset=5 xadvance=11 page=0 chnl=15
- char id=163 x=124 y=123 width=13 height=17 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=164 x=114 y=161 width=14 height=13 xoffset=0 yoffset=6 xadvance=14 page=0 chnl=15
- char id=165 x=0 y=128 width=15 height=17 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=166 x=76 y=47 width=5 height=20 xoffset=1 yoffset=4 xadvance=7 page=0 chnl=15
- char id=167 x=64 y=47 width=11 height=20 xoffset=0 yoffset=4 xadvance=10 page=0 chnl=15
- char id=168 x=192 y=168 width=9 height=5 xoffset=0 yoffset=4 xadvance=9 page=0 chnl=15
- char id=169 x=50 y=68 width=18 height=18 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=170 x=186 y=154 width=13 height=13 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=171 x=31 y=179 width=14 height=12 xoffset=0 yoffset=8 xadvance=14 page=0 chnl=15
- char id=172 x=107 y=175 width=14 height=8 xoffset=-1 yoffset=10 xadvance=13 page=0 chnl=15
- char id=173 x=0 y=192 width=10 height=4 xoffset=0 yoffset=12 xadvance=9 page=0 chnl=15
- char id=174 x=31 y=68 width=18 height=18 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=175 x=225 y=168 width=11 height=4 xoffset=-1 yoffset=5 xadvance=9 page=0 chnl=15
- char id=176 x=96 y=175 width=10 height=9 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=15
- char id=177 x=143 y=139 width=15 height=16 xoffset=0 yoffset=6 xadvance=15 page=0 chnl=15
- char id=178 x=57 y=178 width=9 height=12 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=15
- char id=179 x=46 y=179 width=10 height=12 xoffset=-1 yoffset=4 xadvance=8 page=0 chnl=15
- char id=180 x=163 y=170 width=6 height=7 xoffset=0 yoffset=3 xadvance=5 page=0 chnl=15
- char id=181 x=52 y=106 width=12 height=18 xoffset=0 yoffset=8 xadvance=11 page=0 chnl=15
- char id=182 x=36 y=47 width=14 height=20 xoffset=-1 yoffset=4 xadvance=13 page=0 chnl=15
- char id=183 x=185 y=168 width=6 height=6 xoffset=0 yoffset=11 xadvance=6 page=0 chnl=15
- char id=184 x=152 y=170 width=10 height=7 xoffset=-1 yoffset=19 xadvance=8 page=0 chnl=15
- char id=185 x=248 y=153 width=7 height=12 xoffset=0 yoffset=4 xadvance=8 page=0 chnl=15
- char id=186 x=158 y=156 width=13 height=13 xoffset=0 yoffset=4 xadvance=13 page=0 chnl=15
- char id=187 x=0 y=179 width=15 height=12 xoffset=0 yoffset=8 xadvance=14 page=0 chnl=15
- char id=188 x=157 y=103 width=19 height=17 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=189 x=177 y=103 width=18 height=17 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=190 x=137 y=103 width=19 height=17 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=191 x=98 y=86 width=13 height=18 xoffset=0 yoffset=8 xadvance=12 page=0 chnl=15
- char id=192 x=177 y=0 width=16 height=22 xoffset=-1 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=193 x=194 y=0 width=16 height=22 xoffset=-1 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=194 x=211 y=0 width=16 height=22 xoffset=-1 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=195 x=140 y=23 width=16 height=21 xoffset=-1 yoffset=0 xadvance=14 page=0 chnl=15
- char id=196 x=123 y=23 width=16 height=21 xoffset=-1 yoffset=0 xadvance=14 page=0 chnl=15
- char id=197 x=160 y=0 width=16 height=22 xoffset=-1 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=198 x=196 y=103 width=18 height=17 xoffset=-1 yoffset=4 xadvance=17 page=0 chnl=15
- char id=199 x=228 y=0 width=15 height=22 xoffset=-1 yoffset=4 xadvance=14 page=0 chnl=15
- char id=200 x=71 y=24 width=12 height=22 xoffset=0 yoffset=-1 xadvance=12 page=0 chnl=15
- char id=201 x=84 y=24 width=12 height=22 xoffset=0 yoffset=-1 xadvance=12 page=0 chnl=15
- char id=202 x=45 y=24 width=12 height=22 xoffset=0 yoffset=-1 xadvance=12 page=0 chnl=15
- char id=203 x=186 y=23 width=12 height=21 xoffset=0 yoffset=0 xadvance=12 page=0 chnl=15
- char id=204 x=107 y=24 width=7 height=22 xoffset=-1 yoffset=-1 xadvance=6 page=0 chnl=15
- char id=205 x=115 y=24 width=7 height=22 xoffset=1 yoffset=-1 xadvance=6 page=0 chnl=15
- char id=206 x=244 y=0 width=10 height=22 xoffset=-2 yoffset=-1 xadvance=6 page=0 chnl=15
- char id=207 x=233 y=23 width=9 height=21 xoffset=-1 yoffset=0 xadvance=6 page=0 chnl=15
- char id=208 x=107 y=67 width=17 height=18 xoffset=-1 yoffset=4 xadvance=15 page=0 chnl=15
- char id=209 x=157 y=23 width=14 height=21 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15
- char id=210 x=44 y=0 width=18 height=23 xoffset=-1 yoffset=-1 xadvance=16 page=0 chnl=15
- char id=211 x=6 y=0 width=18 height=23 xoffset=-1 yoffset=-1 xadvance=16 page=0 chnl=15
- char id=212 x=25 y=0 width=18 height=23 xoffset=-1 yoffset=-1 xadvance=16 page=0 chnl=15
- char id=213 x=122 y=0 width=18 height=22 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=15
- char id=214 x=141 y=0 width=18 height=22 xoffset=-1 yoffset=0 xadvance=16 page=0 chnl=15
- char id=215 x=99 y=161 width=14 height=13 xoffset=-1 yoffset=8 xadvance=12 page=0 chnl=15
- char id=216 x=88 y=67 width=18 height=18 xoffset=-1 yoffset=4 xadvance=16 page=0 chnl=15
- char id=217 x=63 y=0 width=14 height=23 xoffset=0 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=218 x=78 y=0 width=14 height=23 xoffset=0 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=219 x=93 y=0 width=14 height=23 xoffset=0 yoffset=-1 xadvance=14 page=0 chnl=15
- char id=220 x=16 y=24 width=14 height=22 xoffset=0 yoffset=0 xadvance=14 page=0 chnl=15
- char id=221 x=0 y=25 width=15 height=22 xoffset=-1 yoffset=-1 xadvance=13 page=0 chnl=15
- char id=222 x=208 y=121 width=13 height=17 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=223 x=152 y=45 width=13 height=19 xoffset=0 yoffset=3 xadvance=12 page=0 chnl=15
- char id=224 x=180 y=45 width=12 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=225 x=193 y=45 width=12 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=226 x=219 y=45 width=12 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=227 x=26 y=108 width=12 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=228 x=65 y=106 width=12 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=229 x=206 y=45 width=12 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=230 x=167 y=139 width=20 height=14 xoffset=-1 yoffset=8 xadvance=18 page=0 chnl=15
- char id=231 x=236 y=84 width=12 height=18 xoffset=-1 yoffset=8 xadvance=11 page=0 chnl=15
- char id=232 x=96 y=47 width=13 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=233 x=82 y=47 width=13 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=234 x=166 y=45 width=13 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=235 x=42 y=87 width=13 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=236 x=101 y=105 width=7 height=18 xoffset=-1 yoffset=3 xadvance=6 page=0 chnl=15
- char id=237 x=109 y=105 width=7 height=18 xoffset=1 yoffset=3 xadvance=6 page=0 chnl=15
- char id=238 x=90 y=106 width=10 height=18 xoffset=-2 yoffset=3 xadvance=6 page=0 chnl=15
- char id=239 x=127 y=141 width=9 height=17 xoffset=-1 yoffset=4 xadvance=6 page=0 chnl=15
- char id=240 x=56 y=87 width=13 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=241 x=92 y=143 width=12 height=17 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=15
- char id=242 x=110 y=47 width=13 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=243 x=124 y=45 width=13 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=244 x=138 y=45 width=13 height=19 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=245 x=112 y=86 width=13 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=246 x=126 y=84 width=13 height=18 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15
- char id=247 x=204 y=139 width=15 height=14 xoffset=0 yoffset=7 xadvance=15 page=0 chnl=15
- char id=248 x=234 y=139 width=13 height=14 xoffset=-1 yoffset=8 xadvance=12 page=0 chnl=15
- char id=249 x=232 y=45 width=11 height=19 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15
- char id=250 x=244 y=45 width=11 height=19 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15
- char id=251 x=0 y=70 width=11 height=19 xoffset=0 yoffset=3 xadvance=11 page=0 chnl=15
- char id=252 x=78 y=106 width=11 height=18 xoffset=0 yoffset=4 xadvance=11 page=0 chnl=15
- char id=253 x=108 y=0 width=13 height=23 xoffset=-1 yoffset=3 xadvance=11 page=0 chnl=15
- char id=254 x=58 y=24 width=12 height=22 xoffset=0 yoffset=4 xadvance=12 page=0 chnl=15
- char id=255 x=31 y=24 width=13 height=22 xoffset=-1 yoffset=4 xadvance=11 page=0 chnl=15]]
- ,"rbxassetid://2771014615")
- -------------------------------------
- --Map loading------------------------
- -------------------------------------
- local Decode = function(str,t,props,classes,names,enums,Model,CurPar,LastIns,split,RemoveAndSplit)
- local tonum,table_remove,inst,parnt,comma,table_foreach,pattern = tonumber,table.remove,Instance.new,"Parent",",",
- function(t,f)
- for a,b in pairs(t) do
- f(a,b)
- end
- end,"([^%s]+)"
- local Types = {
- Color3 = Color3.new,
- Vector3 = Vector3.new,
- Vector2 = Vector2.new,
- UDim = UDim.new,
- UDim2 = UDim2.new,
- CFrame = CFrame.new,
- Rect = Rect.new,
- EnumItem = function(a)
- return enums[tonumber(a)]
- end
- }
- split = function(str,sep)
- local fields = {}
- local ConcatNext = false
- str:gsub(pattern:format(sep),function(c)
- if ConcatNext == true then
- fields[#fields] = fields[#fields]..sep..c
- ConcatNext = false
- else
- fields[#fields+1] = c
- end
- if c:sub(#c)=="\\" then
- c = fields[#fields]
- fields[#fields] = c:sub(1,#c-1)
- ConcatNext = true
- end
- end)
- return fields
- end
- RemoveAndSplit = function(t)
- return split(table_remove(t,1),comma)
- end
- t = split(str,";")
- props = RemoveAndSplit(t)
- classes = RemoveAndSplit(t)
- names = RemoveAndSplit(t)
- enums = RemoveAndSplit(t)
- Model = inst"Model"
- CurPar = Model
- table_foreach(t,function(ct,c)
- if c=="n" or c=="p" then
- CurPar = c=="n" and LastIns or CurPar[parnt]
- else
- ct = split(c,"|")
- local class = classes[tonum(table_remove(ct,1))]
- if class=="UnionOperation" then
- LastIns = {Locked="true",Anchored="true",UsePartColor="true"}
- else
- LastIns = inst(class)
- if LastIns:IsA"BasePart" then
- LastIns.Anchored = true
- LastIns.Locked = true
- elseif LastIns:IsA"Script" then
- s(LastIns)
- end
- end
- local function SetProperty(LastIns,p,str,s)
- s = Types[typeof(LastIns[p])]
- LastIns[p] = p=="Name" and names[tonum(str)] or s and s(unpack(split(str,comma))) or tonum(str) or (str~="true" and str~="false") and str or str=="true"
- end
- local UnionData
- table_foreach(ct,function(s,p,a,str)
- a = p:find":"
- p,str = props[tonum(p:sub(1,a-1))],p:sub(a+1)
- if p=="UnionData" then
- UnionData = split(str," ")
- return
- end
- if class=="UnionOperation" then
- LastIns[p] = str
- return
- end
- SetProperty(LastIns,p,str)
- end)
- if UnionData then
- local LI_Data = LastIns
- LastIns = DecodeUnion(UnionData)
- table_foreach(LI_Data,function(p,str)
- SetProperty(LastIns,p,str)
- end)
- end
- LastIns[parnt] = CurPar
- end
- end)
- return Model
- end
- local Model = Decode('Name,Color,Material,Position,Size,BottomSurface,TopSurface,Transparency,Brightness,Shadows,Orientation,CanCollide,Texture,Scale,Value,AnchorPoint,BackgroundColor3,BorderColor3,Font,Text,TextColor3,Tex'
- ..'tSize,BackgroundTransparency,PaddingBottom,PaddingLeft,PaddingRight,PaddingTop,Padding,TextScaled,TextWrapped,Active,ExtentsOffsetWorldSpace,Image,ImageTransparency,ScaleType,SliceCenter,BorderSizePix'
- ..'el,AspectRatio;Part,Folder,Model,PointLight,WedgePart,Decal,SpecialMesh,Humanoid,BodyColors,StringValue,ScreenGui,Frame,TextLabel,TextButton,UIPadding,UIListLayout,BillboardGui,ImageLabel,UIAspectRati'
- ..'oConstraint;Part,Buildings,Building,Table,Illumination,OuterStuff,Top,Floor,Back wall,Roof,Right Wall,Glass,Left Wall,Front wall,NPCs,Average NPC,HumanoidRootPart,Torso,Left Leg,Right Leg,Left Arm,Rig'
- ..'ht Arm,Head,Face,Dialog,Prompt,Answer1,Answer3,Answer2,ExecuteFunction,DialogName,Triggers,Baseplate,Spawn,MainFrame,NameLabel,Answers,TextFrame,AdvanceText,InteractBillboard,SidingImageLeft,IconImage'
- ..',SidingImageRight,InteractButton;WoodPlanks,Smooth,Brick,Wood,Glass,Grass,Arial,SourceSans,Slice;2|1:2;n;3|1:3;n;1|1:4|2:0.337,0.258,0.211|3:1|4:0,2.5,-19|5:12,3,4|6:2|7:2;1|1:5|8:1|4:-3,8.5,-17|5:1,1'
- ..',1|6:2|7:2;n;4|9:5|10:true;p;3|1:6;n;1|1:7|2:0.337,0.141,0.141|3:3|4:-3,16.5,-17|5:20,1,20|6:2|7:2;1|1:8|2:0.337,0.141,0.141|3:3|4:-3,0.5,-17|5:20,1,20|6:2|7:2;1|1:9|2:0.337,0.141,0.141|3:3|4:-3,8.5,-'
- ..'26.5|5:18,15,1|6:2|7:2;3|1:10;n;5|2:0.337,0.258,0.211|3:4|4:-6.5,22,-17|11:0,90,0|5:20,10,13|6:2;5|2:0.337,0.258,0.211|3:4|4:3.5,22,-17|11:0,-90,0|5:20,10,7|6:2;p;3|1:11;n;1|2:0.337,0.141,0.141|3:3|4:'
- ..'-12.5,3,-17|5:1,4,20|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:-12.5,8,-10|5:1,6,6|6:2|7:2;1|1:12|2:0.501,0.733,0.858|3:5|8:0.75|4:-12.5,8,-17|5:0.5,6,8|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:-12.5,13.5,-17|5:'
- ..'1,5,20|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:-12.5,8,-24|5:1,6,6|6:2|7:2;p;3|1:13;n;1|2:0.337,0.141,0.141|3:3|4:6.5,3,-17|5:1,4,20|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:6.5,8,-10|5:1,6,6|6:2|7:2;1|1:12|2:'
- ..'0.501,0.733,0.858|3:5|8:0.75|4:6.5,8,-17|5:0.5,6,8|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:6.5,13.5,-17|5:1,5,20|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:6.5,8,-24|5:1,6,6|6:2|7:2;p;3|1:14;n;1|2:0.337,0.141,0.'
- ..'141|3:3|4:-9.5,8.5,-7.5|5:5,15,1|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:-3,13.5,-7.5|5:8,5,1|6:2|7:2;1|2:0.337,0.141,0.141|3:3|4:3.5,8.5,-7.5|5:5,15,1|6:2|7:2;p;p;p;p;2|1:15;n;3|1:16;n;1|1:17|8:1|4:1.999'
- ..',3.995,-22.498|11:0,180,0|5:2,2,1|6:2|7:2;1|1:18|2:0.156,0.498,0.278|4:1.999,3.995,-22.498|11:0,180,0|5:2,2,1|12:false|6:2|7:2;1|1:19|2:0.05,0.411,0.674|4:2.499,1.995,-22.498|11:0,180,0|5:1,2,1|12:fal'
- ..'se|6:2|7:2;1|1:20|2:0.05,0.411,0.674|4:1.499,1.995,-22.498|11:0,180,0|5:1,2,1|12:false|6:2|7:2;1|1:21|2:0.992,0.917,0.552|4:2.999,4.295,-21.498|11:75,150,0|5:1,2,1|12:false|6:2|7:2;1|1:22|2:0.992,0.91'
- ..'7,0.552|4:0.999,4.295,-21.498|11:75,-150,0|5:1,2,1|12:false|6:2|7:2;1|1:23|2:0.992,0.917,0.552|4:1.999,5.495,-22.498|11:0,180,0|5:2,1,1|6:2|7:2;n;6|1:24|13:rbxasset://textures/face.png;7|14:1.2,1.2,1.'
- ..'2;p;8;9;2|1:25;n;10|1:26|15:Hello, World!;10|1:27|15:Hello to you too!;10|1:28|15:Goodbye!;10|1:29|15:Who are you?;n;10|1:26|15:idk, and you?;10|1:30|15:Test2;p;10|1:31|15:Dummy;10|1:30|15:Test1;p;p;p'
- ..';2|1:32;1|1:33|2:0.294,0.592,0.294|3:6|4:0,-0.5,0|5:512,1,512|7:2;1|1:34|8:1|4:-2,0.5,0|5:5,1,5|12:false|6:2|7:2;11|1:25;n;12|1:35|4:0.5,0,1,0|5:0,640,0,240|16:0.5,1|17:0,0,0|18:1,1,1;n;13|1:36|4:0,0,'
- ..'0,-1|5:0,125,0,25|16:0,1|17:0,0,0|18:1,1,1|19:7|20:DialogName|21:1,1,1|22:20;12|1:37|4:1,0,0,0|5:0.25,0,1,0|16:1,0|17:1,1,1|23:1;n;14|1:29|5:1,0,0.3,0|17:0,0,0|18:1,1,1|19:8|20:Answer2|21:1,1,1|22:18;'
- ..'14|1:27|5:1,0,0.3,0|17:0,0,0|18:1,1,1|19:8|20:Answer1|21:1,1,1|22:18;15|24:0,10|25:0,10|26:0,10|27:0,10;16|28:0.059,0;14|1:28|5:1,0,0.3,0|17:0,0,0|18:1,1,1|19:8|20:Answer3|21:1,1,1|22:18;p;12|1:38|5:0'
- ..'.75,0,1,0|17:1,1,1|23:1;n;15|24:0,10|25:0,10|26:0,10|27:0,10;p;14|1:39|4:1,-10,1,-10|5:0,20,0,20|16:1,1|17:0,0,0|18:1,1,1|19:7|20:>|21:1,1,1|29:true|22:14|30:true;p;p;17|1:40|5:3,0,3,0|31:true|32:0,4,'
- ..'0;n;12|1:35|5:1,0,0.5,0|17:1,1,1|23:1|18:0,0,0;n;18|1:41|5:0.05,0,1,0|17:1,1,1|23:1|33:rbxassetid://965810449|34:0.4|35:9|36:16,15,55,40;12|4:0.05,0,0,0|5:0.899,0,1,0|17:1,1,1|23:0.4|37:0;n;18|1:42|4:'
- ..'0.5,0,0.5,0|5:1,0,1,0|16:0.5,0.5|17:1,1,1|23:1|33:rbxassetid://968136228;n;19|38:0.5;p;15|24:0.1,0|27:0.1,0;p;18|1:43|4:0.949,0,0,0|5:0.05,0,1,0|17:1,1,1|23:1|33:rbxassetid://965816113|34:0.4|35:9|36:'
- ..'0,16,39,40;14|1:44|5:1,0,1,0|17:1,1,1|23:1|18:0,0,0|19:8|20:|22:14;p;p;')
- Model.Name = "RPG Map"
- Model.PrimaryPart = Model.Baseplate
- local Util = {
- DrawText = function(frame,str,all)
- local d = Drawer(FontObj,frame,str,all)
- if all then return d end
- local skip = false
- local con = frame.InputBegan:Connect(function(io)
- if io.UserInputType~=Enum.UserInputType.MouseButton1 then return end
- skip = true
- d:DrawAll()
- end)
- while d:DrawNext() do
- for i=1,2 do
- RS:Wait()
- end
- if skip then break end
- end
- con:Disconnect()
- return d
- end
- }
- --/////////////////////////////////--
- --//End of modules/////////////////--
- --/////////////////////////////////--
- local Player = owner
- local gui = Player:FindFirstChildOfClass("PlayerGui")
- local bg = Model:WaitForChild("InteractBillboard")
- local dg = Model:WaitForChild("Dialog")
- bg.Parent=nil
- dg.Parent=nil
- if gui:FindFirstChild("Dialog GUI") then
- gui["Dialog GUI"]:Destroy()
- end
- local f = Instance.new("Folder")
- f.Name = "Dialog GUI"
- f.Parent = gui
- if workspace:FindFirstChild("RPG Map") then
- workspace["RPG Map"]:Destroy()
- end
- Model:SetPrimaryPartCFrame(CFrame.new(1000,0,0))
- Model.Parent = workspace
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local WalkSpeed = 16
- local JumpPower = 50
- local Functions = {
- Test1 = function()
- print('asd')
- end,
- Test2 = function()
- print('dsa')
- end,
- }
- Dialog = {
- RemoveConnections = function(self)
- while #self.Connections>0 do
- local con = table.remove(self.Connections)
- if con.Connected then
- con:Disconnect()
- end
- end
- end,
- Load = function(self,dialog,first)
- self:RemoveConnections()
- local dg = self.Gui.MainFrame
- local prompt = dialog:FindFirstChild("Prompt")
- local execfunc = dialog:FindFirstChild("ExecuteFunction")
- if execfunc then
- Functions[execfunc.Value]()
- end
- if not prompt then
- return self:Close()
- end
- local name = dialog:FindFirstChild("DialogName")
- self.Answers = {dialog:FindFirstChild("Answer1"),dialog:FindFirstChild("Answer2"),dialog:FindFirstChild("Answer3")}
- dg.Answers.Visible = false
- dg.AdvanceText.Visible = false
- if #self.Answers<=0 then
- dg.TextFrame.Size = UDim2.new(1,0,1,0)
- else
- dg.TextFrame.Size = UDim2.new(0.75,0,1,0)
- end
- if name then
- dg.NameLabel.Visible = true
- dg.NameLabel.Text = name.Value
- elseif first then
- dg.NameLabel.Visible = false
- end
- Util.DrawText(dg.TextFrame,prompt.Value)
- for a,b in pairs(self.Answers) do
- local but = dg.Answers['Answer'..tostring(a)]
- but.Visible = true
- but.Text = b.Value
- table.insert(self.Connections,but.MouseButton1Up:Connect(function()
- self:Load(b)
- end))
- end
- if #self.Answers<=0 then
- dg.AdvanceText.Visible = true
- table.insert(self.Connections,dg.AdvanceText.MouseButton1Down:Connect(function()
- self:Load(prompt)
- end))
- else
- dg.Answers.Visible = true
- end
- end,
- Open = function(self,dialog)
- if self.IsOpen then self:Close() end
- self.IsOpen = true
- self.Gui = dg:Clone()
- self.Gui.Parent = f
- if Character then
- local h = Character:FindFirstChildOfClass("Humanoid")
- if h then
- h.WalkSpeed = 0
- h.JumpPower = 0
- end
- end
- self:Load(dialog,true)
- end,
- Close = function(self)
- if not self.Gui then return end
- self.Gui:Destroy()
- self.Gui = nil
- if Character then
- local h = Character:FindFirstChildOfClass("Humanoid")
- if h then
- h.WalkSpeed = WalkSpeed
- h.JumpPower = JumpPower
- end
- end
- self.IsOpen = false
- end,
- Connections = {},
- Answers = {},
- Gui = nil,
- IsOpen = false,
- }
- Player.CharacterRemoving:Connect(function()
- Dialog:Close()
- end)
- Player.CharacterAdded:Connect(function(char)
- Character = char
- Character:SetPrimaryPartCFrame(map.Spawn.CFrame + Vector3.new(0,8,0))
- end)
- local function InitDialog(folder,head)
- local bg = bg:Clone()
- bg.Parent = f
- bg.Adornee = head
- bg.MainFrame.InteractButton.MouseButton1Down:Connect(function()
- if Dialog.IsOpen then return end
- Dialog:Open(folder)
- end)
- end
- local map = Model
- for _,m in pairs(map.NPCs:GetChildren()) do
- local d,h = m:FindFirstChild("Dialog"),m:FindFirstChild("Head")
- if d and h then
- InitDialog(d,h)
- end
- end
- if Character then
- Character:SetPrimaryPartCFrame(map.Spawn.CFrame + Vector3.new(0,8,0))
- end
Advertisement
Add Comment
Please, Sign In to add comment