Using The Console

From The Powder Toy
Revision as of 19:24, 28 September 2011 by (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Using console </h5> As of 49.1 the commands now require a ! in front of them. The console in Powder Toy is essentially a window that you can bring up that allows you to directly trigger commands coded into TPT. Because of its closeness to the code itself, you can do interesting things with it that wouldn't ordinarily be possible with just pointing and clicking, or even elaborate hacking. Opening the console is easy. You press the ~ key (on some keyboards it's ` or ¬) (with or without pressing shift, it's immediately left of the 1 key, above Tab on most keyboards) and the game will pause, bringing down a black window that you can type into. View the key here Compared to most consoles, Powder Toy's is actually fairly intuitive and easy to mess with, but you'll still probably have to try a few times to memorize the order of words to type in. The console window conveniently lists commands in fact, so if you can figure it out from there, then good for you. ^_^ The most relevant, or at least the most immediately cool and useful command that most people will want to know is the Set command. The syntax goes like this: !Set [What variable to set] [the identity of the particle/s to be set] [the value it changes to] In other words, say I want to change particle #25 into metal. I would type: !Set type 25 metl To find out the ID-Number of a certain particle you can simply press 'D' to enter the Debug-Mode. Once you hover the cursor over a particle, its ID is then shown in the top right corner. More relevantly, you can use the keyword "All" or even an element name in place of that number. So the command: !Set type all metl Would turn every particle in the save to metal. :D !Set type metl watr ...Would turn every particle of metal in the save to water. And so on. !Set type metl none Would remove all metal particles from the save. The word "Type" is also interchangeable. The following keywords can be used as well:
  • Type: This sets a particle's identity. You can use this to change what an element is.
  • Temp: This sets a particle's temperature. You can use it to melt a whole save all at once. >:O (please note: the temp is read as Kelvin which you get by adding 273.15 to Celsius)
  • Ctype: This sets the temporary state of an element. This has many uses, making lava that freezes into NEUT for example. To do this, draw on some lava then go to console and type "!set ctype lava neut" (without the quotes of course) and then hit enter. Then draw something at room temp below it, and unpause it. When the lava hits the cooler object it will freeze into neut.
  • Life: This sets a particle's life expectancy. This variable however is used for many varied things, like the timing of spark and the colors of fire.
  • X, Y, VX, VY: These set the X and Y positions of particles in the field. VX and VY respectively set their velocities.
  • Tmp: This is used for varying things, like the colors of Quartz.
The !Quit command is a straight forward one; it closes the powder toy straight away. The Create command is also pretty straight-forward. By typing the elements name and the coordinates you want it at, you can create a particle of any element. For example: !Create METL 200,100 This will create a pixel of METL (metal) at point (200,100) on TPT's grid. This wiki page does not cover the other commands yet. The page of the console essentially describes how to use it, and with these examples, take and figure it out. <h4> Running scripts </h5> You can run console commands stored in a file by creating a text document and writing a script. Then you must rename the file extension from .txt to .lua (so that you can use it) When you have done that, open the LUA console in the Powder Toy and type in dofile("script.lua") (keep it exactly as written) (replace script.lua with the name of your file.) <h4> Hints and tips on using tmp, life, and ctype </h5> Admins/TPT-devs please fill in this section with which particle types are effected by the "tmp", "life", and "ctype" variables, and what those effects are with each particle type that uses them. Please also give some example code.
ctype </h6>
  • Clone (BCLN, PCLN, CLNE): ctype is the element being generated by the clone. For example, you can make all the clne on the screen generate neutrons with the console/script command "!set ctype clne neut"
  • State changes (ICE, LAVA): ctype is the element to melt/freeze into. For example, you can make lava freeze into bomb like this "!set ctype lava bomb". That actually gets some interesting results.
  • SPRK: ctype is the element covered by the spark.
  • Color (PHOT, FILT, FWRK, GLOW, BRAY): ctype is used to store various bits of information about color. There is currently no simple way to change this with console.
  • PIPE: Ctype distinguishes the different types of pipe (red/green/blue/unallocated). There is currently no simple way to change this with console (but experiment with setting ctype to none, dust, watr, oil, fire). For more information on pipe, see Using PIPE element.
  • QRTZ: QRTZ growth uses ctype. For example, the natural way is to pour SLTW on it. The SLTW changes the ctype to DUST. "set ctype qrtz sprk" will cause rapid, unnatural growth. This can also be achieved by sparking QRTZ manually.
  • WIRE: The different types of WIRE(Electron head, tail, wire) are distinguished by it's ctype. Try experimenting with ctypes DUST, WATR and none.
<h5> tmp </h6> Tmp is a value used for various element properties. Only a few elements actually use it, so if you try setting it and nothing happens... Then that's exactly right, only specific elements use it. If you don't know how it is used for an element, you're better off not messing with it. NOTE: this is NOT temperature (which is called 'temp'). <h5> life </h6> Use this with with fire or plasma to make it have more or less time until it burns out. For example, "!set life fire 1000" to make it last for a VERY long time (even to the point it is unrealistically still glowing even after its temperature has cooled to room temperature, same with plasma). Use with fuse to make it be in the already burning state by reducing this number to something really low like 1 (command for that is "!set life fuse 1"). You can use it to basically put any element into a state that uses the same special property but use it either much more, better, longer, shorter, worse, or less. E.G.:
  • DEUT has a property that says it can multiply itself based on its temperature. You may use life to make it obey this property but at the same time make it use it vastly more. As in, 99999 life deut makes it expand across the whole screen provided lag doesn't get to it first!
  • Another closely studied use of the life variable is what it does to ACID. Acid is corosive, no? It has a set life value of 75 that cannot be raised without editing the game engine. The more particles acid corrodes away the lesser its life value becomes. If set below fifty any particle can destroy acid. These are just a few of the countless things that can be done with my favorite, the life variable.
  • Switches, like SWCH, HSWC, PCLN, and PUMP, also use life to turn on and off.
  • Portals use life to generate their effects. This is one of the only times life goes into negative naturally.
  • Stickman's health can be changed by editing his life.
  • SPRK uses not only ctype, but life as well. SPRK on most metals has a life of 4. On INST it has a life of 1. This shows how long the spark will remain on the material. The material afterward then uses life to calculate when it can be sparked again.
<h4> Basic "moving solids"

Many people ask for them, but no. Movable solid objects such as balls, strings, and gears will not be coming without a complete rewrite of the Powder Toy Program. So to keep the masses satisfied, here's how to make a basic moving solid ball.

Only SPNG works! </h6> Currently, SPNG is the best working solid for this. Others, like GOO and BCLN work to a small extent, and most elements don't work at all. <h5> Making it work </h6> Make a large ball (or cube) of SPNG in the rough middle of the screen. This will be the solid that will move. Go into console. Write the following: !set vx spng 1 Congratulations, your SPNG will now move right at a speed of one. !set vx spng -1 Hooray! Now it moves left! !set vy spng 1 Now it's going down! Yipee! !set vy spng -1 Now it flies upward! Incredible! Get it? Got it? Good, now: [[ELEC| Template:Https://lh4.googleusercontent.com/ pgh0ByMQCI4/TYGlNtt0LII/AAAAAAAAAVA/hOrMSCbmuyc/s800/angry-dude.jpeg]]