From 57d24f3ffafc10bdd2c59b6af44b1782a7cb76d9 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 2 Mar 2011 16:00:49 -0500 Subject: [PATCH] update readme for console --- console_README | 63 +++++++++++++++++++++++++------------------------- src/main.c | 18 +++++++-------- 2 files changed, 40 insertions(+), 41 deletions(-) diff --git a/console_README b/console_README index c989987b1..556f8a4e9 100644 --- a/console_README +++ b/console_README @@ -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 at , - 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 - to (set to -1 for all) - tpt.set_type(type1,type2) sets the type of all particles with type - to (set to -1 for all) - tpt.set_temp(type,temp) sets the temp of all particles with type - to (set to -1 for all) - tpt.set_tmp(type,tmp) sets the tmp of all particles with type - to (set to -1 for all) - tpt.set_x(type,x) sets the x of all particles with type - to (set to -1 for all) - tpt.set_y(type,y) sets the y of all particles with type - to (set to -1 for all) - tpt.set_vx(type,vx) sets the vx of all particles with type - to (set to -1 for all) - tpt.set_vy(type,vy) sets the vy of all particles with type - to (set to -1 for all) - tpt.set_ctype(type,ctype) sets the ctype of all particles with type - to (set 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 at , + 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 \ No newline at end of file +these options to the makefile diff --git a/src/main.c b/src/main.c index 782625561..fccde8e44 100644 --- a/src/main.c +++ b/src/main.c @@ -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; //