Skip to content

Commit

Permalink
documents a couple more procs (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
hry-gh authored Nov 13, 2024
1 parent 6cc7063 commit edab371
Show file tree
Hide file tree
Showing 31 changed files with 202 additions and 29 deletions.
4 changes: 3 additions & 1 deletion content/language/operators/complement.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ usage = "~x"
return = "The bitwise complement/binary NOT of 'x'."
+++

{{ parity(description="Currently, `/matrix` does not support the usage of the binary NOT operator.") }}
{% parity() %}
Currently, `/matrix` does not support the usage of the binary NOT operator.
{% end %}
9 changes: 9 additions & 0 deletions content/language/proc/browse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
+++
title = "browse"
[[extra.args]]
name = "Body"
description = "A HTML text, a file, or null"
[[extra.args]]
name = "Options"
description = "A parameter string of options."
+++
4 changes: 3 additions & 1 deletion content/language/proc/clamp.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ for(var/num in clamp(my_list, 1, 5))
world.log << num // 1, 2, 3, 4, 5, 5, 5, 5, 5
```

{{ parity(description="A new list will always be returned from the `clamp()` proc, it does not operate in place.") }}
{% parity() %}
A new list will always be returned from the `clamp()` proc, it does not operate in place
{% end %}
19 changes: 18 additions & 1 deletion content/language/proc/fcopy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,25 @@
title = "fcopy"
[[extra.args]]
name = "Src" # AUTOGEN STATIC
description = "The file to copy."
[[extra.args]]
name = "Dst" # AUTOGEN STATIC
description = "Where the file should be copied to."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "1 on success; 0 on failure."
+++

The source file can be a savefile, a file on the filesystem or a loaded resource, such as an icon.

```dm
// resources are specified with 'single quotes'
fcopy('icons/mob.dmi', "temp/mob.dmi")
// "double quotes" specify an external file
fcopy("temp/mob.dmi", "the_void/")
```

{% parity() %}
In BYOND, if both the source and destination have a trailing slash, they will be treated as directories. This recursively copies the contents of directories into the target path.
{% end %}
6 changes: 5 additions & 1 deletion content/language/proc/fdel.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title = "fdel"
[[extra.args]]
name = "File" # AUTOGEN STATIC
description = "The file system entry to delete."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "1 on success; 0 on failure"
+++

Deletes the specified entry in the file system. If the filename ends with a `/`, it will recursively delete all contents within the directory.
6 changes: 5 additions & 1 deletion content/language/proc/fexists.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title = "fexists"
[[extra.args]]
name = "File" # AUTOGEN STATIC
description = "The name of the file to check."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "1 if the file exists; 0 if it does not."
+++

Determines if the file exists in the file system. Unlike [fdel()](@/language/proc/fdel.md), this exclusively operates on files - it cannot determine if a directory exists.
4 changes: 3 additions & 1 deletion content/language/proc/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
title = "file"
[[extra.args]]
name = "Path" # AUTOGEN STATIC
+++
+++

Returns a resource object of the file on the file system. This can then be manipulated using a variety of procs, such as allowing for output to a player using [<<](@/language/operators/greatergreater/input.md) and [browse()](@/language/proc/browse.md).
6 changes: 5 additions & 1 deletion content/language/proc/file2text.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
title = "file2text"
[[extra.args]]
name = "File" # AUTOGEN STATIC
description = "The file to read."
[extra.return]
type = "null, text" # AUTOGEN FIELD
+++
description = "The contents of the file, or null on invalid files."
+++

This allows you to read the contents of a file from the file system directly as a string.
14 changes: 13 additions & 1 deletion content/language/proc/findlasttext.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,26 @@
title = "findlasttext"
[[extra.args]]
name = "Haystack" # AUTOGEN STATIC
description = "The string to search through."
[[extra.args]]
name = "Needle" # AUTOGEN STATIC
description = "The text to search for."
[[extra.args]]
name = "Start" # AUTOGEN STATIC
default_value = "1" # AUTOGEN FIELD
description = "The byte position in the string to start searching at. As this is searching backwards, this defaults to the end of the string."
[[extra.args]]
name = "End" # AUTOGEN STATIC
default_value = "0" # AUTOGEN FIELD
description = "The byte position immediately before the last character that should be searched."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "The position in the string of the first match; 0 if no match was found."
+++

The comparison occurs case insensitively - for the case sensitive version, see [findlasttextex.md](@/language/proc/findlasttextex.md).

```dm
world.log << findlasttext("FooFoo", "foo") // 4
world.log << findlasttext("FooFoo", "foo", 3) // 1
```
2 changes: 2 additions & 0 deletions content/language/proc/findlasttext_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "findlasttext_char"
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
14 changes: 13 additions & 1 deletion content/language/proc/findlasttextex.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@ title = "findlasttextEx"
slug = "findlasttextEx" # AUTOGEN FIELD
[[extra.args]]
name = "Haystack" # AUTOGEN STATIC
description = "The string to search through."
[[extra.args]]
name = "Needle" # AUTOGEN STATIC
description = "The text to search for."
[[extra.args]]
name = "Start" # AUTOGEN STATIC
default_value = "1" # AUTOGEN FIELD
description = "The byte position in the string to start searching at. As this is searching backwards, this defaults to the end of the string."
[[extra.args]]
name = "End" # AUTOGEN STATIC
default_value = "0" # AUTOGEN FIELD
description = "The byte position immediately before the last character that should be searched."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "The position in the string of the first match; 0 if no match was found."
+++

The comparison occurs case sensitively - for the case insensitive version, see [findlasttext.md](@/language/proc/findlasttext.md).

```dm
world.log << findlasttext("FooFoo", "Foo") // 4
world.log << findlasttext("FooFoo", "Foo", 3) // 1
```
2 changes: 2 additions & 0 deletions content/language/proc/findlasttextex_char.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
+++
title = "findlasttextEx_char"
slug = "findlasttextEx_char" # AUTOGEN FIELD
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
24 changes: 23 additions & 1 deletion content/language/proc/findtext.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,36 @@
title = "findtext"
[[extra.args]]
name = "Haystack" # AUTOGEN STATIC
description = "The string to search through."
[[extra.args]]
name = "Needle" # AUTOGEN STATIC
description = "The text to search for, or the /regex to search with."
[[extra.args]]
name = "Start" # AUTOGEN STATIC
default_value = "1" # AUTOGEN FIELD
description = "The byte position in the string to start searching at."
[[extra.args]]
name = "End" # AUTOGEN STATIC
default_value = "0" # AUTOGEN FIELD
description = "The byte position immediately after the last character that should be searched."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "The position in the string of the first match; 0 if no match was found."
+++

If the Needle provided is a string, the comparison occurs case insensitively. For the case sensitive version, see [findtextex.md](@/language/proc/findtextex.md).

```dm
if(findtext("Foo Bar", "foo"))
world.log << "This succeeds!"
if(findtext("Foo Bar", "Foo", 3))
world.log << "This does not!" // as the Start is set after the occurence in the string
```

Negative amounts for the Start or End value count from the end of the string.

```dm
if(findtext("Foo Bar", "Bar", -3))
world.log << "We get here!"
```
2 changes: 2 additions & 0 deletions content/language/proc/findtext_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "findtext_char"
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
14 changes: 13 additions & 1 deletion content/language/proc/findtextex.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,26 @@ title = "findtextEx"
slug = "findtextEx" # AUTOGEN FIELD
[[extra.args]]
name = "Haystack" # AUTOGEN STATIC
description = "The string to search through."
[[extra.args]]
name = "Needle" # AUTOGEN STATIC
description = "The text to search for, or the /regex to search with."
[[extra.args]]
name = "Start" # AUTOGEN STATIC
default_value = "1" # AUTOGEN FIELD
description = "The byte position in the string to start searching at."
[[extra.args]]
name = "End" # AUTOGEN STATIC
default_value = "0" # AUTOGEN FIELD
description = "The byte position immediately after the last character that should be searched."
[extra.return]
type = "num" # AUTOGEN FIELD
+++
description = "The position in the string of the first match; 0 if no match was found."
+++

If the Needle provided is a string, the comparison occurs case sensitively. For the case insensitive version, see [findtext.md](@/language/proc/findtext.md).

```dm
if(findtext("Foo Bar", "foo"))
world.log << "This fails!"
```
2 changes: 2 additions & 0 deletions content/language/proc/findtextex_char.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
+++
title = "findtextEx_char"
slug = "findtextEx_char" # AUTOGEN FIELD
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
2 changes: 2 additions & 0 deletions content/language/proc/replacetext_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "replacetext_char"
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
2 changes: 2 additions & 0 deletions content/language/proc/replacetextex_char.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
+++
title = "replacetextEx_char"
slug = "replacetextEx_char" # AUTOGEN FIELD
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
2 changes: 2 additions & 0 deletions content/language/proc/spantext_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "spantext_char"
render = false

[[extra.args]]
name = "Haystack" # AUTOGEN STATIC
[[extra.args]]
Expand Down
2 changes: 2 additions & 0 deletions content/language/proc/splicetext_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "splicetext_char"
render = false

[[extra.args]]
name = "Text" # AUTOGEN STATIC
[[extra.args]]
Expand Down
2 changes: 2 additions & 0 deletions content/language/proc/splittext_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "splittext_char"
render = false

[extra]
od_unimplemented = true # AUTOGEN FIELD
[[extra.args]]
Expand Down
2 changes: 2 additions & 0 deletions content/language/proc/text2ascii_char.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
+++
title = "text2ascii_char"
render = false

[[extra.args]]
name = "T" # AUTOGEN STATIC
[[extra.args]]
Expand Down
4 changes: 3 additions & 1 deletion content/objects/database/query/proc/execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@ while(query.NextRow())
top_scorers += query.GetColumn(0)
```

{{ parity(description="We do not currently support running Execute() without a database datum provided. The BYOND implementation of DreamMaker supports passing a filename.") }}
{% parity() %}
We do not currently support running Execute() without a database datum provided. The BYOND implementation of DreamMaker supports passing a filename.
{% end %}
4 changes: 3 additions & 1 deletion content/objects/exception/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ When a runtime error occurs and {{ world(proc="Error") }} is defined, the first

When the EXCEPTION macro is used, a new exception will be generated. This can be used by a throw statement within a try/catch block, and the thrown exception will be caught in the catch statement.

{{ parity(description="In try/catch blocks, if `throw EXCEPTION` is not used, no exception datum will be generated. Instead, the first argument to the catch block will be the text of the exception.") }}
{% parity() %}
In try/catch blocks, if `throw EXCEPTION` is not used, no exception datum will be generated. Instead, the first argument to the catch block will be the text of the exception.
{% end %}
Loading

0 comments on commit edab371

Please sign in to comment.