--[[ colours allowed; red, green, blue, yellow, white, black any of the above with "dark " - i.e. "dark red" - (except white & black) --]] local text_colour = "dark green" local text_is_centered = true --centered text (true / false) local text_position_x = 50 local text_position_y = 50 local text_size = 3 local text_delay = 150 --delay between characters (higher is slower typing speed) local text = "" --*put the text to display in the zone's 'name' property* --any ~ will cause a new line to be added local r,g,b = 0,0,0 local current_char = 0 local text_total_length = 0 local cText = {} local line = 0 function show_text_init_name(e,name) text = name text_total_length = string.len(text) SetActivated(e,1) if text_colour == "red" then r = 255 elseif text_colour == "green" then g = 255 elseif text_colour == "blue" then b = 255 elseif text_colour == "yellow" then r = 255 g = 216 elseif text_colour == "white" then r,g,b = 255,255,255 elseif text_colour == "dark red" then r = 155 elseif text_colour == "dark green" then g = 155 elseif text_colour == "dark blue" then b = 155 elseif text_colour == "dark yellow" then g = 155 end end function show_text_main(e) if g_Entity[e]['activated'] == 1 then if g_Entity[e]['plrinzone'] == 1 then StartTimer(e) SetActivated(e,2) current_char = 0 line = 1 cText[line] = "" end elseif g_Entity[e]['activated'] == 2 then if GetTimer(e) > text_delay then StartTimer(e) current_char = current_char + 1 if current_char > text_total_length then Destroy(e) else local thisChar = string.sub(text,current_char,current_char) if string.find(thisChar,"~") ~= nil then line = line + 1 cText[line] = "" else if string.find(thisChar," ") == nil then PlaySound(e,0) end cText[line] = cText[line]..thisChar end end end if text_is_centered == true then for a = 1, line do TextCenterOnXColor(text_position_x,text_position_y+((a-1)*(text_size*1)),text_size,cText[a],r,g,b) end else for a = 1, line do TextColor(text_position_x,text_position_y+((a-1)*(text_size*1)),text_size,cText[a],r,g,b) end end end end