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:
-- Possible mass colours {PrimaryR, PrimaryG, PrimaryB, BrightR, BrightG, BrightG}
local massClrs = {
  {244, 67, 54, 229, 115, 115},
  {233, 30, 99, 240, 98, 146},
  {156, 39, 176, 186, 104, 200},
  {103, 58, 183, 149, 117, 205},
  {63, 81, 181, 121, 134, 203},
  {33, 150, 243, 100, 181, 246},
  {3, 169, 244, 79, 195, 247},
  {0, 188, 212, 77, 208, 225},
  {0, 150, 136, 77, 182, 172},
  {76, 175, 80, 129, 199, 132},
  {139, 195, 74, 174, 213, 129},
  {205, 220, 57, 220, 231, 117},
  {255, 235, 59, 255, 241, 118},
  {255, 193, 7, 255, 213, 79},
  {255, 152, 0, 255, 183, 77},
  {255, 87, 34, 255, 138, 101},
  {121, 85, 72, 161, 136, 127},
  {158, 158, 158, 224, 224, 224},
  {96, 125, 139, 144, 164, 174}
}

-- Graphics function of MASS and SMAS. Should be invisible, it is only used to specify power and direction to shoot CMAS
-- Also used in SMAS, but that cannot be launched
local function massLaunchG(i, colr, colg, colb)
  return 1, ren.PMODE_NONE, 0, 0, 0, 0
end

-- Graphics function of CMAS (central particle of masses)
local function cmasG(i, colr, colg, colb)
  local x, y = sim.partPosition(i)
  local radius = sim.partProperty(i, sim.FIELD_TMP2) - 1
  local clr = massClrs[sim.partProperty(i, sim.FIELD_LIFE)]
  -- Draw a semi-transparent circle around CMAS and a non-transparent border around it
  graphics.fillCircle(x, y, radius, radius, clr[1], clr[2], clr[3], 200)
  graphics.drawCircle(x, y, radius, radius, clr[1], clr[2], clr[3], 255)
  if sim.partProperty(i, sim.FIELD_TMP) == 1 then
    -- Use the brighter colours for the borders around static mass to make it easy to distinguish
    graphics.drawCircle(x, y, radius, radius, clr[4], clr[5], clr[6], 200)
    graphics.drawCircle(x, y, radius + 1, radius + 1, clr[4], clr[5], clr[6])
  end
  return 0, ren.PMODE_FLAT, 200, clr[1], clr[2], clr[3]
end

-- Update function of CMAS
local function cmasU(i, x, y, s, nt)
  if sim.partProperty(i, sim.FIELD_TMP) == 0 then
    local forceX, forceY = 0, 0
    -- Loop through all other masses to update the total gravitational forces
    for otherI in sim.parts() do
      if sim.partProperty(otherI, sim.FIELD_TYPE) == tpt.element("CMAS") and otherI ~= i then
        local distanceX = sim.partProperty(otherI, sim.FIELD_X) - x
        local distanceY = sim.partProperty(otherI, sim.FIELD_Y) - y
        local distance = math.sqrt(distanceX^2 + distanceY^2)
        -- Merge masses if their central particles are too close to each other
        if distance <= 2 then
          local radius = sim.partProperty(i, sim.FIELD_TMP2)
          local otherRadius = sim.partProperty(otherI, sim.FIELD_TMP2)
          -- Merge the smaller one into the bigger one
          if radius >= otherRadius then
            sim.partProperty(i, sim.FIELD_TMP2, math.floor(math.sqrt(radius^2 + otherRadius^2)))
            sim.partKill(otherI)
          else
            sim.partProperty(otherI, sim.FIELD_TMP2, math.floor(math.sqrt(radius^2 + otherRadius^2)))
            sim.partKill(i)
          end
          return
        end
        local angle = math.atan2(distanceY, distanceX)
        -- Does not have to be extremely realistic, that is why the equation used here is simplified
        local force = sim.partProperty(i, sim.FIELD_TMP2)^2 * sim.partProperty(otherI, sim.FIELD_TMP2)^2 / distance^2
        -- Force should not exceed 1000 or else it would cause problems
        if force > 1000 then force = 1000 end
        forceX = forceX + force * math.cos(angle)
        forceY = forceY + force * math.sin(angle)
      end
    end
    local newVX = sim.partProperty(i, sim.FIELD_VX) + forceX / (60 * sim.partProperty(i, sim.FIELD_TMP2))
    local newVY = sim.partProperty(i, sim.FIELD_VY) + forceY / (60 * sim.partProperty(i, sim.FIELD_TMP2))
    sim.partProperty(i, sim.FIELD_VX, newVX)
    sim.partProperty(i, sim.FIELD_VY, newVY)
  else
    -- Static masses never move and should not be affected by Newtonian gravity
    sim.partProperty(i, sim.FIELD_VX, 0)
    sim.partProperty(i, sim.FIELD_VY, 0)
  end
end

-- Define MASS, SMAS (the mass launcher) and CMAS (the central particle of the mass being launched)
local smas = elem.allocate("PROCOM", "SMAS")
elem.element(smas, elem.element(elem.DEFAULT_PT_DMND))
elem.property(smas, "Name", "SMAS")
elem.property(smas, "Description", "Static Mass. Similar to MASS, but does not move.")
elem.property(smas, "Color", 0xFF607D8B)
elem.property(smas, "Properties", elem.PROP_LIFE_KILL + elem.PROP_NOCTYPEDRAW)
elem.property(smas, "Graphics", massLaunchG)

local mass = elem.allocate("PROCOM", "MASS")
elem.element(mass, elem.element(elem.DEFAULT_PT_DMND))
elem.property(mass, "Name", "MASS")
elem.property(mass, "Description", "Mass. A launchable object with a gravitational force.")
elem.property(mass, "Color", 0xFF9E9E9E)
elem.property(mass, "Properties", elem.PROP_LIFE_KILL + elem.PROP_NOCTYPEDRAW)
elem.property(mass, "Graphics", massLaunchG)

local cmas = elem.allocate("PROCOM", "CMAS")
elem.element(cmas, elem.element(elem.DEFAULT_PT_PHOT))
elem.property(cmas, "Name", "CMAS")
elem.property(cmas, "Description", "Centre of Mass. The central particle in masses. Can be placed using MASS or SMAS.")
elem.property(cmas, "MenuVisible", 0)
elem.property(cmas, "Temperature", sim.R_TEMP + 273.15)
elem.property(cmas, "Graphics", cmasG)
elem.property(cmas, "Update", cmasU)

-- Remove PROP_LIFE_DEC and PROP_LIFE_KILL_DEC
elem.property(cmas, "Properties", bit.band(elem.property(cmas, "Properties"), bit.bnot(elem.PROP_LIFE_DEC + elem.PROP_LIFE_KILL_DEC)))

local massIdent = elem.property(mass, "Identifier")
local smasIdent = elem.property(smas, "Identifier")
local zooming = false
local holding = false
local x1, y1, x2, y2

-- This function checks if mousex and mousey are within workspace
local function inWorkspace(mousex, mousey)
  if mousex >= 4 and mousey >= 4 and mousex <= 607 and mousey <= 379 then return true end
end

-- This function checks if MASS or SMAS is selected
local function selected(button)
  if (button == 1 and (tpt.selectedl == massIdent or tpt.selectedl == smasIdent)) or
    (button == 4 and (tpt.selectedr == massIdent or tpt.selectedr == smasIdent)) or
    (button == 2 and (tpt.selecteda == massIdent or tpt.selecteda == smasIdent)) then
      return true
  end
end

-- This functions returns the ident of the selected mass element
local function whichMass(button)
  if (button == 1 and tpt.selectedl == massIdent) or (button == 4 and tpt.selectedr == massIdent) or (button == 2 and tpt.selecteda == massIdent) then
    return massIdent
  else
    return smasIdent
  end
end

-- Zooming is later used in prelaunch to fix the bug where masses are launched when placing a zoom box if they are selected
-- This function is also used to reset the velocity of all masses when alt+= is pressed
local function keyFunction(key, keyCode, modifierKeys, event)
  if key == "z" and event == 1 then
    zooming = true
  elseif key == "z" and event == 2 then
    zooming = false
  elseif key == "=" and bit.band(modifierKeys, 0x300) ~= 0 and event == 1 then
    for i in sim.parts() do
      if sim.partProperty(i, sim.FIELD_TYPE) == tpt.element("CMAS") then
        sim.partProperty(i, sim.FIELD_VX, 0)
        sim.partProperty(i, sim.FIELD_VY, 0)
      end
    end
  end
end

-- This function draws the power line
local function drawMotion()
  local length = math.sqrt((x2 - x1)^2 + (y2 - y1)^2)
  local vx = (x1 - x2) / 40
  local vy = (y1 - y2) / 40
  local r = 0 + length * 2.5
  local g = 255 - length
  graphics.drawLine(x1 + 2, y1, x2, y2, r, g, 0, 25)
  graphics.drawLine(x1 - 2, y1, x2, y2, r, g, 0, 25)
  graphics.drawLine(x1, y1 + 2, x2, y2, r, g, 0, 25)
  graphics.drawLine(x1, y1 - 2, x2, y2, r, g, 0, 25)
  graphics.drawLine(x1 + 1, y1 + 1, x2, y2, r, g, 0, 180)
  graphics.drawLine(x1 + 1, y1 - 1, x2, y2, r, g, 0, 180)
  graphics.drawLine(x1 - 1, y1 + 1, x2, y2, r, g, 0, 180)
  graphics.drawLine(x1 - 1, y1 - 1, x2, y2, r, g, 0, 180)
  graphics.drawLine(x1 + 1, y1, x2, y2, r, g, 0, 230)
  graphics.drawLine(x1 - 1, y1, x2, y2, r, g, 0, 230)
  graphics.drawLine(x1, y1 + 1, x2, y2, r, g, 0, 230)
  graphics.drawLine(x1, y1 - 1, x2, y2, r, g, 0, 230)
  graphics.drawLine(x1, y1, x2, y2, r, g, 0)
end

-- This function creates a mass object with the right vx and vy
local function launch(massType)
  local vx = (x1 - x2) / 40
  local vy = (y1 - y2) / 40
  local radius = math.min(tpt.brushx, tpt.brushy) + 1
  if massType == massIdent then
    sim.createParts(x1, y1, radius - 1, radius - 1, 0)
    local newMass = sim.partCreate(-3, x1, y1, cmas)
    sim.partProperty(newMass, sim.FIELD_TMP2, radius)
    sim.partProperty(newMass, sim.FIELD_VX, vx)
    sim.partProperty(newMass, sim.FIELD_VY, vy)
    -- Give it a random colour
    sim.partProperty(newMass, sim.FIELD_LIFE, math.random(#massClrs))
  else
    sim.createParts(x1, y1, radius, radius, 0)
    local newMass = sim.partCreate(-3, x1, y1, cmas)
    sim.partProperty(newMass, sim.FIELD_TMP2, radius)
    sim.partProperty(newMass, sim.FIELD_TMP, 1)
    sim.partProperty(newMass, sim.FIELD_LIFE, math.random(#massClrs))
  end
end

-- This is the main function where everything starts
local function prelaunch(mousex, mousey, button, event)
  if selected(button) and not zooming and ((inWorkspace(mousex, mousey) and not holding) or holding) then
    if event == 1 then
      x1, y1 = sim.adjustCoords(mousex, mousey)
      x2, y2 = x1, y1
      if whichMass(button) == massIdent then
        holding = true
        tpt.register_step(drawMotion)
      else
        launch(smasIdent)
      end
    elseif event == 3 and whichMass(button) == massIdent then
      x2, y2 = sim.adjustCoords(mousex, mousey)
    elseif whichMass(button) == massIdent then
      tpt.unregister_step(drawMotion)
      holding = false
      launch(whichMass(button))
    end
  end
end

tpt.register_keypress(keyFunction)
tpt.register_mouseclick(prelaunch)

Description:

Changelog: