Function Reference

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(String Functions)
(NBTTagCompound)
 
(13 intermediate revisions by one user not shown)
Line 301: Line 301:
 
* [[Core Function NBTCompoundWrite|NBTCompoundWrite( <nbtCompound>, <buffer> )]] -- Write the NBTTagCompound to binary or a buffer
 
* [[Core Function NBTCompoundWrite|NBTCompoundWrite( <nbtCompound>, <buffer> )]] -- Write the NBTTagCompound to binary or a buffer
 
* [[Core Function NBTCompoundRead|NBTCompoundRead( <binary-variable/buffer> )]] -- Create a new NBTTagCompound from a binary array or a buffer
 
* [[Core Function NBTCompoundRead|NBTCompoundRead( <binary-variable/buffer> )]] -- Create a new NBTTagCompound from a binary array or a buffer
* [[Core Function NBTCompoundWriteFile|NBTCompoundWriteFile( <nbtCompound>, <file>, <compression )]] -- Write the NBTTagCompound to a file
+
* [[Core Function NBTCompoundWriteFile|NBTCompoundWriteFile( <nbtCompound>, <file>, <compression> )]] -- Write the NBTTagCompound to a file
* [[Core Function NBTCompoundReadFile|NBTCompoundReadFile( <file> )]] -- Create a new NBTTagCompound from reading a file
+
* [[Core Function NBTCompoundReadFile|NBTCompoundReadFile( <file>, <compression>  )]] -- Create a new NBTTagCompound from reading a file
 
* [[Core Function NBTCompoundCompress|NBTCompoundCompress( <nbtCompound> )]] -- Compress the NBTTagCompound to binary
 
* [[Core Function NBTCompoundCompress|NBTCompoundCompress( <nbtCompound> )]] -- Compress the NBTTagCompound to binary
 
* [[Core Function NBTCompoundDecompress|NBTCompoundDecompress( <binary-variable> )]] -- Decompress a NBTTagCompound from binary
 
* [[Core Function NBTCompoundDecompress|NBTCompoundDecompress( <binary-variable> )]] -- Decompress a NBTTagCompound from binary
Line 544: Line 544:
 
* [[Core Function Soundex|Soundex( <str> )]] -- Calculate the soundex key of a string
 
* [[Core Function Soundex|Soundex( <str> )]] -- Calculate the soundex key of a string
 
* [[Core Function Str2Hex|Str2Hex( <expression>, <flag> )]] -- Convert a string to a hex string
 
* [[Core Function Str2Hex|Str2Hex( <expression>, <flag> )]] -- Convert a string to a hex string
 +
* [[Core Function StrNew|StrNew( <char>, <length>, <flag> ]] -- Create a new string of a given length filled with a given char
 
* [[Core Function StrInsert|StrInsert( <expression>, <index>, <expression2> )]] -- Insert a string at a given index of another string and return the new string
 
* [[Core Function StrInsert|StrInsert( <expression>, <index>, <expression2> )]] -- Insert a string at a given index of another string and return the new string
 
* [[Core Function StrIndex|StrIndex( <expression>, <index>, <value> )]] -- Get or set a char from/to a string at a specific index
 
* [[Core Function StrIndex|StrIndex( <expression>, <index>, <value> )]] -- Get or set a char from/to a string at a specific index
 
* [[Core Function StrIncrement|StrIncrement( <str> )]] -- Increment a string the same way as doing ++ on a string like $a++
 
* [[Core Function StrIncrement|StrIncrement( <str> )]] -- Increment a string the same way as doing ++ on a string like $a++
* [[Core Function StrPos|StrPos( <haystack>, <needle>, <offset>, <flags> )]] -- Find the position of the first/last occurrence of a substring in a string
+
* [[Core Function StrPos|StrPos( <haystack>, <needle>, <flags>, <start>, <length> )]] -- Find the position of the first/last occurrence of a substring in a string
* [[Core Function StrTr|StrTr( <str>, <from> <to>, <replace_pairs> )]] -- Translate characters or replace substrings
+
* [[Core Function StrTr|StrTr( <str>, <from-to/replace_pairs> )]] -- Translate characters or replace substrings
 
* [[Core Function StrTok|StrTok( <str/token>, <token> )]] -- Tokenize string
 
* [[Core Function StrTok|StrTok( <str/token>, <token> )]] -- Tokenize string
* [[Core Function StrStr|StrStr( <haystack>, <needle>, <before_needle>, <find_last>, <case> )]] -- Find the first/last occurrence of a string
+
* [[Core Function StrStr|StrStr( <haystack>, <needle>, <before_needle>, <find_last>, <case>, <start>, <length> )]] -- Find the first/last occurrence of a string
 
* [[Core Function StrLen|StrLen( <expression> )]] -- Returns length of specified string
 
* [[Core Function StrLen|StrLen( <expression> )]] -- Returns length of specified string
 
* [[Core Function SubStr|SubStr( <expression>, <start>, <count>, <replacement> )]] -- Return part of a string or replace it
 
* [[Core Function SubStr|SubStr( <expression>, <start>, <count>, <replacement> )]] -- Return part of a string or replace it
Line 563: Line 564:
 
* [[Core Function TrimLeft|TrimLeft( <expression>, <chars> )]] -- Strip whitespace from the start of a string
 
* [[Core Function TrimLeft|TrimLeft( <expression>, <chars> )]] -- Strip whitespace from the start of a string
 
* [[Core Function TrimRight|TrimRight( <expression>, <chars> )]] -- Strip whitespace from the end of a string
 
* [[Core Function TrimRight|TrimRight( <expression>, <chars> )]] -- Strip whitespace from the end of a string
 +
* [[Core Function TrimToNull|TrimToNull( <string> )]] -- Strip all zero chars (nulls) from the end of a string
 
* [[Core Function UC|UC( <expression> )]] -- Returns string in all Upper Case
 
* [[Core Function UC|UC( <expression> )]] -- Returns string in all Upper Case
 
* [[Core Function UCFirst|UCFirst( <expression> )]] -- Upper Cases first letter of string
 
* [[Core Function UCFirst|UCFirst( <expression> )]] -- Upper Cases first letter of string
Line 575: Line 577:
 
* [[Core Function VSPrintf|VSPrintf( <format control>, <params>... )]] -- Returns a formatted string (similar to the C sprintf() function) but accepts arrays as the arguments
 
* [[Core Function VSPrintf|VSPrintf( <format control>, <params>... )]] -- Returns a formatted string (similar to the C sprintf() function) but accepts arrays as the arguments
 
* [[Core Function WordWrap|WordWrap( <str>, <width>, <break>, <cut> )]] -- Wraps a string to a given number of characters
 
* [[Core Function WordWrap|WordWrap( <str>, <width>, <break>, <cut> )]] -- Wraps a string to a given number of characters
 
==== CharPtr Functions ====
 
Note the [[Fixed|Fixed]] statement is tied directly with CharPtr
 
* [[Core Function StrNew|StrNew( <char>, <length>, <flag> ]] -- Create a new string of a given length filled with a given char (or optionally return it as a CharPtr rather than a new string)
 
* [[Core Function CharCopy|CharCopy( <dest>, <src>, <length> )]] -- Copy a length of characters from the source pointer to the destination pointer
 
* [[Core Function CharCopyRev|CharCopyRev( <dest>, <src>, <length> )]] -- Copy a length of characters from the source pointer to the destination pointer (in reverse so Hello becomes olleH)
 
  
 
==== Array Functions ====
 
==== Array Functions ====
Line 593: Line 589:
 
* [[Core Function Join|Join( <array>, <separator> )]] -- Join an array into a string with an optional separator
 
* [[Core Function Join|Join( <array>, <separator> )]] -- Join an array into a string with an optional separator
 
* [[Core Function JoinKV|JoinKV( <array>, <separator> )]] -- Join an array (as keys and values) into a string with an optional separator
 
* [[Core Function JoinKV|JoinKV( <array>, <separator> )]] -- Join an array (as keys and values) into a string with an optional separator
* [[Core Function Count|Count( <array/binary-array> )]] -- Returns the size of array (How many elements it currently has stored)
+
* [[Core Function Count|Count( <array/binary-array/class> )]] -- Returns the size of array (How many elements it currently has stored)
 
* [[Core Function Fill|Fill( <start>, <num>, <value> )]] -- Fill an array with values
 
* [[Core Function Fill|Fill( <start>, <num>, <value> )]] -- Fill an array with values
 
* [[Core Function FillKeys|FillKeys( <keys>, <value> )]] -- Fill an array with values, specifying keys
 
* [[Core Function FillKeys|FillKeys( <keys>, <value> )]] -- Fill an array with values, specifying keys
Line 831: Line 827:
  
 
==== Memory Functions ====
 
==== Memory Functions ====
* [[Core Function WriteMem|WriteMem( < Caption / PID >, <Class>, <Address>, <value> )]] -- Write a value to an address in an application's memory (Supports multiple values and even binary variables for writing multiple bytes)
 
* [[Core Function ReadMem|ReadMem( < Caption / PID >, <Class>, <Address>, <defs>, <size> )]] -- Read bytes from an application's memory at an address and read it using the same defs and return values as UnpackSingle()
 
 
* [[Core Function Alloc|Alloc( <size>, <filler> )]] -- Allocate memory and return the pointer to it
 
* [[Core Function Alloc|Alloc( <size>, <filler> )]] -- Allocate memory and return the pointer to it
 
* [[Core Function Realloc|Realloc( <ptr>, <size> )]] -- Resizes a block of memory previously allocated with Alloc()
 
* [[Core Function Realloc|Realloc( <ptr>, <size> )]] -- Resizes a block of memory previously allocated with Alloc()
Line 982: Line 976:
 
* [[Core Function GUISetProp|GUISetProp( <gui object>, <prop>, <value> )]] -- Set the value of a GUI objects property
 
* [[Core Function GUISetProp|GUISetProp( <gui object>, <prop>, <value> )]] -- Set the value of a GUI objects property
 
* [[Core Function GUIGetPropList|GUIGetPropList( <gui object>, <searchfor>, <flag> )]] -- Get an array of the the names and types of all compatible/incompatible/all properties that the GUI object offers
 
* [[Core Function GUIGetPropList|GUIGetPropList( <gui object>, <searchfor>, <flag> )]] -- Get an array of the the names and types of all compatible/incompatible/all properties that the GUI object offers
 
===== Common Dialog/Control Functions =====
 
* [[Core Function GUIInvoke|GUIInvoke( <gui object>, <method name>, <params> )]] -- Call a method on a GUI object
 
  
 
===== GUI Link (Event) Functions =====
 
===== GUI Link (Event) Functions =====
Line 1,013: Line 1,004:
 
* [[Core Function ToolTipKill|ToolTipKill( <ToolTip> )]] -- Delete a tooltip that was made using ToolTip()
 
* [[Core Function ToolTipKill|ToolTipKill( <ToolTip> )]] -- Delete a tooltip that was made using ToolTip()
 
* [[Core Function PSet|PSet( <gui object>, <x>, <y>, <object> )]] -- Draw at a pixel
 
* [[Core Function PSet|PSet( <gui object>, <x>, <y>, <object> )]] -- Draw at a pixel
 +
* [[Core Function GUISendToBack|GUISendToBack( <gui object> )]] -- Send a GUI object to the back of the ZOrder
 +
* [[Core Function GUIBringToFront|GUIBringToFront( <gui object> )]] -- Send a GUI object to the front of the ZOrder
  
 
===== Variable Type Checking etc =====
 
===== Variable Type Checking etc =====
Line 1,096: Line 1,089:
 
* [[Core Function GetBValue|GetBValue( <colour> )]] -- Get the blue byte from a colour INT value
 
* [[Core Function GetBValue|GetBValue( <colour> )]] -- Get the blue byte from a colour INT value
  
==== .NET Functions and Features ====
+
==== Sputnik Plugins (Using .NET DLLs) ====
* [[Core Function DotNet|DotNet Objects]] -- Create/use .NET objects and call instance/static method and get/set properties
+
* [[Core Function Use|Use( <name/array>, <flag> )]] -- Load a Sputnik plugin
* [[Core Function Use|Use( <name>, <flag> )]] -- Define a .NET assemblies namespace + full qualified name for use in creating .NET objects
+
* [[Core Function Unuse|Unuse( <name> )]] -- ???
* [[Core Function Unuse|Unuse( <name> )]] -- Remove a .NET namespacefrom Sputniks search group (Added by Use() function)
+
* [[Core Function UnuseAssembly|UnuseAssembly( <name> )]] -- Remove a .NET assembly from Sputniks search group (Added by Compile() function)
+
* [[Core Function Compile|Compile( <sourceCode>, <outputFile/outputType>, <includeDLLs>, <options>, <compileroptions> )]] -- Compile C# source code into a DLL(or in ram) for use in using its classes, functions etc as if they were part of Sputnik
+
* [[Core Function ObjToDotNet|ObjToDotNet( <object> )]] -- Convert a Sputnik raw object such as a TextBox from GUICreate() or anything that uses OBJECT type into a useable DotNet type
+
  
 
==== Control Flow Functions ====
 
==== Control Flow Functions ====

Latest revision as of 07:54, 20 December 2015

Contents

Function Reference

How to create a Function

To create your own funtions see the Function page.

Core Functions

If a link is red (unclickable) the function either doesnt exist yet and is pending creation or it has been created but does not yet have a page/example.

Language Features

Parser Engine

Console Functions

Multi-Threading Functions

Variable Type Conversions

Common Variable Functions

Misc
Type Checking
Get Type Directly

Binary Data Management Functions

Binary packer/unpacker
Bit Vector
Bits
BinHex 5.0
ByteBuffer

The ByteBuffer is the replacement for the old Stream functions it is more robust, has more features and is resistant to crashes/errors from bad information etc it works similar to the ByteBuffer in Java

NBT (Named Binary Tag)

Functions on par with Minecrafts NBT system but greatly expanded to include many additional features and improvements specific for Sputnik.

NBTTagCompound
NBTTagList/NBTTagListEx
Misc Binary Functions

Bit Flag Functions

Math Functions

String Functions

Array Functions

Linq (Integrated Language Query) Functions

These functions are basically quick ways to shuffle arrays around (sort and organize them etc) and are BEST suited for when the array contains nothing but Classes but you can use them on any array if you want.

Enum Functions

Process Functions

Environment Management

File Functions

File Create/Read/Write Functions
Misc
Dialogs

Directory Functions

Dialogs

Path Functions

Network Functions

HTTP Functions
MySQL Functions
Sputnik Client/Server Functions (This is just for connecting Sputnik Clients to Sputnik Servers nothing else)
Raw Sockets (TCP/UDP etc)
Misc Network Functions

Memory Functions

Clipboard Functions

Registry Functions

Time & Date Functions

Old GUI Functions

All the functions below are part of the SputnikOldGUI.dll basically these functions are *to be* depreciated and replaced with something much better in the future.

However you can still use these and even after they have been replaced with a new GUI system you will still be able to use these functions (and GUI programs made with them) anyway by using the SputnikOldGUI.dll into your project.

To use any of these functions you must include the SputnikOldGUI.dll to do that you must add this code to the top of your script.

use('SputnikOldGUI.dll', true);

Here is an example of using "GUICreate" in a full example and including the SputnikOldGUI.dll

// Load the old GUI system
// Since this an old GUI example
use('SputnikOldGUI.dll', true);
// Create the GUI
Global $GUI = GUICreate("Window", "My Title", 200, 200);
// Create a button -- This button will simply display a message
Global $Button = GUICreate("Button", $GUI, "Press Me!", 8, 8);
// Add a link to the button
GUILink($Button, "Click", 'myFunction();'); // Call function
// Show the GUI
GUILoad( $GUI );
// Keep the GUI running as long as long as the window is open
While ( GUIStatus( $GUI ) ) 
	DoEvents( ); 
// This function is called when the button is clicked
Function myFunction()
{
	MsgBox("Hello from the button");
}

Make note however that the examples below do not include the SputnikOldGUI.dll in their scripts you must do that part yourself!.

Dialog Creation Functions
Control Creation Functions
NOT AVAILABLE YET
Window/Control Properties Get/Set Functions

Note - Any options not here are most likely found using GUIGetProp and GUISetProp the bulk of all props can be found/used in them 2 funtions however anything special and not generic will go in the functions below.

Common Dialog/Control Properties Get/Set Functions
GUI Link (Event) Functions
Graphics/Pixel Functions
Bitmap Functions
Other GUI Functions
Variable Type Checking etc

Keyboard Control Functions

Mouse Control Functions

Window Management Functions

(For info on using <title>, <text> See Window Titles and Text (Advanced) )

Controls

(For info on using <title>, <text> See Window Titles and Text (Advanced) )

NOT AVAILABLE YET

Graphics/Pixel Functions

Sputnik Plugins (Using .NET DLLs)

Control Flow Functions

  • Return <expressions> -- Immediately ends execution of the current function, and returns its argument as the value of the function call. return will also end the execution of an Eval() statement or script file
  • Throw( <expression> ) -- Throw an exception
  • Die( <expression> ) -- Gives an error and terminates the program
  • Break( <scopes> ) -- Ends execution of the current loop
  • Continue( <scopes> ) -- Continue the execution of a loop at its next iteration
  • Redo( ) -- Continue the execution of a loop at the start of the current iteration

Internal Class Management and Information

Internal Function Management and Information

Internal Enum Management and Information

Internal DLLImport Management and Information

Internal DLLStruct Management and Information

Internal Variable/Scope Information

Eval Functions

Misc Functions

User Defined Functions

These functions are created using Sputnik and are not part of the Sputnik core language.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox