update readme for console

This commit is contained in:
Cracker64 2011-03-02 16:00:49 -05:00
parent 9fffbb88da
commit 57d24f3ffa
2 changed files with 40 additions and 41 deletions

View File

@ -2,37 +2,36 @@
the console in this version is a python console and will execute any command you enter.
the api for interacting with the powder toy is contained in the tpt module and is already imported at startup.
currently implemented api functions:
tpt.create(x,y,type) create a particle of type <type> at <x>,<y>
tpt.reset_velocity() resets all velocity
tpt.reset_pressure() resets all pressure
tpt.reset_sparks() resets all sparks
tpt.set_life(type,life) sets the life of all particles with type <type>
to <life>(set <type> to -1 for all)
tpt.set_type(type1,type2) sets the type of all particles with type <type1>
to <type2>(set <type1> to -1 for all)
tpt.set_temp(type,temp) sets the temp of all particles with type <type>
to <temp>(set <type> to -1 for all)
tpt.set_tmp(type,tmp) sets the tmp of all particles with type <type>
to <tmp>(set <type> to -1 for all)
tpt.set_x(type,x) sets the x of all particles with type <type>
to <x>(set <type> to -1 for all)
tpt.set_y(type,y) sets the y of all particles with type <type>
to <y>(set <type> to -1 for all)
tpt.set_vx(type,vx) sets the vx of all particles with type <type>
to <vx>(set <type> to -1 for all)
tpt.set_vy(type,vy) sets the vy of all particles with type <type>
to <vy>(set <type> to -1 for all)
tpt.set_ctype(type,ctype) sets the ctype of all particles with type
<type> to <ctype>(set <type> to -1 for all)
tpt.pause() pause the game(note that closing the console
pauses the game)
tpt.unpause() unpause the game(note that closing the console
pauses the game)
tpt.toggle_pause() toggle pause(note that closing the console
pauses the game)
tpt.close_console() closes the console and pauses the game
tpt.open_console() opens the console
tpt.toggle_console() toggles the console
create(x,y,type) create a particle of type <type> at <x>,<y>
reset_velocity() resets all velocity
reset_pressure() resets all pressure
reset_sparks() resets all sparks
### USING SET COMMANDS ###
the console uses keywords to identify variables of what to set, you can specify x and y coords with x=100 y=100, ect.
i is the particle number
name will change all of name's type to the setto variable. It needs to be a string "dust" ect, "all" for all.
the setto is what the particle(s) will be set to, it is a string for the type/ctype commands, and an int for the rest.
you need to set the to* variable and one location/name/coords for it to work.
set_type(x=,y=,i=,name="",totype="")
set_life()
set_temp()
set_tmp()
set_x()
set_y()
set_vx()
set_vy()
set_ctype()
pause() pause the game(note that closing the console
pauses the game)
unpause() unpause the game(note that closing the console
pauses the game)
toggle_pause() toggle pause(note that closing the console
pauses the game)
close_console() closes the console and pauses the game
open_console() opens the console
toggle_console() toggles the console
NOTE: these functions don't do bounds checking, which means that they CAN AND
WILL CRASH the powder toy. be carefull.
@ -44,4 +43,4 @@ tpt.set_life(32,life) you can do tpt.set_life(element['uran'],life)
### COMPILING ###
before you compile you should have python 2.x installed.
you must run the "getheader.py" script to get the correct linking options, add
these options to the makefile
these options to the makefile

View File

@ -1346,7 +1346,7 @@ emb_set_life(PyObject *self, PyObject *args, PyObject *keywds)
{
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *kwlist[] = {"tolife", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//
@ -1387,7 +1387,7 @@ emb_set_type(PyObject *self, PyObject *args, PyObject *keywds)
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *type = "";
char *kwlist[] = {"totype", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "s|sIII:set_type",kwlist ,&type,&name,&i,&x,&y))
return NULL;
//
@ -1428,7 +1428,7 @@ emb_set_temp(PyObject *self, PyObject *args, PyObject *keywds)
{
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *kwlist[] = {"totemp", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//
@ -1468,7 +1468,7 @@ emb_set_tmp(PyObject *self, PyObject *args, PyObject *keywds)
{
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *kwlist[] = {"totmp", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//
@ -1509,7 +1509,7 @@ emb_set_x(PyObject *self, PyObject *args, PyObject *keywds)
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *type = "";
char *kwlist[] = {"tox", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//
@ -1549,7 +1549,7 @@ emb_set_y(PyObject *self, PyObject *args, PyObject *keywds)
{
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *kwlist[] = {"toy", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//
@ -1590,7 +1590,7 @@ emb_set_ctype(PyObject *self, PyObject *args, PyObject *keywds)
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *type = "";
char *kwlist[] = {"toctype", "toctypeint", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "toctypeint", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "s|IsIII:set_type",kwlist ,&type, &life, &name,&i,&x,&y))
return NULL;
//
@ -1632,7 +1632,7 @@ emb_set_vx(PyObject *self, PyObject *args, PyObject *keywds)
{
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *kwlist[] = {"tovx", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//
@ -1672,7 +1672,7 @@ emb_set_vy(PyObject *self, PyObject *args, PyObject *keywds)
{
int i = -1,life,j,x=-1,y=-1;
char *name = "";
char *kwlist[] = {"tovy", "from", "i", "x", "y", NULL};
char *kwlist[] = {"setto", "from", "i", "x", "y", NULL};
if(!PyArg_ParseTupleAndKeywords(args, keywds, "I|sIII:set_type",kwlist ,&life,&name,&i,&x,&y))
return NULL;
//