TPT Script Server

This page is used for previewing and submitting scripts for use with the Script Manager

Available Scripts

(2) TPTMulti by LBPHacker
(3) set wifi v2 by jacob1
(4) Script Paste by jacob1
(5) Random Element by jacob1
(6) Magical Merge Master 3000 by nucular
(7) More Fuel Mod-heavy by jward212
(9) Breakpoints (BRPT) by boxmein
(10) Cockroaches! by boxmein
(11) Random tree by ssccsscc
(12) Element with random properties by ssccsscc
(15) Minimalistic Element Dehider by nucular
(16) FPS Gauge by mniip
(17) TPT Radio by jward212
(18) Print Debugger by FeynmanLogomaker
(19) Powered BHOL by jacob1
(20) Light and lamps by electronic_steve
(21) Extremely Durable TTAN by QuentinADay
(22) New Buttons by QuentinADay
(23) Pure Energy by QuentinADay
(25) RCA's HUD XV Update I by RCAProduction
(27) 123456787654 vols by mjpowder
(28) Singularity Bomb by QuentinADay
(29) ES wifi set by electronic_steve
(30) Lua Elements Pack by FeynmanLogomaker
(31) stkm gun by jward212
(32) space building materials by kjack1111
(34) Rust bomb by Damian97
(35) Simple command block by ssccsscc
(36) Everlasting Fusion by QuentinADay
(37) Screenshot Organiser by mecha-man
(38) Napalm mod by cccp3
(39) Rocket fuel mod v0.15 by cccp3
(41) Useful web links by jward212
(42) TPT Logic Gates Mod by iamdumb
(43) ESTools by electronic_steve
(44) Head Crabs-HL2 by jward212
(45) Procedural Save Generator by boxmein
(46) smooth colours for nametag by jward212
(47) ZAKPACK by zak03
(49) Performance Monitor by FeynmanLogomaker
(51) Texter by byzod
(52) Texter default fonts by byzod
(53) Schicko's Font Pack for Texter by Schicko
(54) Realistic Element Names by Atomic10
(55) TPT's Mod V.3 Update 1 by Amy
(56) Temporaryaccount-Decorator by Temporaryaccount
(57) random save loader by jward212
(58) Tmp gradient display by ssccsscc
(59) particle re-orderer by mniip
(60) Electric Glow by jacob1
(61) More Fuel Mod-lite by jward212
(63) Rythidium by janekbe04
(64) Simple FPS GUI by Sfsjunior
(65) Enhanced Element Dehider by ChargedCreeper
(66) Graph of average temp by ssccsscc
(67) Template save loader by jacob1
(68) Lua Text Generator by jBot-42
(70) Pixel's Freezer by Pixelguru26
(71) Thingy | Fusion For Ever by TheChosenEvilOne
(72) op explosions by zolly_bro
(73) Scar by DorkyBobster
(74) ScreenShotMod by lill74
(77) Useful Things by TheEvilChosenOne
(78) Alchemy Mod by _MrN_
(79) Nuke v2 by Fnaf65
(80) Compressor mod by TheChosenEvilOne
(81) Custom Render Mode Loader by jacob1
(82) Spacewars by JosephMA
(83) MOAR - Alpha 0.1 by TheChosenEvilOne
(86) Element Creator by cxi
(88) Soapworm by LBPHacker
(90) Pressure Bomb by God_Kra
(91) SMFB by wntjq69
(92) Potato by cxi
(93) Subatomic Pack (BDS) by TPT_PL
(94) Acidic Pack (BDS) by TPT_PL
(95) Starbound Building Materials by Sanpypr
(96) Factory problems by TPT_PL
(97) Gamma Ray-diation by Kostia4381
(98) Magic by livingfossil
(99) Cross-window Copy/Cut/Paste by LBPHacker
(100) Langton's Ant with variations by LBPHacker
(101) Remote particle creator/deleter by TPT_PL
(102) Force fields by electronic_steve
(103) Reinforced Concrete by 12Me21
(105) TPT_PL's Lua Mod by TPT_PL
(106) Nuke v4 by Fnaf65
(107) CHEMMOD V1 by KevAK
(108) Chemicals by Ligan
(109) VonDaniel's Template by VonDaniel
(110) The Inaccurate Radioactivity Toy Mod by TuDoR2007
(112) textmonsterPack by textmonster404
(113) Meteor by TheScienceKid
(114) Tgpm by TuDoR2007
(115) Civilizations by TPT_PL
(116) RAD-MOD 1.2.1B by Kev_AK
(117) MicroLua by RamiLego4Game
(118) Extra customizable HUD by djy0212
(119) Ingame brush editor by ssccsscc
(120) Window Maker by Paul_31415
(121) CHEM-MOD V1.2B by Kev_AK
(122) Rainbow PHOT by Mrprocom
(123) stronger stickmanv by yuval
(124) 3D Pressure Visualizer by mniip
(125) Arkadian Liquid by JanKaszanka
(126) Fuel by nukers473
(127) Immersive Radioactivity v2.1 by Potbelly
(128) ElementLaunchingTool by juh9870
(129) CHEM-MOD_v1.2.2b by KevAK
(130) Slingshot by Mrprocom
(131) Perlin Noise Generator by DoubleF
(132) Element Replace by TomW1605
(133) Flooder V2 by TheAwesomeMutant
(134) Link Sign GUI by QuanTech
(135) Element dehider by 4e616d65
(136) Subphoton ROM Builder by mad-cow
(137) Hardened Dust by Liftski
(138) Bio-Vir by TheAwesomeMutant
(140) Orbit Simulator by Mrprocom
(141) johnnyou's Font for Texter by johnnyou (49796346)
(142) auto_wifi by phisically
(143) Layering helper by ssccsscc
(144) Layering Helper Extended by LuaMaster
(145) TPT Remade by TuDoR2007
(146) All-seeing sampler by djy0212
(147) Layering helper remastered by ssccsscc
(148) Eraser by thepowdertoy12
(149) EXPLOSIONS by olix3001
(150) Simple rocket fuel mod by ArseniyPlotnikov2006
(151) Pure Fission by Fnaf65
(154) Graph by ssccsscc
(155) Little's Pack! by LittleProgramming
(156) Lead by LoftisGaming
(157) WIFI Tuner by ssccsscc
(158) Previous Brush by TomW1605
(159) HUD Auto-Hider by Tim
(161) Stack tool by thepowdertoy12
(162) Oil and plastic by ArseniyPlotnikov2006
(163) Colored Ember by DUC
(164) Timer by ssccsscc
(165) Bacteria Mod by TuDoR2007
(166) Noise filter by LBPHacker
(167) Future-proof element dehider by LBPHacker
(168) RadioactiveNuke by DreamingWarlord
(169) Only Hot Element by DreamingWarlord
(170) Philosopher's Stone by Godhydra
(171) Conic section generator by LBPHacker
(172) Interface API by ssccsscc
(173) Metals&Materials by Ferrous26
(174) tpt.all by LBPHacker
(175) The Visual Elements Pack by Goblin01, vvv331
(176) Layering Helper Reforged by PowderNotSolid
(177) SNOWified SING by LBPHacker
(178) FPS Chart by Goblin01
(179) TPT font writer by Goblin01
(180) Simple Ruler by PowderNotSolid
(181) Heat Modifier by DreamingWarlord
(182) TPT Remade II by TuDoR2007
(183) Gravity simulator by ArseniyPlotnikov2k6
(184) Unobtainium by christheboss894
(185) TPTMIDI noteblock in tpt by djy0212
(186) DreamingWarlord's Lua Tool by DreamingWarlord
(187) Elements Tooltip by Goblin01
(189) Explodium script by 0d15ea5ebe57c0debadc0ffee0ddf00d
(190) more powered force elements by 6nop6nop
(191) Yzaak1Scifire Modpack by Yzaak1Scifire
(194) Fluor and more modpack! by galaktor
(195) Hot Powder by lieve_blendi
(196) Star by TUANMINHVIETNAM
(197) Heat Powders by lieve_blendi
(200) Tangeriinium (thx 2 cxi 4 code) by LostEditor
(201) Freezer by lieve_blendi
(202) Powder Power! by TPTSortaGuy
(203) PowderPlus v1.4 by PowderPlus Team
(204) fire by ME
(205) Stacked Goo Animations by Maticzpl
(206) Stickman Control for Android Version by PhauloRiquelme
(207) Spark Removal Button by Xyz
(208) More HEAC's! by Maxhd1234
(209) Immersive Radioactivity v3.0 by Potbelly
(210) Subframe Chipmaker Script by Maticzpl
(211) Realistic Propellants by ArseniyPlotnikov2k6
(212) Mass Equals Gravity by Maticzpl
(213) PhiMod v1 by ArolaunTech
(214) PC Controls for Android by Cracker1000
(217) Single-pixel pipe configurator by LBPHacker
(218) Omega Death Laser Gun by Dogeoum
(219) Notifications by Maticzpl
(221) Powderizer by ArolaunTech
(222) ElemDehider 1.2 by Inventor70
(223) Unobtainum V2 by DoomKittyAttack
(224) Organics Mod v0.2B by PowderPlus Team
(225) Gravity distortion by Avolte55
(226) tmp Wifi by PhauloRiquelme
(227) Alchemagica Mod v1.0 by RebMiami
(228) Fan Elements Mod by RebMiami
(229) Impossibilities by ArolaunTech
(230) Realistic Explosives by ArseniyPlotnikov2k6
(231) libactivation by anamorphic
(232) Alloy Brushes by Maticzpl
(233) Gravity bender by pres
(234) Slow Tick by Pixel
(235) Paste ID by Maticzpl
(236) many things by jadenflp2
(237) Territect by Rebmiami
(238) Better Descriptions v1.0.5 by ashyboi2022
(239) LIGHTNING SPRK by GOLmaster10101
(240) Small Bombs by juh9870
(241) Save Shop by aaccbb
(242) Moving solids v1.3.0 Beta by ArolaunTech
(244) Alchemistry by rdococ
(245) ETRD (Formerly PowderIM) by aaccbb
(246) RadonX by Justadirtblock
(248) Water-X by deuterium_oxide
(250) Indestructible INSL by CheekyRand0m
(252) Console's Mod by Console/Compec
(255) Slow motion by LBPHacker
(256) Powered Repeller by Hythonia
(257) Zeta's Electric Tools. by Zetalasis
(258) Azure serum (AZSR) by ALumpOfPowderToy
(259) COLORFULSAND by xert
(260) Lightning Circle by defaultuser0
(261) Powder Future Tech by JonaHungary
(262) TPTGlowingSolids by DestinyDyson
(263) Volcano Bomb by I_am_the_NugsWorld
(264) Neon Lights by Rebmiami
(265) Radioactive Materials by xyz
(266) Eater mod by VIPERGAMEZ
(267) the biology mod by someone
(268) Atomic Physics by qe
(269) Pure Radiation by ronansb
(270) Fake Elements by That_PowderToy_Guy
(271) Tachyons and MISC by RamenNoods
(272) Exotic Particles by rdococ
(273) FPS Slider by aaccbb
(274) Enphosian's Radioactive mod pack by Enphosian
(276) ROM Builder by QnpfvTPz

+ Submit new script!

Title: Author:
Script:
-- Version: Unspeakable Crawling Sternum

local fonts, fontmatrix = nil, nil
if Texter then fonts, fontmatrix = Texter._Fonts, Texter._Fontmatrix end
Texter = {}
Texter._LastInput = {
	Str  = "",
	Args = "1, 3",
	Font = "7px",
	Mode = 0
}

------------------ User config zone -------------------
Texter.FONT_FOLDERS_TO_LOAD = {"TexterFonts", "scripts", "%."}   -- All file will be "dofile" under those foler name, the root dir must be written regex form %.
Texter.DISPLAY_MESSAGES     = false              -- Should show the startup message [true: show, false: don't show]
Texter.FONT_SEARCH_DEPTH    = 3                 -- How deep should texter search the font folder [0: only the root folder]
---------------- User config zone ends ----------------

function Texter.Init(register)
	Texter._Fontmatrix = fontmatrix or {}
	Texter._Fonts = fonts or {}
	-- Please don't let Texter too far away from font file :)
	local fontFiles = Texter.LoadAllFontsInFolder(".", Texter.FONT_FOLDERS_TO_LOAD, Texter.FONT_SEARCH_DEPTH)
	local msg = ""
	if(Texter._Fontmatrix ~= nil) then
		for fontName in pairs(Texter._Fontmatrix) do
			table.insert(Texter._Fonts, fontName)
		end
		msg = "Texter: "..#fontFiles.." font file(s) loaded, "..#Texter._Fonts.." font(s) available in total."
	else
		msg = "Texter: No font found."
	end
	if( Texter.DISPLAY_MESSAGES ) then
		tpt.log(msg)
	end
	if( register == nil or register == true ) then
		event.register(event.keypress, Texter._HotkeyHandler)
	end
end

-- Internal methods
function Texter._IsFolder(path)
	local _isFolder = false
	if(path ~= nil) then
		if( fs.isDirectory(path)  ) then
			_isFolder = true
		end
	end
	return _isFolder
end
function Texter._GetFontHeight(fontName)
	local height = 0
	if( Texter._Fontmatrix ~= nil and Texter._Fontmatrix[fontName] ~=nil and Texter._Fontmatrix[fontName].Height ~= nil  ) then
		height = Texter._Fontmatrix[fontName].Height
	else
		height = 7 -- 7 is a lucky number
	end
	return height
end
function Texter._Input(eventHandler, fonts, paramsText, strText, fontText, mode)
	local controlHeight = 17
	local MOD_CTRL, MOD_SHIFT
	if( paramsText == nil  ) then paramsText = "" end
	if( strText    == nil  ) then strText    = "" end
	if( fontText   == nil  ) then fontText   = "" end
	if( mode       == nil  ) then mode       = 0  end
	if( fonts      == nil  ) then fonts      = {} end
	
	local isContains = function(inTable, value)
		local isContain = false
		for i=1, #inTable do
			if( value == inTable[i]  ) then
				isContain = true
				break
			end
		end
		return isContain
	end
	
	local TexterWin     = Window:new(-1, -1, 500, 100)
	local paramsBox     = Textbox:new(10, controlHeight + 15, 150, controlHeight, paramsText, "ptype, hspc, vspc")
	local paramsLabel   = Label:new(11, 9, 130, controlHeight, "Element type and\nhorizontal/vertical spacing.")
	local modeBox       = Button:new(170, controlHeight + 15, 150, controlHeight, "No mode available")
	local modeLabel     = Label:new(171, 9, 150, controlHeight, "Font mode you want to use.")
	local stringBox     = Textbox:new(10, 57, 480, controlHeight, strText, "Input text to create under mouse. Use \\n for new line, \\\\n for \\n. Etc.")
	local fontBtn       = Button:new(330, controlHeight + 15, 150, controlHeight, "No font available")
	local fontLabel     = Label:new(331, 9, 150, controlHeight, "Select the font you want to use.")
	local cancelBtn     = Button:new(0, 83, 251, controlHeight, "Cancel")
    local terminate = function(sender)interface.closeWindow(TexterWin)end
	cancelBtn:action(terminate)
	local okayBtn = Button:new(250, 83, 250, controlHeight, "Okay")
    local function okayAction(sender)
			if( eventHandler ~= nil and type(eventHandler) == "function"  ) then
				-- Use event because I can't make things like tpt.input
				eventHandler(paramsBox:text(), stringBox:text(), fontBtn:text(), tonumber(modeBox:text()))
			end
			interface.closeWindow(TexterWin)
		end
	okayBtn:action(okayAction)
	if( mode >= 0 ) then
		modeBox:text(tostring(mode))
	end
	modeBox:action(
		function(sender)
			local input = tpt.input("Font mode", "The draw mode:\n0  Ignore all additional information\n+1 Keep the ptype in font\n+2 Keep the dcolor in font\nAdd your choices up then type in.")
			local mode = tonumber(input)
			if( mode~= nil and mode >= 0 )then
				sender:text(input)
			else
				sender:text("0")
			end
		end
	)
	if(#fonts > 0) then
		if( isContains(fonts, fontText)  ) then
			fontBtn:text(fontText)
		else
			fontBtn:text(fonts[1])
		end
		fontBtn:action(
			function(sender)
				local winX, winY = TexterWin:position()
				local btnX, btnY = fontBtn:position()
				local btnW, btnH = fontBtn:size()
				local listWin = Window:new(winX+btnX, winY+btnY-controlHeight*(#fonts-1)/2, btnW, (btnH-1)*#fonts)
				for i=1, #fonts do
					local optionBtn = Button:new(0, (btnH-1)*(i-1), btnW, btnH, fonts[i])
					optionBtn:action(
						function(sender)
							interface.closeWindow(listWin)
							fontBtn:text(optionBtn:text())
						end
					)
					listWin:addComponent(optionBtn)
				end
				listWin:onTryExit(function()interface.closeWindow(listWin)end)
				interface.showWindow(listWin)
			end
		)
	end

	local function guiKeyhook(key, scan, shift, ctrl, alt)
		MOD_CTRL, MOD_SHIFT = ctrl, shift
	end

	local function onTryOkay()
		local sender = TexterWin
		if not MOD_CTRL and MOD_SHIFT then
			-- Shift + Enter: Insert newline
			local str = stringBox:text() .. [[\n]]
			if tpt.textwidth(str) < select(1, stringBox:size()) - 8 then
				stringBox:text(str)
			end
		else
			-- Enter: submitting
			okayAction(sender)
		end
	end
	

	TexterWin:addComponent(cancelBtn)
	TexterWin:addComponent(okayBtn)
	TexterWin:addComponent(stringBox)
	TexterWin:addComponent(paramsBox)
	TexterWin:addComponent(paramsLabel)
	TexterWin:addComponent(modeBox)
	TexterWin:addComponent(modeLabel)
	TexterWin:addComponent(fontBtn)
	TexterWin:addComponent(fontLabel)
    TexterWin:onTryExit(terminate)
    TexterWin:onTryOkay(onTryOkay)
	TexterWin:onKeyPress(guiKeyhook)
	TexterWin:onKeyRelease(guiKeyhook)
	
	interface.showWindow(TexterWin)
end
local PATH_SEP = package.config:sub(1,1)
function Texter._FindAllFile(rootPath, foldersToLoad, depth)
	if(  rootPath == nil  ) then
		rootPath = "."
	end
	if(  depth == nil  ) then
		depth = 1
	end
	local files = {}
	local isTargetFolder = false
	for i, folderName in ipairs(foldersToLoad) do 
		if( string.match(rootPath, PATH_SEP.."?"..folderName.."$") ~= nil ) then
			isTargetFolder = true
			break
		end
	end
	if( isTargetFolder ) then  -- If not the folder we want, ignore it
		files = fs.list(rootPath)
	end
	
	-- Trim match array
	local index = 1 -- Lua fool
	for i=1, #files do
		if( files[index] == "Texter.lua" 
		  or string.match(files[index], "%.texterfont$") == nil
		  or Texter._IsFolder(rootPath..PATH_SEP..files[index]) ) then
			table.remove(files, index)
		else
			files[index] = rootPath..PATH_SEP..files[index] -- full path
			index = index + 1
		end
	end
	
	-- Check subs
	if(  depth > 0  ) then
		local subs = fs.list(rootPath)
		local subFiles = nil
		for i=1, #subs do
			if( Texter._IsFolder(rootPath..PATH_SEP..subs[i]) ) then
				subFiles = Texter._FindAllFile(rootPath..PATH_SEP..subs[i], foldersToLoad, depth - 1)
				Texter._AppendArray(files, subFiles)
			end
		end
	end
	return files
end
function Texter._AppendArray(oriArray, arrayToAppend) -- Append an array to the original array
	if(  oriArray~= nil and arrayToAppend ~= nil and #arrayToAppend>0  ) then
		for i=1, #arrayToAppend do
			table.insert(oriArray, arrayToAppend[i])
		end
	end
	return oriArray
end

-- Helper methods and handlers
-- function Texter._HotkeyHandler(key, keyNum, modifier, event) -- Hotkey handler
function Texter._HotkeyHandler(key, keyNum, rep, shift, ctrl, alt) -- Hotkey handler
	if( not rep and ctrl and not shift and not alt and key==116 ) then -- Ctrl + t
		-- Additional settings
		local ptype = elements[tpt.selectedl]
		if( ptype == nil  ) then
			ptype = 1 --"DUST"
		end
		-- Prompt
		Texter._Input(
			Texter._InputHandler,
			Texter._Fonts,
			elements.property(ptype, "Name")..", "..Texter._LastInput.Args,
			Texter._LastInput.Str,
			Texter._LastInput.Font,
			Texter._LastInput.Mode
		)
	end
end
function Texter._InputHandler(params, str, fontName, mode) -- Input handler
	local args = {}
	if( string.len(str) > 0  ) then
		Texter._LastInput.Str = str
		-- it just strips one backslash off the escape sequence for newline ie \\\n -> \\n
		-- same as in Subphoton GUI. See original for actual unescaping.
		str = str:gsub([[(\*)(\n)]], function(backslashes, escaped)
            -- escaped will always have one \ ie \n
            -- backslashes will have 0 or more \'s
            local half = string.rep([[\]],#backslashes - 1)
            -- to actually escape, do: if #backslashes % 2 == 1 then
            if #backslashes > 0 then -- ie \\t or \\\\t ; this will still be escaped
                return string.format("%s%s", half, escaped)
            else -- ie \t or \\\t ; this will be UNescaped
                return '\n'
            end
        end)
	end
	
	if( string.len(params) > 0  ) then Texter._LastInput.Args = string.gsub(params, "%s*[^,]*%s*,%s*(.*)", "%1") end
	local i=1
	for arg in string.gmatch(params, "%s*([^,]*)%s*,?") do
		args[i] = arg
		i = i+1
	end
	Texter._LastInput.Font = fontName
	Texter._LastInput.Mode = mode
	
	if( pcall(tpt.element, args[1]) == false  ) then
		args[1] = "DUST"
	end
    local mx, my = sim.adjustCoords(tpt.mousex, tpt.mousey)
	Texter.Tstr(str, mx, my, args[1], mode, args[2], args[3], fontName)
end

-- APIs
function Texter.LoadAllFontsInFolder(rootPath, foldersToLoad, depth) -- Load all fonts in target folder(s)
	local fonts = Texter._FindAllFile(rootPath, foldersToLoad, depth)
	if(  fonts ~= nil  ) then
		for i=1, #fonts do
			dofile(fonts[i])
		end
	end
	return fonts
end
function Texter.Tchar(char, x, y, ptype, mode, fontName) -- Draw a single character
	local mtx     = {}
	local letter  = {}
	local PTYPE_MASK  = 0xFF
	local DCOLOR_MASH = 0xFFFFFFFF
	local DCOLOR_OFFSET = 8
	local margin_L = 0 -- margin left
	local margin_R = 0 -- margin right
	local margin_T = 0 -- margin top
	-- if given font not available, use the first available one
	if( fontName == nil or Texter._Fontmatrix[fontName] == nil  ) then
		for font in pairs(Texter._Fontmatrix) do
			fontName = font
			break
		end
	end
	-- if still not available, break
	if( fontName == nil  ) then return 0 end
	
	-- get character data
	letter = Texter._Fontmatrix[fontName][char]
	if( letter == nil  ) then
		letter = Texter._Fontmatrix[fontName]["nil"]
	end
	if( letter == nil  ) then return 0 end -- ["nil"] not defined
	mtx = letter.Mtx
	if( mtx == nil  ) then mtx = {} end
	if( letter.Margin ~= nil  ) then
		if(letter.Margin.Left  ~= nil)then margin_L = letter.Margin.Left  end
		if(letter.Margin.Right ~= nil)then margin_R = letter.Margin.Right end
		if(letter.Margin.Top   ~= nil)then margin_T = letter.Margin.Top   end
	end
	
	local width  = 0
	for i=1, #mtx do --mtx height
		if(#mtx[i] > width)then width = #mtx[i] end
		for j=1, width do
			local particle = mtx[i][j]
			if( particle~=0  ) then
				local success = false
				local p = {}
				p.ptype  = bit.band(particle                , PTYPE_MASK )
				p.dcolor = bit.band(particle/2^DCOLOR_OFFSET, DCOLOR_MASH) -- bit.rshift can only handle 5 bits :(
				if( ptype == 0 or ptype == "0" ) then
					pcall(tpt.delete, x+j-1+margin_L, y+i-1+margin_T) 
				else
					-- mode 0 use the given type
					--     +1 use the font ptype only
					--     +2 use the font dcolor only
					if( bit.band(mode, 1) ~= 1 ) then
						p.ptype = ptype
					end
					-- tpt.log("particle is "..particle..", ptype is "..ptype..", to draw is "..p.ptype)-- debug
					pcall(tpt.create, x+j-1+margin_L, y+i-1+margin_T, p.ptype)
					if( bit.band(mode, 2) == 2 ) then -- Paint it even when failed to create. Because there might be existed particle
						-- tpt.log("Try to draw dcolor: "..p.dcolor.." ( 0x"..string.format("%X", p.dcolor).." )") --debug
						pcall(tpt.set_property, "dcolor", p.dcolor, x+j-1+margin_L, y+i-1+margin_T, 1, 1)
					end
				end
			end
		end
	end
	width = width + margin_L + margin_R
	return width
end
function Texter.Tstr(str, x, y, ptype, mode, hspacing, vspacing, fontName) -- Draw a string
	local ox    = 0
	local oy    = 0
	local oy    = 0
	local fontH = Texter._GetFontHeight(fontName)
	if( mode == nil  ) then
		mode = 0
	end
	if( hspacing == nil  ) then
		hspacing = 1
	end
	if( vspacing == nil  ) then
		vspacing = 3
	end
	for i=1,string.len(str) do
		if( string.sub(str, i, i) == "\n"  ) then
			oy = vspacing + oy + fontH
			ox = 0
		else
			ox = hspacing + ox + Texter.Tchar(string.sub(str, i, i), x+ox, y+oy, ptype, mode, fontName)
		end
	end
	return string.len(str)
end
function T(str, ptype, mode, hspc, vspc, fontName) -- Shortcut for better user experience
	if( ptype == nil  ) then
		ptype = elements[tpt.selectedl] -- elements.property(tpt.selectedl, "Name")
	end
	if( ptype == nil  ) then
		ptype = "DUST"
	end
	if( str == nil  ) then str = "" end
	local mx, my = sim.adjustCoords(tpt.mousex, tpt.mousey)
	Texter.Tstr(str, mx, my, ptype, mode, hspc, vspc, fontName)
	return string.len(str)
end

Texter.Init()

Description:

Changelog: