var
SpeechBubbleSettings/SpeechBubble = new()
SpeechBubbleSettings
var
Font/font
icon
SpeechBubble
var
layer = 88
atom/owner
atom/movable/text
list/__text
width = 5
New(mob/a, txt)
..()
owner = a
var/atom/loc = owner
while(!isturf(loc))
loc = loc.loc
text = new/obj/text(loc)
text.owner=a
text.pixel_x = -56
__text(txt)
text.pixel_y=30
spawn(200)del src
Del()
del text
..()
proc
Move(turf/t)
..()
text.loc = t
__text(t)
t = SpeechBubble.font.wrap_text(t, width * 32 - 12)
if(__text)
for(var/i in __text)
text.overlays -= i
del i
__text.Cut()
else
__text = list()
var/check=length(t)
var/linesam=1
while(check>24)
check-=24
linesam++
var/px = 0
var/py = 16 + SpeechBubble.font.line_height*linesam/2
for(var/i = 1 to length(t))
var/char = copytext(t, i, i + 1)
if(char == "\n")
px = 0
py -= SpeechBubble.font.line_height
linesam--
continue
var/image/symbol = image(SpeechBubble.font.icon, icon_state = char, layer = layer)
symbol.pixel_x = px
symbol.pixel_y = py
var/image/ovlay = image('sayov.dmi', "[owner:nation]", layer = layer-1)
ovlay.pixel_x = px-1
ovlay.pixel_y = py-1
__text += symbol
if(linesam==1)
symbol.pixel_x+=72-check*3
ovlay.pixel_x+=72-check*3
text.overlays += symbol
text.overlays += ovlay
px += 6 + SpeechBubble.font.spacing
mob
proc
speech_bubble(owner,txt, duration = 0)
for(var/obj/text/G in world)
//if(G:owner==owner)del G
var/SpeechBubble/s = new(owner, txt)
s:owner=src
saidstuff++
//specmove++
if(duration)
spawn(duration)
//specmove--
saidstuff--
del s
return s
Font
Herculanum
icon = 'Herculanum.ttf'
// see fonts.dm for descriptions of these vars
char_width = 6
spacing = 0
line_height = 6
obj/text
name=""
animate_movement=2
New()
..()
spawn(200)del src
Font
var
icon
list/char_width = list()
spacing = 1
line_height = 16
proc
wrap_text(txt, line_width)
var/list/words = list()
var/word = ""
for(var/i = 1 to length(txt))
var/c = copytext(txt, i, i + 1)
if(c == " ")
words += word
word = ""
else
word += c
if(word)
words += word
var/px = 0
var/output = ""
var/space = ""
for(var/i = 1 to words.len)
word = "[space][words[i]]"
var/word_width = word_width(word)
if(px + word_width < line_width)
output += "[word]"
space = " "
px += word_width
else
word = words[i]
word_width = word_width(word)
if(word_width > line_width)
var/list/parts = chop_word(word, px, line_width)
for(var/p in parts)
output += p
px = word_width(parts[parts.len])
space = " "
else
output += "\n[word]"
space = " "
px = word_width
return output
text_width(txt)
return word_width(txt)
word_width(word)
var/width = 0
for(var/i = 1 to length(word))
width += 6
if(i < length(word))
width += spacing
return width
cut_text(txt, width_limit)
return cut_word(txt, width_limit)
cut_word(word, width_limit)
var/width = 0
var/word_part = ""
for(var/i = 1 to length(word))
var/char = copytext(word, i, i + 1)
width += 6
if(width > width_limit)
return word_part
word_part += char
if(i < length(word))
width += spacing
return word_part
chop_word(word, px, line_width)
var/line_width_left = line_width - px
var/word_width = word_width(word)
if(word_width <= line_width_left)
return list(word)
var/word_part = ""
word_width = 0
for(var/i = 1 to length(word))
var/char = copytext(word, i, i + 1)
if(word_width(word_part + char) > line_width_left)
var/remainder = copytext(word, length(word_part) + 1)
return list(word_part, "\n") + chop_word(remainder, 0, line_width)
word_part += char
return list(word_part)
Problem description:
I get this error.
code\game\speech_bubble.dm:24:error: text.owner: undefined var
There is no owner variable defined.