PROJECT: Contributions of var & command descriptions

PROJECT: Contributions of var & command descriptions

Postby arand » 08 Sep 2012, 17:04

Hi,
We're currently working on integrating descriptions for vars and commands into both the on-screen help in RE:
Image
And into these wiki pages:

Since it's a major task, I thought it would be great if the wider community could also submit suggestions for descriptions :)

To submit descriptions via the forums
  • Check here and the wiki that you are not adding a duplicate
  • Please follow the format, again see the wiki and the example reply below
  • Please use a good clarification for parameters (e.g. <clientnum>) where appropriate
    • Please use <value> as a generic description otherwise

Submit your descriptions in a reply to this thread looking something like this:

Hello, here is a variable (and an alias) which I use all the time which does not yet have a description! :D

{l Code}: {l Select All Code}
setdesc "firstpersonfov" "determines the size of the field of view in first person mode" "<angle>"
setdesc "fov" "determines the size of the field of view in first or third person mode, depending on the current camera mode" "<angle>"



If you are a wiki editor you may also submit descriptions directly on the wiki.

I will be adding your descriptions continuously to Red Eclipse SVN :heart:
Last edited by arand on 22 Sep 2012, 05:23, edited 1 time in total.
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Request: Contributions of var & command descriptions

Postby arand » 20 Sep 2012, 20:27

EDIT: Scratch that, reverted to " " again (allowing for inline newlines)
Updated with new syntax: use [ ] to enclose description instead of " "
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Request: Contributions of var & command descriptions

Postby ZeroKnight » 06 Oct 2012, 09:42

{l Code}: {l Select All Code}
setdesc "setpersist" "sets an alias as persistant, ie. it will be added to config.cfg; 0/false/off, 1/true/on" "<alias> <bool>"
setdesc "local" "declares a set of aliases as local to the alias (^"function^") it was declared in" ""
setdesc "newgui" "creates a new menu. ^"<name>^" refers to the menu's variable name; ^"<content>^" refers to the actual content of the gui itself.^n^"[<initscript>]^" is optional, and is run before the menu is created, and is used with ^"if (= $guipasses 0)^" to initialize variables for the menu" "<name> <contents> [<initscript>]"
setdesc "guitext" "creates a text element. ^"<text>^" can be a raw string or a variable.^n^"[<icon>]^" is the path to an image; Ex: ^"textures/bomb^"^n^"[<colour>]^" is a hexadecimal colour code; Ex: 0xFF0000" "<text> [<icon>] [<colour>]"
setdesc "guistrut" "adds spacing to a menu. if ^"[<bool>]^" is 1, it wraps the guistrut in a guilist (adds spacing in the alternate direction).^n^"guistrut 5 1^" is the same as ^"guilist [ guistrut 5 ]^" "<amount> [<bool>]"
setdesc "guilist" "adds ^"<content>^" to a list" "<content>"
setdesc "guispring" "adds weight to a menu for pushing elements more/less to one side^nEx: guistrut 45 1; guilist [ guispring 1; guitext ^"centered^"; guispring 1 ]" "<value>"
setdesc "guibutton" "creates a button. ^"<name>^" refers to the button's variable name; ^"<action>^" defines what the button does.^n^"[<alt-act>]^" defines what the button does when right-clicked^n^"[<icon>]^" is the path to an image; Ex: ^"textures/bomb^"^n^"[<colour>]^" is a hexadecimal colour code; Ex: 0xFF0000" "<name> <action> [<alt-act>] [<icon>] [<colour>]"
setdesc "guicheckbox" "creates a checkbox. ^"<name>^" refers to the name of the item; ^"<var>^" refers to the alias/var that the checkbox controls.^n^"[<on>]^" is the value given to ^"<var>^" when the checkbox is on, and vice-versa for ^"[<off>]^". if these are not specified, then boolean is assumed^n^"[<onchange>]^" is the action taken whenever the checkbox is toggled^n^"[<colour>]^" is a hexadecimal colour code; Ex: 0xFF0000" "<name> <var> [<on>] [<off>] [<onchange>] [<colour>]"
setdesc "guibackground" "creates a colored background. ^"<colour>^" is in hexadecimal; Ex: 0xFF0000^n^"[<levels>]^" specifies how many guilist levels to go back" "<colour> [<levels>]"
setdesc "guifield" "creates a text field. ^"<var>^" refers to the alias/var the guifield controls^n^"<maxlength>^" defines the max # of characters/length of the field; negative values allow the field to expand downward as needed^n^"[<onchange>]^" is the action taken when the guifield value changes^n^"[<colour>]^" is a hexadecimal colour code; Ex: 0xFF0000" "<var> <maxlength> [<onchange>] [<colour>]"
setdesc "guikeyfield" "creates a key field (each key being a separate element). ^"<var>^" refers to the alias/var the guikeyfield controls^n^"<maxlength>^" defines the max # of characters/length of the field; negative values allow the field to expand downward as needed^n^"[<onchangge>]^" is the action taken when the guikeyfield value changes^n^"[<colour>]^" is a hexadecimal colour code; Ex: 0xFF0000" "<var> <maxlength> [<onchange>] [<colour>]"
setdesc "guifont" "sets the text font to be used in the block. see data/fonts for options" "<font> <block>"
setdesc "guiheader" "sets the header title of the menu" "<value>"
setdesc "guiimage" "creates an image. ^"<path>^" is the path to an image; Ex: ^"textures/bomb^"^n^"[<action>]^" defines what clicking the image does^n^"[<scale>]^" defines the scale of the image^n^"[<overlaid>]^" whether or not the image is overlaid with guioverlaytex (boolean)^n^"[<alt-path>]^" alternate image to use if ^"<path>^" cannot be loaded^n^"[<alt-act>]^" defies what the image does when right clicked" "<path> [<action>] [<scale>] [<overlaid>] [<alt-path>] [<alt-act>]"
setdesc "guiradio" "creates a radio button. ^"<name>^" refers to the name of the item; ^"<var>^" refers to the alias/var that the checkbox controls.^n^"<value>^" is the value given to ^"<var>^" when selected^n^"[<onchange>]^" is the action taken whenever the checkbox is toggled^n^"[<colour>]^" is a hexadecimal colour code; Ex: 0xFF0000" "<name> <var> <value> [<onchange>] [<colour>]"
setdesc "guitab" "creates a new tab for the menu" "<name>"
setdesc "guititle" "adds a title to a menu" "<value>"


That's all of the common GUI commands. I'll add the more obscure/complex ones at a later time. There's also setpersist and local :)
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Request: Contributions of var & command descriptions

Postby arand » 06 Oct 2012, 12:40

ZeroKnight {l Wrote}:(...)
That's all of the common GUI commands. I'll add the more obscure/complex ones at a later time. There's also setpersist and local :)


Added to SVN, thanks!
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Request: Contributions of var & command descriptions

Postby ZeroKnight » 15 Oct 2012, 09:07

Suggesting an ammendment to "allowmaps":
{l Code}: {l Select All Code}
setdesc "allowmaps" "allowed maps; maps that can be chosen without elevated privs" "<list>"

Added: "maps that can be chosen without elevated privs"
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Request: Contributions of var & command descriptions

Postby ZeroKnight » 20 Oct 2012, 02:19

{l Code}: {l Select All Code}
setdesc "inputcommand" "prepares input to the command line; ^"<init>^" is a string to input in the command line.^n^"[<action>]^" specifies a command to execute after inputcommand^n^"[<icon>]^" determines the icon to use next to the input; Ex: ^"textures/bomb^"^n^"[<colour>]^" determines the color of [<icon>]^n^"[<flags>]^" are the command flags to pass; ^"c^" = CF_COMPLETE, ^"x^" = CF_EXECUTE, ^"s^" = CF_COMPLTE|CF_EXECUTE (default)" "<init> [<action>] [<icon>] [<colour>] [<flags>]"


inputcommand
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Request: Contributions of var & command descriptions

Postby srbs » 21 Oct 2012, 09:08

Here are looping & list related commands.

{l Code}: {l Select All Code}
setdesc "loop" "Executes <body> with <var> incremented from 0 to <count>-1.^nEx. loop i 10 [ echo $i ]" "<var> <count> <body>"
setdesc "loopconcat" "Returns a string with the result of the <body> concat-ed with <var> incremented from 0 to <count>-1.^nEx. loopconcat i 10 [ result $i ]" "<var> <count> <body>"
setdesc "loopconcatword" "Returns a string with the result of the <body> concatword-ed with <var> incremented from 0 to <count>-1.^nEx. loopconcatword i 10 [ result $i ]" "<var> <count> <body>"
setdesc "loopfiles" "Executes <body> with <var> set to each file in <directory> with the given <extension> (^"^" for extension is all files).^nEx. loopfiles f data cfg [ echo $f ]" "<var> <directory> <extension> <body>"
setdesc "looplist" "Executes <body> with <var> set to each item in <list>.^nEx. looplist i ^"this is a list^" [ echo $i ]" "<var> <list> <body>"
setdesc "loopwhile" "Executes <body> with <var> incremented from 0 to <count>-1 while <condition> is true.^nEx. loopwhile i 10 [ < $i 5 ] [ echo $i ]" "<var> <count> <condition> <body>"
setdesc "while" "Execute <body> while <cond> is true.^n Ex. i = 0; while [ < $i 10 ] [ echo $i; i = (+ $i 1) ]" "<cond> <body>"


{l Code}: {l Select All Code}
setdesc "indexof" "Returns the index in <list> of <data>.^nEx. indexof ^"this is a list^" list" "<list> <data>"
setdesc "listdel" "Returns the <list1> with all occurrences of each element in <list2> removed.^nlistdel is equivalent to set difference.^nEx. listdel ^"this list has duplicates this duplicates^" duplicates has" "<list1> <list2>"
setdesc "listfind" "Returns the index in <list> where the <body> returns true.^nSimilar to looplist.^nEx. listfind i ^"this is a list^" [ result (>= (strstr $i l) 0) ]" "<var> <list> <body>"
setdesc "listlen" "Returns the length of the <list>.^nEx. listlen ^"this is a list^"" "<list>"
setdesc "listsplice" "Returns a list where the elements between the <start> index and the end or for <count> elements is replaced with <value>.^nEx. listsplice ^"1 2 3 4 5 6^" insert 2 3" "<list> <value> <start> <count>"
setdesc "prettylist" "Returns a recombined <list> with ', ' placed between each list and the <conjunctor> placed between the last two elements (including the ,).^nEx. prettylist ^"1 2 3 4^" and" "<list> <conjunctor>"
setdesc "shrinklist" "Returns a list of all element that exists in both <list1> and <list2>. If there are no results and <failover> is 1 or 2, the list that failover points to is returned.^nWithout <failover>, shrinklist is equivalent to set symmetric difference.^nEx. sublist ^"this is a list^" 1 2" "<list1> <list2> [<failover>]"
setdesc "sublist" "Returns a sublist of <list> starting at <start> and ending at the end or for <count> elements.^nEx. sublist ^"this is a list^" 1 2" "<list> <start> [<count>]"
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby arand » 21 Oct 2012, 10:57

srbs {l Wrote}:Here are looping & list related commands.

Tweaked and added, thanks! :)
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Request: Contributions of var & command descriptions

Postby srbs » 21 Oct 2012, 19:09

arand {l Wrote}:Tweaked and added, thanks! :)

Good, because my explanations really aren't that great.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby srbs » 21 Oct 2012, 20:27

Here are bit-wise, logical operations, comparisons, and basic math operations.
I don't really like some of the explanations, but I don't know how to make them better.
I didn't add any examples because these should be self explanatory. If some should be added, let me know & I'll add them.

{l Code}: {l Select All Code}
setdesc "&"    "returns the bit-wise AND of <int1> and <int2>." "<int1> <int2>"
setdesc "&~"   "returns the bit-wise NOT of the bit-wise AND of <int1> and <int2>." "<int1> <int2>"
setdesc "<<"   "returns <int1> left shifted <int2> times." "<int1> <int2>"
setdesc ">>"   "returns <int1> right shifted <int2> times." "<int1> <int2>"
setdesc "^"    "returns the bit-wise XOR of <int1> and <int2>." "<int1> <int2>"
setdesc "^~"   "returns the bit-wise NOT of the bit-wise XOR of <int1> and <int2>." "<int1> <int2>"
setdesc "|"    "returns the bit-wise OR of <int1> and <int2>." "<int1> <int2>"
setdesc "|~"   "returns the bit-wise NOT of the bit-wise OR of <int1> and <int2>." "<int1> <int2>"
setdesc "~"    "returns the bit-wise NOT of <int>." "<int>"


{l Code}: {l Select All Code}
setdesc "!"    "returns the logical not of <condition>." "<condition>"
setdesc "&&"   "returns the logical and of all given conditions." "<condition>*"
setdesc "?"    "returns <true_body> when <condition> is true, otherwise <false_body>." "<condition> <true_body> <false_body>"
setdesc "||"   "returns the logical or of all given conditions." "<condition>*"


{l Code}: {l Select All Code}
setdesc "!="   "returns true when <int1> is not equal to <int2>." "<int1> <int2>"
setdesc "!=f"  "returns true when <float1> is not equal to <float2>." "<float1> <float2>"
setdesc "!=s"  "returns true when <string1> is not equal to <string2> on the ascii table." "<string1> <string2>"
setdesc "<="   "returns true when <int1> is less than or equal to <int2>." "<int1> <int2>"
setdesc "<=f"  "returns true when <float1> is less than or equal to <float2>." "<float1> <float2>"
setdesc "<=s"  "returns true when <string1> is less than or equal to <string2> on the ascii table." "<string1> <string2>"
setdesc "<"    "returns true when <int1> is less than <int2>." "<int1> <int2>"
setdesc "<f"   "returns true when <float1> is less than <float2>." "<float1> <float2>"
setdesc "<s"   "returns true when <string1> is less than <string2> on the ascii table." "<string1> <string2>"
setdesc "="    "returns true when <int1> is equal to <int2>." "<int1> <int2>"
setdesc "=f"   "returns true when <float1> is equal to <float2>." "<float1> <float2>"
setdesc "=s"   "returns true when <string1> is equal to <string2> on the ascii table." "<string1> <string2>"
setdesc ">="   "returns true when <int1> is greater than or equal to <int2>." "<int1> <int2>"
setdesc ">=f"  "returns true when <float1> is greater than or equal to <float2>." "<float1> <float2>"
setdesc ">=s"  "returns true when <string1> is greater than or equal to <string2> on the ascii table." "<string1> <string2>"
setdesc ">"    "returns true when <int1> is greater than <int2>." "<int1> <int2>"
setdesc ">f"   "returns true when <float1> is greater than <float2>." "<float1> <float2>"
setdesc ">s"   "returns true when <string1> is greater than <string2> on the ascii table." "<string1> <string2>"


{l Code}: {l Select All Code}
setdesc "*"    "returns all arguments multiplied together as integers." "<int>*"
setdesc "*f"   "returns all arguments multiplied together as floats." "<float>*"
setdesc "+"    "returns all arguments added together as integers." "<int>*"
setdesc "+f"   "returns all arguments added together as floats." "<float>*"
setdesc "-"    "returns all other arguments subtracted from the first argument as integers." "<int>*"
setdesc "-f"   "returns all other arguments subtracted from the first argument as floats." "<float>*"
setdesc "div"  "returns all other arguments divided from the first argument as integers." "<int>*"
setdesc "divf" "returns all other arguments divided from the first argument as floats." "<float>*"
setdesc "mod"  "returns the modulus of <int1> and <int2>, or the remainder when <int1>/<int2>." "<int1> <int2>"
setdesc "modf" "returns the modulus of <float1> and <float2>, or the remainder when <float1>/<float2>." "<float1> <float2>"


Edit: capitalized bit-wise operators
Last edited by srbs on 21 Oct 2012, 22:31, edited 1 time in total.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby sireus » 21 Oct 2012, 21:49

Capitalizing the logical and bit-wise functions might make it more readable. E.g "returns the bit-wise AND of <int1> and <int2>.", to make clear the "and" is not a normal "and" as a part of the text. Does that make sense?
sireus
 
Posts: 109
Joined: 24 May 2011, 20:10

Re: Request: Contributions of var & command descriptions

Postby srbs » 21 Oct 2012, 22:31

sireus {l Wrote}:Capitalizing the logical and bit-wise functions might make it more readable. E.g "returns the bit-wise AND of <int1> and <int2>.", to make clear the "and" is not a normal "and" as a part of the text. Does that make sense?

Makes perfect sense and has been changed.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby srbs » 22 Oct 2012, 08:56

Here are the string commands.

{l Code}: {l Select All Code}
setdesc "strcasecmp"  "returns true when <string1> is equal to <string2> ignoring case.^nexample: strcasecmp str StR" "<string1> <string2>"
setdesc "strcmp"      "returns true when <string1> is equal to <string2>, equivalent to =s.^nexample: strcmp str str" "<string1> <string2>"
setdesc "strlen"      "returns the length of <string>.^nexample: strlen four" "<string>"
setdesc "strncasecmp" "returns true when the first <count> characters of <string1> and <string2> are equal ignoring case.^nexample: strncasecmp str StRiNg 3" "<string1> <string2> <count>"
setdesc "strncmp"     "returns true when the first <count> characters of <string1> and <string2> are equal.^nexample: strncmp str string 3" "<string1> <string2> <count>"
setdesc "strreplace"  "returns <string> with all occurrences of <search> replaced with <replace>.^nexample: strreplace ^"misspelled sring^" sring string" "<string> <search> <replace>"
setdesc "strstr"      "returns the index of <search> in <string>.^nexample: strstr ^"long string^" str" "<string> <search>"
setdesc "substr"      "returns a substring of <string> starting at <start> and continuing to the end or for <count> characters.^nexample: substr string 2 3" "<string> <start> [<count>]"


@arand
Don't forget to add to the wiki page.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby arand » 22 Oct 2012, 10:57

srbs {l Wrote}:Here are bit-wise, logical operations, comparisons, and basic math operations.
I don't really like some of the explanations, but I don't know how to make them better.
I didn't add any examples because these should be self explanatory. If some should be added, let me know & I'll add them.

(...)

Edit: capitalized bit-wise operators


Added with some tweaks, thanks!
Yeah, I don't know of any really good examples either...

srbs {l Wrote}:Here are the string commands.

(...)

@arand
Don't forget to add to the wiki page.


Added, tweaked, and regenerated onto the wiki pages.
(Some currently breaks wiki syntax, will be fixed shortly)

The problem with these descriptions is that the only show up in the online help when they are written at the beginning of the command input. So if you are currently at
{l Code}: {l Select All Code}
/echo (prettyli
then still only the description for "echo" will be shown... (EDIT: reported https://sourceforge.net/apps/trac/redeclipse/ticket/253 for that)
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Request: Contributions of var & command descriptions

Postby srbs » 23 Oct 2012, 04:54

Here are most of the core/basic commands.

{l Code}: {l Select All Code}
setdesc "concat" "returns all <value>s concatenated with a space between each argument.^nexample: concat hello (getname)" "<value...>"
setdesc "concatword" "returns all <value>s concatenated without a space between each argument.^nexample: concatword squished string" "<value...>"
setdesc "clearsleep" "removes all pending sleeps. If <clearworlds> is set, it will only clear sleeps generated in a maps' cfg file.^nexample: clearsleep" "[<clearworlds>]"
setdesc "do" "executes <body>.^nexample: do [ echo hi ]" "<body>"
setdesc "format" "returns a formatted string with all %1 - %9 replaced with the respective <value> argument, %% inserts a % sign.^nexample: format ^"Hello, %1, welcome to Red Eclipse v. %2^" (getname) $version" "<format_string> <value>*"
setdesc "if" "execute <true_body> when <condition> is true, otherwise executes <false_body>.^nexample: if (< $var 5) [ echo less than 5 ] [ echo greater than 5 ]" "<condition> <true_body> <false_body>"
setdesc "push" "pushes <value> into <var>'s stack and executes <body> then pops <value> off of <var> so that <var> is untouched after execution of <body>.^nexample: var = 5; push var 10 [ echo $var ]; echo $var" "<var> <value> <body>"
setdesc "result" "sets the return value for the currently executing code to <value>. Note that this does not stop the code execution like return would.^nexample: result 1" "<value>"
setdesc "rnd" "returns a random number between 0 or <min> and <max>.^nexample: rnd 50 25" "<max> [<min>]"
setdesc "sleep" "executes <body> after waiting <milliseconds>.^nexample: sleep 2000 [ echo waited 2 seconds ]" "<milliseconds> <body>"
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby srbs » 23 Oct 2012, 05:09

arand {l Wrote}:
srbs {l Wrote}:Here are bit-wise, logical operations, comparisons, and basic math operations.
I don't really like some of the explanations, but I don't know how to make them better.
I didn't add any examples because these should be self explanatory. If some should be added, let me know & I'll add them.

(...)

Edit: capitalized bit-wise operators


Added with some tweaks, thanks!



I'll be tackling case/cond next, and I noticed you are using <value...> for variable arguments. (my latest installment does also to ease your tweaking)
This won't work very well with case/cond since they have variable arguments in pairs. case's nargs ICOMMAND definition is "ite2V" which is crappily explained at the top of http://pastebin.com/UA5LY6dY under V.
To maybe help understand it, here is my start for case:
{l Code}: {l Select All Code}
setdesc "case" "" "<integer> [<test_value> <body>]*"


Edit:
On a related note, I don't think your parser is going to pick up on case/f/s since it uses a sub-define (CASECOMMAND@ r4461:engine/command.cpp:2757-2773).
And similarly, forward/left/right/backward (imov@ r4461:game/physics.cpp:79-101).
I think there are others, but I don't remember them at the moment.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby arand » 23 Oct 2012, 11:40

srbs {l Wrote}:I'll be tackling case/cond next, and I noticed you are using <value...> for variable arguments. (my latest installment does also to ease your tweaking)
This won't work very well with case/cond since they have variable arguments in pairs. case's nargs ICOMMAND definition is "ite2V" which is crappily explained at the top of http://pastebin.com/UA5LY6dY under V.
To maybe help understand it, here is my start for case:
{l Code}: {l Select All Code}
setdesc "case" "" "<integer> [<test_value> <body>]*"


Yeah, I was thinking one could be using something along the lines of
{l Code}: {l Select All Code}
setdesc "case" "" "<integer> [<test_value> <body>] [...]"
or
setdesc "case" "" "<integer> [<test_value> <body>] [<test_value> <body>] [...]"
I don't know, but I'm thinking that "..." works for a broader audience since they don't need to know, and connect it to regexp.

srbs {l Wrote}:Edit:
On a related note, I don't think your parser is going to pick up on case/f/s since it uses a sub-define (CASECOMMAND@ r4461:engine/command.cpp:2757-2773).
And similarly, forward/left/right/backward (imov@ r4461:game/physics.cpp:79-101).
I think there are others, but I don't remember them at the moment.

Yeah, I guess I'll have to special-case a bit for those, just hoping it's not that common.
User avatar
arand
 
Posts: 211
Joined: 26 Mar 2011, 21:42

Re: Request: Contributions of var & command descriptions

Postby srbs » 24 Oct 2012, 05:18

arand {l Wrote}:Yeah, I guess I'll have to special-case a bit for those, just hoping it's not that common.

I did a quick search, the only other ones are the text commands. (TEXTCOMMAND@ r4461:engine/textedit.h:705-709)
I'm about 99.5% sure that's all of them.

I actually gave up on a regex to identify them (for the pastebins) and just wrote my own command to execute in-game and print all that stuff out.


Out of curiosity, do you look for GICOMMAND's too? (r4461:shared/command.h:377,390,403)
Granted there are only two (resetvars, resetconfig) uses, but who knows if there will be more.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby srbs » 24 Oct 2012, 07:41

Here are the missing core functions.
I didn't really know what to put for echo & error, so I copied it from concat. :)

Also, notice that I didn't explain the nonworld argument in exec. That's because I'm not 100% sure what it does. (the whole IDF_WORLD flag thing)

{l Code}: {l Select All Code}
setdesc "echo"   "prints all <value>s concatenated together to the console.^nexample: echo hello (getname)" "<value...>"
setdesc "error"  "prints all <value>s concatenated together to the console as an error.^nexample: error hello (getname)" "<value...>"
setdesc "exec"   "executes <file> as cubescript^nexample: exec ^"data/defaults.cfg^"" "<file> [<nonworld>]"
setdesc "exists" "returns true when <file> exists and can be opened with <mode>^npossible modes: r (read), w (write), rw (read & write). r is default.^nexample: exists ^"data/defaults.cfg^"" "<file> [<mode>]"


Edit: I fixed echo & error.. I guess writing basic documentation right before crashing for the night was a bad idea.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby srbs » 25 Oct 2012, 05:03

Here is the one missing list function that I forgot about and had to verify since it doesn't work quite right in 1.3.1.

{l Code}: {l Select All Code}
setdesc "at" "returns the element at <index> in <list>, subsequent indexes are at'd with the previous result.^nexample: at [this has a [nested list]] 3 1" "<list> <index> [<nested_index>...]"
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby ZeroKnight » 26 Oct 2012, 08:10

arand {l Wrote}:Yeah, I guess I'll have to special-case a bit for those, just hoping it's not that common.

You'll also need one for cond, which is very similar to case

Example taken from Platinum Arts Sandbox wiki:
{l Code}: {l Select All Code}
 lightstrength = [
   cond [< (ea 0) 0] [
     echo "It's like a black hole!"
   ] [= (ea 0) 0] [
     echo "Blindlier than science!"
   ] [< (ea 0) 8] [
     echo "It's weaker than Billy's night light!"
   ] [< (ea 0) 32] [
     echo "Nice night light you got there"
   ] [< (ea 0) 96] [
     echo "It's like a lamp, but it's not a lamp"
   ] [< (ea 0) 512] [
     echo "By Jove! I can actually see the ground!"
   ] [>= (ea 0) 512] [
     echo "Dark places are icky, don't you agree?"
   ]
 ]

It's similar to case, except that you give conditions to match instead of a variable and possible matches. It's described as a bunch of if-else's chained together.

Something like:
{l Code}: {l Select All Code}
setdesc "cond" "performs ^"<action>^" when ^"<condition>^" is true. can have any number of ^"<cond>^"/^"<action>^" pairs" "[<cond> <action>] [. . .]"


And on a different note, here's a few more descriptions:
{l Code}: {l Select All Code}
setdesc "escape" "escapes a string, returning it literally^nEx: `echo (escape ^"^^faGrey Text^")` returns: ^^faGrey Text" "<string>"
setdesc "filter" "filters a string by stripping of any or all of the following: newlines, color, and whitespace. each of these values are boolean, and true by default if omitted^n^"[<newlines>]^" - if true, replaces newline characters with spaces^n^"[<color>]^" - if true, any color formatting will be removed^n^"[<whitespace>]^" - if true, whitespace is kept; if false, whitespace is removed" "<string> [<newlines>] [<color>] [<whitespace>]"
setdesc "goto" "jumps the spectator camera to the position of the specified client." "<cn>"
setdesc "hexcolour" "converts a decimal color value to a 'pretty-printed' hexadecimal color value^nEx: (hexcolour 342344) --> 0x093548" "<color>"
setdesc "precf" "returns ^"<float>^" to the ^"<N>^"th decimal place^nEx: (precf (divf 2 14) 5) --> 0.14286" "<float> <N>"
setdesc "writevars" "writes the current server's variables to config file ^"<file>^"^nif ^"[<all>]^" is true, every variable will be written, with default values commented out; if false, only changed variables will be written (default: false)^nif^"[<sv_>]^" is true, variables will be prefixed with ^"sv_^" (default: false)" "<file> [<all>] [<sv_>]"


There's also unescape which I guess does the opposite of escape? Not really sure when this would be needed...
{l Code}: {l Select All Code}
setdesc "unescape" "unescapes a string" "<string>"
Last edited by ZeroKnight on 27 Oct 2012, 09:24, edited 1 time in total.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Request: Contributions of var & command descriptions

Postby srbs » 26 Oct 2012, 23:53

ZeroKnight {l Wrote}:
arand {l Wrote}:Yeah, I guess I'll have to special-case a bit for those, just hoping it's not that common.

You'll also need one for cond, which is very similar to case

Cond is found correctly because it uses the standard ICOMMAND macro.

ZeroKnight {l Wrote}:It's described as a bunch of if-else's chained together.

That's because that is what it is. :)

ZeroKnight {l Wrote}:And on a different note, here's a few more descriptions:
{l Code}: {l Select All Code}
setdesc "escape" "escapes a string, returning it literally^nEx: `echo (escape ^"^^faGrey Text^")` returns: ^^faGrey Text" "<string>"

...
There's also unescape which I guess does the opposite of escape? Not really sure when this would be needed...
{l Code}: {l Select All Code}
setdesc "unescape" "unescapes a string" "<string>"


I'll be writing escape/unescape also. (I'm attempting to write 99% of the functions defined in engine/command.cpp.)
I have a basic description for those somewhere; from back when they were first added. I just need to verify them.

ZeroKnight:
I'm curious on your opinion for how I'm describing these functions.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby ZeroKnight » 27 Oct 2012, 09:26

Sorry. I misread a few things. Ignore what I said about cond :P

My opinion on your descriptions? I think they're fine. Though I'm not sure that's what you're looking for.
[ Github ][ WazuClan -- irc.wazuclan.com #wazuclan ][ Zero's Archive of RE Extensions, Scripts, WeapMods & More! ]
User avatar
ZeroKnight
 
Posts: 524
Joined: 08 Jun 2011, 01:24
Location: Ohio, United States

Re: Request: Contributions of var & command descriptions

Postby srbs » 30 Oct 2012, 06:40

ZeroKnight {l Wrote}:My opinion on your descriptions? I think they're fine. Though I'm not sure that's what you're looking for.

I tend to have a weird way of explaining things (generally bad irl), so I just wanted to see what you thought of them.
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Re: Request: Contributions of var & command descriptions

Postby srbs » 30 Oct 2012, 06:41

Here are case/cond:
I finally got to a point I mostly liked them..

{l Code}: {l Select All Code}
setdesc "case"  "executes the first <body> where the corresponding <test_value> is equivalent to <integer> using integer comparison^nFor the 'default' case (always true) use () for the <test_value>.^nexample: case (rnd 3) 0 [ echo 0 ] 1 [ echo 1 ] () [ echo default ]" "<integer> [<test_value> <body>]*"
setdesc "casef" "executes the first <body> where the corresponding <test_value> is equivalent to <float> using float comparison^nFor the 'default' case (always true) use () for the <test_value>.^nexample: case (+f (rnd 3) .1) 0.1 [ echo 0.1 ] 1.1 [ echo 1.1 ] () [ echo default ]" "<float> [<test_value> <body>]*"
setdesc "cases" "executes the first <body> where the corresponding <test_value> is equivalent to <string> using string comparison^nFor the 'default' case (always true) use () for the <test_value>.^nexample: case (substr ^"abc^" (rnd 3) 1) a [ echo a ] b [ echo b ] () [ echo default ]" "<string> [<test_value> <body>]*"
setdesc "cond"  "executes the first <body> where the corresponding <condition> is true^nexample: i = (rnd 3); cond [ = $i 0 ] [ echo 0 ] [ = $i 1 ] [ echo 1 ] 1 [ echo default ]" "[<condition> <body>]*"
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Who is online

Users browsing this forum: No registered users and 1 guest