(New page: == Quest Expressions == '''Quest expressions start with "="''' Only supported for rewards. example: =2*@par === Operators === ==== functions ==== * @par -> dynamic parameter *...) |
(→Examples) |
||
| (21 intermediate revisions not shown.) | |||
| Line 9: | Line 9: | ||
=2*@par | =2*@par | ||
| - | === | + | === Syntax === |
| - | + | * @par -> dynamic parameter (see annex 1 below) | |
| - | + | ||
| - | * @par -> dynamic parameter | + | |
* ?prop -> property from pcproperties | * ?prop -> property from pcproperties | ||
| - | * | + | * ?entname.prop -> property from some entity pcproperties |
| - | * pctag( | + | * * -> multiply |
| + | * + -> add | ||
| + | * - -> substract | ||
| + | * / -> divide | ||
| + | * % -> modulo | ||
| + | * ~ -> bitnot | ||
| + | * ^ -> bitxor | ||
| + | * == -> equality | ||
| + | * != -> inequality | ||
| + | * <= -> lesser or equal | ||
| + | * >= -> greater or equal | ||
| + | * < -> lesser | ||
| + | * > -> greater | ||
| + | * funcname(par1,par2...) -> run a function | ||
| + | |||
| + | === values === | ||
| + | |||
| + | * false -> boolean false | ||
| + | * true -> boolean true | ||
| + | |||
| + | === functions === | ||
| + | |||
| + | parameters inside [] are optional | ||
| + | |||
| + | * pc([ent],name) | ||
| + | * pctag([ent],name, tag) | ||
* param | * param | ||
| - | * property( | + | * property([pc],propid) |
* id | * id | ||
* parid | * parid | ||
* actid | * actid | ||
* propid | * propid | ||
| - | * rgb | + | * rgb(r,g,b) -> color code |
* abs(number) | * abs(number) | ||
| - | * min(n1,n2) | + | * min(n1,n2) -> min |
| - | * max(n1,n2) | + | * max(n1,n2) -> max |
* config | * config | ||
| - | * mousex() | + | * mousex() -> mousex |
| - | * mousey() | + | * mousey() -> mousey |
* normalize(vector) --> normalized vector | * normalize(vector) --> normalized vector | ||
* bb_mousex | * bb_mousex | ||
| Line 39: | Line 62: | ||
* asin(number) | * asin(number) | ||
* atan(number) | * atan(number) | ||
| - | * sign(number) | + | * sign(number) |
* sqrt(number) | * sqrt(number) | ||
| - | * sqdist | + | * sqdist(vec1,vec2) |
* hasclass | * hasclass | ||
* intpol(a,b,c) | * intpol(a,b,c) | ||
| - | * int | + | * int(something) |
| - | * float | + | * float(something) |
| - | * bool | + | * bool(something) |
* rand(number) | * rand(number) | ||
* bb_testcollide | * bb_testcollide | ||
| Line 52: | Line 75: | ||
* entname() -> entity name | * entname() -> entity name | ||
* ent() -> entity, ent(entityname) -> entity | * ent() -> entity, ent(entityname) -> entity | ||
| - | * inventory_get | ||
| - | * inventory_count | ||
| - | * inventory_in | ||
| - | * inventory_find | ||
| - | * inventory_inname | ||
| - | * inventory_findname | ||
* sound | * sound | ||
* sound_paused | * sound_paused | ||
| Line 63: | Line 80: | ||
* strsub | * strsub | ||
* stridx | * stridx | ||
| - | * scr_width | + | * scr_width() |
| - | * scr_height | + | * scr_height() |
| - | * testvar | + | * testvar(name) -> test existance |
| - | * chdirauto | + | * chdirauto(dir,file) -> change to dir if file is present |
* readfile | * readfile | ||
* writefile | * writefile | ||
| - | * getyrot(dx,dy) | + | * getyrot(dx,dy) -> angle |
| - | * vecx(vec) | + | * vecx(vec) -> vec.x |
| - | * vecy(vec) | + | * vecy(vec) -> vec.y |
| - | * vecz(vec) | + | * vecz(vec) -> vec.z |
| - | * colred(col) | + | * colred(col) -> col.red |
| - | * colgreen(col) | + | * colgreen(col) -> col.red |
| - | * colblue(col) | + | * colblue(col) -> col.red |
| - | * getmsg(msg) | + | * getmsg(msg) -> translated message |
* key_node(sector,node,key,[value]) | * key_node(sector,node,key,[value]) | ||
* key_meshobj(meshobj,key,[value]) | * key_meshobj(meshobj,key,[value]) | ||
| Line 85: | Line 102: | ||
* key_light(light,key,[value]) | * key_light(light,key,[value]) | ||
| + | === Examples === | ||
| + | |||
| + | * =if(mousex()<10,'left','right') <- returns left or right according to mousex position | ||
| + | * =if(property(pc(tools.config.json),propid(index))==0,10,-1) <- returns 10 o -1 according to index property. | ||
| + | * =property(pc(pc2d.billboard),propid(text)) <- returns the value of the "text" property from the "pc2d.billboard" pc in current entity. | ||
| + | * =enemy+?i -> returns something like enemy13 (if i pcproperty was 13 at the moment) | ||
| + | * =[1,2,3] -> returns a vector3 with contents x=1 y=2 z=3 | ||
| + | |||
| + | == Annex 1: Dynamic parameters == | ||
| + | |||
| + | If you use @par (instead | ||
| + | of the already existing $par notation) you can get dynamic | ||
| + | parameters from triggers. As opposed to static ($par) parameters | ||
| + | these parameters can change every time the reward is fired. | ||
| + | Currently there are the following limitations: | ||
| + | |||
| + | * @par notation does not work in triggers (that will stay). | ||
| + | * @par notation does not work in sequences. | ||
| + | |||
| + | === Dynamic parameters each trigger sends === | ||
| + | |||
| + | * message --> forwards all message parameters | ||
| + | * inventory --> @child (name of added or removed entity) | ||
| + | * meshsel --> @entity (name of the selected entity) | ||
| + | * trigger --> @entity (name of the entity triggering) | ||
| + | |||
| + | |||
| + | == Annex 2: Escape characters == | ||
| + | |||
| + | * some characters need to be escaped when they live in xml attributes: | ||
| + | * < : "&#60;" | ||
| + | * & : "&#38;" | ||
| + | |||
| + | example: 1<2 becomes 1&#60;2 | ||
| + | |||
| + | == Annex 3: unusable functions == | ||
| + | |||
| + | functions which aren't useful due to some missing features from blxml | ||
| + | |||
| + | * inventory_get | ||
| + | * inventory_count | ||
| + | * inventory_in | ||
| + | * inventory_find | ||
| + | * inventory_inname | ||
| + | * inventory_findname | ||
| + | * actionname{par1=XXX,par2=XXX,par3=XXX...} | ||
| - | == | + | == Annex 4: undocumented tokens == |
| + | '''not sure what these are for... do not read (only here for internal documentation purpose''' | ||
| - | * property | + | * property |
| - | * action | + | * action |
* bb_movelayer | * bb_movelayer | ||
* bb_move | * bb_move | ||
| Line 148: | Line 212: | ||
* showmouse | * showmouse | ||
* navigationinfo | * navigationinfo | ||
| - | |||
| - | |||
| - | === Examples === | ||
| - | |||
| - | * =if(mousex()<10,'left','right') | ||
| - | |||
| - | |||
| - | == Annex 1: Dynamic parameters == | ||
| - | |||
| - | If you use @par (instead | ||
| - | of the already existing $par notation) you can get dynamic | ||
| - | parameters from triggers. As opposed to static ($par) parameters | ||
| - | these parameters can change every time the reward is fired. | ||
| - | Currently there are the following limitations: | ||
| - | |||
| - | * @par notation does not work in triggers (that will stay). | ||
| - | * @par notation does not work in sequences. | ||
| - | * Only the message trigger can currently send out such parameters. | ||
| - | |||
| - | == Annex1: Trigger dynamic parameters == | ||
| - | |||
| - | * inventory --> child (name of added or removed entity) | ||
| - | * meshsel --> entity (name of the selected entity) | ||
| - | * trigger --> entity (name of the entity triggering) | ||
Current revision
Contents |
Quest Expressions
Quest expressions start with "="
Only supported for rewards.
example:
=2*@par
Syntax
* @par -> dynamic parameter (see annex 1 below) * ?prop -> property from pcproperties * ?entname.prop -> property from some entity pcproperties * * -> multiply * + -> add * - -> substract * / -> divide * % -> modulo * ~ -> bitnot * ^ -> bitxor * == -> equality * != -> inequality * <= -> lesser or equal * >= -> greater or equal * < -> lesser * > -> greater * funcname(par1,par2...) -> run a function
values
* false -> boolean false * true -> boolean true
functions
parameters inside [] are optional
* pc([ent],name) * pctag([ent],name, tag) * param * property([pc],propid) * id * parid * actid * propid * rgb(r,g,b) -> color code * abs(number) * min(n1,n2) -> min * max(n1,n2) -> max * config * mousex() -> mousex * mousey() -> mousey * normalize(vector) --> normalized vector * bb_mousex * bb_mousey * cos(number) -> cos * sin(number) * tan(number) * acos(number) * asin(number) * atan(number) * sign(number) * sqrt(number) * sqdist(vec1,vec2) * hasclass * intpol(a,b,c) * int(something) * float(something) * bool(something) * rand(number) * bb_testcollide * if(expr, trueexpr, falseexpr) * entname() -> entity name * ent() -> entity, ent(entityname) -> entity * sound * sound_paused * strlen * strsub * stridx * scr_width() * scr_height() * testvar(name) -> test existance * chdirauto(dir,file) -> change to dir if file is present * readfile * writefile * getyrot(dx,dy) -> angle * vecx(vec) -> vec.x * vecy(vec) -> vec.y * vecz(vec) -> vec.z * colred(col) -> col.red * colgreen(col) -> col.red * colblue(col) -> col.red * getmsg(msg) -> translated message * key_node(sector,node,key,[value]) * key_meshobj(meshobj,key,[value]) * key_sector(sector,key,[value]) * key_meshfact(meshfact,key,[value]) * key_texture(texture,key,[value]) * key_material(material,key,[value]) * key_light(light,key,[value])
Examples
* =if(mousex()<10,'left','right') <- returns left or right according to mousex position * =if(property(pc(tools.config.json),propid(index))==0,10,-1) <- returns 10 o -1 according to index property. * =property(pc(pc2d.billboard),propid(text)) <- returns the value of the "text" property from the "pc2d.billboard" pc in current entity. * =enemy+?i -> returns something like enemy13 (if i pcproperty was 13 at the moment) * =[1,2,3] -> returns a vector3 with contents x=1 y=2 z=3
Annex 1: Dynamic parameters
If you use @par (instead of the already existing $par notation) you can get dynamic parameters from triggers. As opposed to static ($par) parameters these parameters can change every time the reward is fired. Currently there are the following limitations:
* @par notation does not work in triggers (that will stay). * @par notation does not work in sequences.
Dynamic parameters each trigger sends
* message --> forwards all message parameters * inventory --> @child (name of added or removed entity) * meshsel --> @entity (name of the selected entity) * trigger --> @entity (name of the entity triggering)
Annex 2: Escape characters
* some characters need to be escaped when they live in xml attributes: * < : "<" * & : "&"
example: 1<2 becomes 1<2
Annex 3: unusable functions
functions which aren't useful due to some missing features from blxml
* inventory_get
* inventory_count
* inventory_in
* inventory_find
* inventory_inname
* inventory_findname
* actionname{par1=XXX,par2=XXX,par3=XXX...}
Annex 4: undocumented tokens
not sure what these are for... do not read (only here for internal documentation purpose
* property * action * bb_movelayer * bb_move * bb_tofront * bb_toback * bb_up * bb_down * par * var * lvar * expr * while * if * for * print * call * case * mount * hitbeam * inherit * destroyentity * createentity * createpropclass * destroypropclass * default * inventory * inventory_add * inventory_rem * chdir * sound * sound_stop * sound_pause * sound_unpause * sound_restart * sound_volume * sound_speed * config_add * config_rem * config_set * config_save * class_add * class_rem * super * switch * strsplit * return * reporterror * variables * traceon * traceoff * callstack * selectentity * stop * randomize * quit * hidemouse * showmouse * navigationinfo
