# 9.3 Script Functions List

### 9.3.1 Mathematical

| **Function**                                           | **Introduction**                                                        |
| ------------------------------------------------------ | ----------------------------------------------------------------------- |
| [Abs](../9.4-function-description#abs)                 | Get absolute value                                                      |
| [Acos](../9.4-function-description#acos)               | Compute the inverse cosine value                                        |
| [Asc](../9.4-function-description#asc)                 | Return the first character of the string in ASCII value                 |
| [Asin](../9.4-function-description#asin)               | Calculate the arcsine value                                             |
| [Atan](../9.4-function-description#atan)               | Return an arctangent value,the radian ranges -pi/2 to pi/2              |
| [Atan2](../9.4-function-description#atan2)             | Return the arctangent value                                             |
| [Cos](../9.4-function-description#cos)                 | Return a cosine value of an angle                                       |
| [Exp](../9.4-function-description#exp)                 | Returns the power value of e (natural logarithm)                        |
| [Hypot](../9.4-function-description#hypot)             | Calculate the value of the hypotenuse of a right triangle               |
| [Tan](../9.4-function-description#tan)                 | Implement tan calculation to computing the value                        |
| [Sin](../9.4-function-description#sin)                 | Implement sin calculation to computing the value                        |
| [Sqr](../9.4-function-description#sqr)                 | Assign a square root value                                              |
| [SignedInt16](../9.4-function-description#signedint16) | Assign the value to \[val] from address A1 which is signed integer      |
| [SignedInt32](../9.4-function-description#signedint32) | Assign the value to \[val] from address A1 which is signed even integer |

### 9.3.2 Data Mover

| **Function**                                       | **Introduction**                                                                                      |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| [BMOV](../9.4-function-description#bmov)           | Copy data with a designated length from source address                                                |
| [FILL](../9.4-function-description#fill)           | Write the same value to designated address constantly                                                 |
| [SetKeyMap](../9.4-function-description#setkeymap) | The key values of the keyboard are mapped so that multiple keyboard buttons perform the same function |

### 9.3.3 Process Control

| **Function**                                        | **Introduction**                                                                                                                                                                                 |
| --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [GOTO](../9.4-function-description#goto)            | Go to the designated row unconditionally in a function body                                                                                                                                      |
| [FOR](../9.4-function-description#for-to-step-next) | Execute a command repeatedly for designated times                                                                                                                                                |
| [END](../9.4-function-description#end)              | End the execution of script                                                                                                                                                                      |
| [while](../9.4-function-description#while-wend)     | If the condition is true, then all the commands before Wend in the statement will be executed and then recheck the condition, if the condition is false, the command after Wend will be executed |

### 9.3.4 Data Transformation

| **Function**                                         | **Introduction**                                                                       |
| ---------------------------------------------------- | -------------------------------------------------------------------------------------- |
| [A2H](../9.4-function-description#a-2-h)             | Convert string A1 to hexadecimal number                                                |
| [Asfloating](../9.4-function-description#asfloating) | Convert parameter to a float                                                           |
| [AsInteger](../9.4-function-description#asinteger)   | Convert parameter to a integer                                                         |
| [AsString](../9.4-function-description#asstring)     | Convert parameter to a string                                                          |
| [B2W](../9.4-function-description#b-2-w)             | Convert an array                                                                       |
| [BCD](../9.4-function-description#bcd)               | Convert binary to BCD, save the result as return value                                 |
| [BIN](../9.4-function-description#bin)               | Convert BCD to binary, save the result in return value                                 |
| [Chr](../9.4-function-description#chr)               | Convert integer parameter into correspond ASCII character, return the character string |
| [D2F](../9.4-function-description#d-2-f)             | Convert the 32 bit integer format data to float then output the result                 |
| [D2Float](../9.4-function-description#d-2-float)     | Convert the designated value to floating then assign to variable                       |
| [D2Int](../9.4-function-description#d-2-int)         | Output the 32-bit integer in the form of integer                                       |
| [DegToRad](../9.4-function-description#degtorad)     | Convert the angle into correspond radian, and display                                  |
| [F2D](../9.4-function-description#f-2-d)             | Convert a 32 bit floating to integer format, and then output the result                |
| [F2S](../9.4-function-description#f-2-s)             | Output a format of floating that in the type of string                                 |
| [Float2D](../9.4-function-description#float-2-d)     | Copy floating value to the address                                                     |
| [H2A](../9.4-function-description#h-2-a)             | Convert a binary(16 bit) to hexadecimals(4 bit) of ASCII                               |
| [Int2D](../9.4-function-description#int-2-d)         | Write the 32-bit integer into the specified address                                    |
| [LCase](../9.4-function-description#lcase)           | Convert all parameters to lowercase strings                                            |
| [MAX](../9.4-function-description#max)               | Compare the value of A2 and A3, assign the greater number to A1                        |
| [MIN](../9.4-function-description#min)               | Compare the value of A2 and A3, assign the smaller number to A1                        |
| [RadToDeg](../9.4-function-description#radtodeg)     | Convert radiant value to degree                                                        |
| [S2F](../9.4-function-description#s-2-f)             | Convert string to floating in the specified format                                     |
| [SWAP](../9.4-function-description#swap)             | Exchange the high and low bytes of the parameter                                       |
| [W2B](../9.4-function-description#w-2-b)             | Combine the high byte of the value of two consecutive addresses into a new value       |
| [W2D](../9.4-function-description#w-2-d)             | Convert the unsigned Word to unsigned Dword and save the result                        |
| [W2F](../9.4-function-description#w-2-f)             | Convert a 16bit integer to a 32bit floating, and then save to the next word address    |
| [W2S](../9.4-function-description#w-2-s)             | Convert integer word text as S1 format, and then save                                  |

### 9.3.5 Strings

| **Function**                               | **Introduction**                                                                                                                 |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| [A2I](../9.4-function-description#a-2-i)   | A string of length is intercepted from A1 and converted to a single/double word integer, and then this integer is assigned to A2 |
| [InStr](../9.4-function-description#instr) | Return the position of str1 in str2                                                                                              |
| [LEFT](../9.4-function-description#left)   | Return a string of the specified length from the left side of parameter                                                          |
| [Len](../9.4-function-description#len)     | Return the string length                                                                                                         |
| [LTrim](../9.4-function-description#ltrim) | Remove the left empty part of the string and return                                                                              |
| [Mid](../9.4-function-description#mid)     | Returns a string contain a specified characters length from a string                                                             |
| [Right](../9.4-function-description#right) | Return a string of the specified length from the right side of parameter                                                         |
| [RTrim](../9.4-function-description#rtrim) | Clear the empty part on the right side of string \[str], then assign the empty part to val                                       |
| [Trim](../9.4-function-description#trim)   | Return a value of an address without empty string next to it                                                                     |
| [UCase](../9.4-function-description#ucase) | Capitalize the string data, and then assign the value to val                                                                     |

### 9.3.6 Variable

| **Function**                                     | **Introduction**                                                                           |
| ------------------------------------------------ | ------------------------------------------------------------------------------------------ |
| [Pi](../9.4-function-description#constant)       | pi = 3.14159265358979321                                                                   |
| True                                             | TRUE = 1                                                                                   |
| False                                            | FALSE = 0                                                                                  |
| [Operator](../9.4-function-description#operator) | Operator in scripts edit window                                                            |
| [Variable](../9.4-function-description#variable) | A variable is any factor, trait, or condition that can exist in differing amounts or types |

### 9.3.7 Bit Control

| **Function**                                 | **Introduction**           |
| -------------------------------------------- | -------------------------- |
| [ClrB](../9.4-function-description#clrb)     | Set the bit of A1 as FALSE |
| [InvB](../9.4-function-description#invb)     | The state of inverse bit   |
| [SetB](../9.4-function-description#setb-sub) | Set the bit A1 ON          |

### 9.3.8 File Operation

| **Function**                                                 | **Introduction**                                                                                |
| ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| [HmiRegOperator](../9.4-function-description#hmiregoperator) | Data of Upload/ Download address                                                                |
| [CopyFile](../9.4-function-description#copyfile)             | Copy the A3 file from the A1 directory to the A2 directory according to the format of A4 and A5 |
| [DbToCsvFile](../9.4-function-description#dbtocsvfile)       | Convert db (database file) file to csv format and export it                                     |

### 9.3.9 Compare

|                                                                       | **Function** | **Introduction**                                                                                                                                                                                                                                                                      |
| --------------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [IF... THEN GOTO..](../9.4-function-description#if-then-else-end-if). | IF=          | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF<>         | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF>          | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF>=         | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF<          | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF<=         | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF AND=0     | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF AND<>0    | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
| [IF](../9.4-function-description#if-then-else-end-if)                 | IF=          | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF<>         | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF>          | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF>=         | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF<          | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF<=         | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF AND=0     | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
|                                                                       | IF AND<>0    | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
| ELSE                                                                  |              | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |
| ENDIF                                                                 |              | Execute correspond instruction when fulfill condition. Condition will be tested during executing if. it will execute the next instruction block of then, if condition is true. Otherwise, execute the later of else. Complete the two instructions, next execute the later of End if. |

### 9.3.10 Applied Function

| **Function**                                                       | **Introduction**                                                                                            |
| ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------- |
| [AddrStringCompare](../9.4-function-description#addrstringcompare) | Compare the designated length of two character strings                                                      |
| [beep](../9.4-function-description#beep)                           | Enable buzzer                                                                                               |
| [IsFloating](../9.4-function-description#isfloating)               | whether a parameter is floating, return TRUE if it is floating, otherwise return FALSE                      |
| [IsInteger](../9.4-function-description#isinteger)                 | whether a parameter(A1) is integer, return TRUE if the parameter is integer, otherwise return FALSE         |
| [Log](../9.4-function-description#log)                             | Log function: return the natural logarithm of the value                                                     |
| [Log10](../9.4-function-description#log10)                         | Log function: return the natural logarithm of the value                                                     |
| [MSeconds](../9.4-function-description#mseconds)                   | Display the current microseconds of system                                                                  |
| [NewNoAddr](../9.4-function-description#newnoaddr)                 | At the basic of source address A2, offset designated length, obtain a new address A1                        |
| [NewStatAddr](../9.4-function-description#newstataddr)             | At the basic of source address A2, offset the designated length, to obtain a new station A1.                |
| [NStringCompare](../9.4-function-description#nstringcompare)       | Compare whether the designated length of two strings is the same, return 1 to A1 if yes, otherwise return 0 |
| [Power](../9.4-function-description#power)                         | The value of \[expr2] to the power of \[expr1] will be assigned to Var                                      |
| [Rand](../9.4-function-description#rand)                           | Generate a random number                                                                                    |
| [ReadAddr](../9.4-function-description#readaddr)                   | Assign the value in the specified address to \[word]                                                        |
| [SleepA](../9.4-function-description#sleepa)                       | Wait time T(ms)                                                                                             |
| [WriteAddr](../9.4-function-description#writeaddr)                 | Assign the value from A2 to address A1                                                                      |

### 9.3.11 Others

| **Function**                                                         | **Introduction**                                                                         |
| -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
| [Dim...as...](../9.4-function-description#dim-as)                    | Declare a variable                                                                       |
| [do](../9.4-function-description#do-loop)                            | Condition determent instruction                                                          |
| [Function](../9.4-function-description#function)                     | Differ from internal function, need to declare the name, parameter, code of the function |
| [Sub](../9.4-function-description#sub)                               | Declare the name, parameters and codes of the Sub (sub function)                         |
| [PrintText](../9.4-function-description#printtext)                   | Output the contents to the printer for printing                                          |
| [PI\_GetTickCount](../9.4-function-description#pi_gettickcount)      | Write the starting time in the set address as a 32-bit integer                           |
| [StAndFtChange](../9.4-function-description#standftchange)           | Calculate the number of seconds from January 1, 1970 to the current time                 |
| [GetServerDelayInfo](../9.4-function-description#getserverdelayinfo) | Convert string to hexadecimal number                                                     |
