Code:
mob
verb
Say(msg as text)
if(!msg)return
msg = html_encode(msg)
view() << "[usr] says: [wordfilter(msg)]"
Shout(msg as text)
if(!msg)return
msg = html_encode(msg)
world << "<b>[usr] shouts: [wordfilter(msg)]</b>"
var
list
// Emoticons
// Emoticons are special, the filtered words are icon_states
// NOTE: DON'T filter to the original text or it will cause an infinite loop
emoticons = list( "^_^" , ":)" , "=)" , ">:(" , ">=(" , ";_;" , \
":(" , "=(" , ">:)" , ">=)" , ">:D" , ">=D" , ":D" , "=D" , ":P" \
, "=P" , "(Xsmile)" , "(WEE)")// Smilies
emoticons2= list( "^_^" , ":)" , ":)" , ">:(" , ">:(" , ";_;" , \
":(" , ":(" , ">:)" , ">:)" , ">:)" , ">:)" , ":D" , ":D" , ":P" \
, ":P" , "(Xsmile)" , "(WEE)")// icon_states for smilies
proc
wordfilter(m as text)
var/icon/I = 'EmotIcons.dmi' // Emoticons icon file
var/p
m = " " + copytext(m,1) + " "
// Emoticons
if(emoticons.len)
for(var/i=1,i<=emoticons.len,i++)
p = findtext(m,emoticons[i])
while(p)
m = copytext(m,1,p) + "[html_decode(m)]<img class=icon src=\ref[I] \
iconstate='[emoticons2[i]]'>[html_encode(m)]" \
+ copytext(m,p+length(emoticons[i]))
p = findtext(m,emoticons[i])
return m
Problem description:
Whenever I use the say or shout verbs, the game crashes. What could be causing it?