Difference between revisions of "Using The Console/zh"
TOC_Official (talk | contribs) (Add Chinese version (Unfinish)) |
(No difference)
|
Revision as of 03:59, 13 August 2019
物理沙盘目前使用Lua控制台,相比于旧版控制台包含更多功能。如果只进行一些简单操作,控制台提供了一些简短的命令供玩家使用。
Contents
使用控制台
49.1版后控制台命令需要"!"前缀,同时也支持Lua Scripts
控制台实质上是物理沙盘中的一个窗口,允许你键入游戏中的命令。因为控制台命令与代码相近,你可以使用命令来实现一些单靠点击无法完成的操作。
开启控制台只需要单击~(在某些键盘上可能是`或 ¬ 或 ^/°,通常在Esc键下方)键,开启控制台后游戏会立刻暂停,显示一个带有输入框的窗口。
相比于其他控制台,物理沙盘中的控制台非常直观且容易上手,在开始之前只需要熟悉单词的使用顺序即可。 大家最常用的命令可能为Set命令,它的语法为:
!set [想要设置的元素的变量或属性] [被施加改变元素的索引] [改变后的值]
如果想要将第二十五个粒子变为金属,应键入:
!set type 25 metl
使用关键字"All"或元素名来替代上例的数字更加常用,例如:
!set type all metl
这个命令会将所有粒子变为金属。
!set type metl watr
这个命令会将所有粒子变为水。
!set type metl none
而这个命令会移除存档中所有的金属。
Would remove all metal particles from the save.
关键字"type"也是可以更换的,下面是所有可以替换的关键字:
The word "Type" is also interchangeable. The following keywords can be used as well:
- Type: 粒子的ID。使用这个属性来改变元素本身。
- Temp: 粒子的温度。使用这个属性可以一次性改变存档中所有粒子的温度。(注意: 温度为开氏温度,比游戏中的摄氏温度高273.15)
- Ctype: 粒子的临时状态。这个属性有许多用途,例如LAVA在凝固后可以变为NEUT(使用命令!set ctype lava neut ,再冷却lava),也可以作为CLNE等复制元素所复制对象的ID。
- Life: 粒子的寿命。这个属性有很多用途,例如电火花的延时和火焰的颜色。
- X, Y, VX, VY: 粒子的X, Y坐标和X, Y轴的速度。
- Tmp: 该属性有许多用途,例如石英的颜色。
- Tmp2: 第二个Tmp, 用途很少。
- Pavg[0], Pavg[1], flag: 几乎没有实际用途。
!Quit命令非常直观,用于直接关闭游戏。
!Quit
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.
The !delete/!kill commands are also similar, they delete a particle at a point:
!delete 200,100
This deletes the particle you just created.
The !load command loads a specific save number. This loads save number 500000:
!load 500000
The !bubble command creates a bubble of soap at a specific point. It is hard to create them without this.
!bubble 100,100
The !reset command can do a lot of things. !reset velocity sets the velocity of all particles to 0. !reset pressure resets the pressure map, like pressing the = key. !reset sparks gets rid of all sparks on the screen and sets their type to their ctype. !reset temp sets all particles back to their default temperature they have when you draw them.
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.
Some other commands:
!reset
The if command can only be used in scripts. It checks if a particle at index i is the type j
!if type 1,dmnd
This would check if parts[1].type is diamond and return 1 if true, 0 if not.
Running scripts
You can run console commands stored in a file by creating a text document and writing a script.
When you have done that, open the console in the Powder Toy and type in
'dofile("your filename here")'. It might say scripts are not enabled.
The script will be done once, and you can use any normal commands, if, else, endif, and end. Running scripts with Lua gives you a lot more options for what to do, and lets you run it every frame.
Hints and tips on using tmp, life, tmp2, and ctype
ctype
- 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 used to be caused by sparking QRTZ manually.
- WWLD: The different types of WWLD(Electron head, tail, wire) are distinguished by it's ctype. Try experimenting with ctypes DUST, WATR and none.
- Life: ctype changes the type of life it is.
- Using ctype, you can make molten ice and molten diamond with this code: for molten ice, put ice then type " !set ctype ice lava " then type " !set temp ice 500 " and the ice in the world will become molten ice. Molten diamond occurs when you place lava then
use " !set ctype lava dmnd ". This goes along with the above mentioned state changes.
tmp
Tmp is a value used for various element properties. Only a few elements use it. NOTE: this is NOT temperature (which is called 'temp'). Tmp can also change the channels of WIFI (but the "temp" or temperature value control the tmp value and it has no sense to change the tmp from the console).
- PIPE: the type of the element currently contained in the pipe. Use '!set tmp pipe 0' to remove all particles from all pipes.
- CRAY: the length of the beam. Use !set tmp cray 0 to set it to default.
- DRAY: how many particles to copy (default is 0, or until blank space). Use !set tmp dray 0 to set it to default.
- FILT: tmp changes the operator on FILT:
0: "set" mode (default): FILT's spectrum is copied into PHOT particles that pass through it
1: "and" mode: A bitwise and is performed on PHOT's and FILT's spectrums and the result is stored in the PHOT particle, any wavelengths not present in FILT will be removed from PHOT.
2: "or" mode: Performs a bitwise or: all wavelengths present in FILT are "enabled" in PHOT, if not already.
3: "sub" mode: Performs a bitwise and-not: all wavelengths present in FILT are subtracted from PHOT.
4: "red shift" mode: The wavelengths of a photon are red-shifted. The distance of the shift is calculated from the temperature in a way similar to its non-ctype mode of operation. Tmp value is ignored.
5: "blue shift" mode: Like "red shift", but the shifting direction is opposite, wavelengths are moved towards the blue end.
6: "nop" mode: No spectrum changes are performed. Useful if you want to cross beams of PHOT and ARAY without mangling the spectrum.
7: "xor" mode: Performs a bitwise xor: all wavelengths present in FILT are "flipped" in PHOT's spectrum, that is, if some color was on, it turns off, and vice versa.
8: "not" mode: Performs a bitwise not: all wavelengths of PHOT are flipped. Note that FILT's spectrum is ignored.
9: "QRTZ scattering" mode: Randomizes photons' velocity and randomly changes their color, just like QRTZ.
Changing the tmp value of SING can allow the manual change of the amount of matter it has consumed, useful for making bombs.
Anything else is the same as nop mode, but it is recommended to use 6 for nop in case new modes are added. Use !set tmp filt <operator number>.
life
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. It is possible to 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.
- Another closely studied use of the life variable is what it does to ACID. Acid is corosive. 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.
- 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. 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.
- Coal uses life to slowly burn. It starts with a life of 110. Contact with fire decreases life, and when life reaches 0, it is replaced with a particle of fire,
tmp2
tmp2 is similar to tmp, except it is less used due to it being a secondary property.
E.G:
- QRTZ/PQRT: tmp2 changes the colour of them. Use !set tmp2 qrtz <number between 0 and 10>
- VIRS/VIRG/VRSS: Used to set the element being infected. Use !set tmp2 virs <element id or name>
- CRAY: Used for types of life.
- DRAY: Used for spacing between original and duplicate. Use !set tmp2 dray <spacing>
- PIPE/STOR: Used for types of life (but not possible to do normally)
Complex Console Commands
There are many console commands that can be used to manipulate things such as gravity for elements. Here are some examples. tpt.el.metl.gravity=5 changes all METL particles in the save to have a gravity of five and therefore travel downward. tpt.el.gas.diffusion=10 changes the diffusion (or how far the particles spread apart) to a higher level. These are just a few examples of the hundreds of the complex commands unknown to many TPT users.
https://www.boxmein.net/tpt/tptelements/reference/lua-reference.html#tree
Video Tutorial
Click on the following link to check out the video tutorial: http://youtu.be/mhlk98L5_0s