Skip to content

Commit

Permalink
Partially fix the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
DEntisT committed Aug 29, 2023
1 parent 4b0132b commit 9dff0f9
Show file tree
Hide file tree
Showing 17 changed files with 373 additions and 339 deletions.
90 changes: 45 additions & 45 deletions doc/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,43 +18,43 @@

Import the component using:
```cpp
using console;
using console
```

### Form: `cout`
- Character output.

```pawn
console.cout('c');
console.cout('c')
```

### Form: `cin`
- Character input. Code execution will not be stopped, only a destination variable in which the RCON input will be stored is set.

```pawn
console.cin(destvar);
console.cin(destvar)
```

### Form: `println`
- Text line output.

```pawn
console.println("Hello World!");
console.println("Hello World!")
```

### Form: `inputln`
- Text line input. Code execution will not be stopped, only a destination variable in which the RCON input will be stored is set.

```pawn
console.inputln(destvar);
console.inputln(destvar)
```

### Form: `rawout`

- Raw text output.

```cpp
console.rawout(RandomTextIg??);
console.rawout(RandomTextIg??)
```

---------------------------------------------------------------------------------------------------------
Expand All @@ -64,25 +64,25 @@ console.rawout(RandomTextIg??);

Import the component using:
```cpp
using system;
using system
```

### Form: `rem`
- Comments.
```pawn
system.rem("SOME TEXT");
system.rem("SOME TEXT")
```

### Form: `arginit`
- Used to initialize the arguments.

```cpp
int*form.arginit_test?playerid&string;
int arginit_test(num,string) public
{
return,1;
return 1
}

system.arginit(arginit_test,1,"Hello!");
system.arginit(arginit_test,1,"Hello!")
```
---------------------------------------------------------------------------------------------------------
Expand All @@ -108,66 +108,66 @@ extern&struct*public.main;

Import the component using:
```cpp
using files;
using files
```

### Form: `open_for_write`
- Opens a file with an intention to write data into it. File is created if it does not exist.

```cpp
files.open_for_write("file_name.txt");
files.open_for_write("file_name.txt")
```

### Form: `open_for_read`
- Opens a file with an intention to read data from it. File is created if it does not exist.

```cpp
files.open_for_read("file_name.txt");
files.open_for_read("file_name.txt")
```

### Form: `open_for_append`
- Opens a file with an intention to append data into it. File is created if it does not exist.

```cpp
files.open_for_append("file_name.txt");
files.open_for_append("file_name.txt")
```

### Form: `read`
- Reads data from the opened file and stores it into a variable.

```cpp
new.str,dest_string="something that should change";
files.read(dest_string);
new.str,dest_string="something that should change"
files.read(dest_string)
```

### Form: `write`
- Writes data into the opened file.

```cpp
files.write("wrote this into file_name.txt");
files.write("wrote this into file_name.txt")
```

### Form: `close`
- Closes the opened file.

```cpp
files.close;
files.close
```

### Form: `delete`

- Deletes a certain file.

```cpp
files.delete("newfile.omg");
files.delete("newfile.omg")
```

### Form: `createdir`

- Creates a directory.

```cpp
files.createdir("mydir");
files.createdir("mydir")
```

---------------------------------------------------------------------------------------------------------
Expand All @@ -178,14 +178,14 @@ files.createdir("mydir");

Import the component using:
```cpp
using misc;
using misc
```

### Form: `swap`
- Swaps two's variable values.

```pawn
misc.swap(var1,var2);
misc.swap(var1,var2)
```

**NOTE**: Now variable `var1` will have the value `var2` had, and `var2` will have the value `var1` had.
Expand All @@ -198,32 +198,32 @@ misc.swap(var1,var2);

Import the component using:
```cpp
using data;
using data
```

### Form: `sscanf`
- Parses and splits a string.

```cpp
using data;
using data

new.str,scanftest1="ok";
new.str,scanftest2="ok";
new.str,scanftest3="ok";
new.str,scanftest4="ok";
new.int,scanftest5=2453;
new.int,scanftest6=2453;
new.str,scanftest1="ok"
new.str,scanftest2="ok"
new.str,scanftest3="ok"
new.str,scanftest4="ok"
new.int,scanftest5=2453
new.int,scanftest6=2453

new.str,scanftest="sscanf-is-so-cool-1-2";
new.str,scanftest="sscanf-is-so-cool-1-2"

data.sscanf(scanftest,scanftest1,scanftest2,scanftest3,scanftest4,scanftest5,scanftest6);
data.sscanf(scanftest,scanftest1,scanftest2,scanftest3,scanftest4,scanftest5,scanftest6)

console.println.log(scanftest1);
console.println.log(scanftest2);
console.println.log(scanftest3);
console.println.log(scanftest4);
console.cout(scanftest5);
console.cout(scanftest6);
console.println.log(scanftest1)
console.println.log(scanftest2)
console.println.log(scanftest3)
console.println.log(scanftest4)
console.cout(scanftest5)
console.cout(scanftest6)
```

Output:
Expand All @@ -243,8 +243,8 @@ cool
- Returns a distance between 2 strings.

```cpp
data.strdist("hi", "hi") myretref;
console.println.log("myretref is {myretref}");
data.strdist("hi", "hi") myretref
console.println.log("myretref is {myretref}")
```

Output:
Expand All @@ -264,14 +264,14 @@ Unlike most of the functions, whose return 0 for failed operation and 1 for succ

Import the component using:
```cpp
using pawn;
using pawn
```

### Form: `callfunction`
- Calls a public function declared in the running Pawn code.

```cpp
pawn.callfunction("public_name");
pawn.callfunction("public_name")
```

---------------------------------------------------------------------------------
Expand All @@ -281,15 +281,15 @@ pawn.callfunction("public_name");

Import the component using:
```cpp
using math;
using math
```

### Form: `vectorsize`
- Calculates the distance between two 3-dimensional points.

```cpp
math.vectorsize(234.1,4211.3,43.3,-43.33,-0.1,-823) myretref; // Pretty random coordinates.
console.rawout.log(myretref);
console.rawout.log(myretref)
```

Output:
Expand Down
16 changes: 8 additions & 8 deletions doc/const.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
- You also may make constants in PawnScript:

```cpp
const*new.int,MY_FIRST_CONST=1;
const*new.int,MY_FIRST_CONST=1
```


You also may create boolean and string constants:

```cpp
const*new.bool,MY_FIRST_CONST=true;
const*new.bool,MY_FIRST_CONST=true

const*new.str,MY_FIRST_CONST="string";
const*new.str,MY_FIRST_CONST="string"
```

## Data types
Expand All @@ -23,37 +23,37 @@ const*new.str,MY_FIRST_CONST="string";
- Integers are whole numbers.

```cpp
const*new.int,integer=1;
const*new.int,integer=1
```

### `bool`

- Booleans are variables that can either be true or false.

```cpp
const*new.bool,boolean=true;
const*new.bool,boolean=true
```

### `str`

- Strings are words or sequences of characters.

```cpp
const*new.str,string="test";
const*new.str,string="test"
```

### `double`

- Doubles are numbers with decimal points.

```cpp
const*new.double,decimal_point=3.14;
const*new.double,decimal_point=3.14
```

### `char`

- Single characters.

```cpp
const*new.char,character='6';
const*new.char,character='6'
```
10 changes: 5 additions & 5 deletions doc/constexpr.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
## Namespaces

```cpp
constexpr namespace TestConstNamespace;
constexpr namespace TestConstNamespace
{
void MyForm() public;
void MyForm() public
{
console.println.log("My namespace function works!");
console.println.log("My namespace function works!")
}
}

user.TestConstNamespace::MyForm;
user.TestConstNamespace::MyForm()

using namespace TestConstNamespace;
using namespace TestConstNamespace
{
// Oops! Fatal error!
// Process will be terminated at this point!
Expand Down
Loading

0 comments on commit 9dff0f9

Please sign in to comment.