Author Topic: Bit Che - Script Engine 3.5 - Detailed Function List  (Read 3623 times)

Offline chip!

  • Bad Ass
  • Administrator
  • Unstoppable
  • *****
  • Posts: 2301
  • Karma: +625/-6
    • View Profile
Bit Che - Script Engine 3.5 - Detailed Function List
« on: April 18, 2014, 09:57:21 am »

Basic Functions Detailed - Script Engine 3.5:

findh -- Searches a string for another string but HALTS the script if it is not found. Typically the first line of the script. Stores the location of the found string as a integer into the return variable.

vRes findh vStartvDatasSearch )

   searches the data variable "@data" for "</td>" starting at position stored in variable "x" and stores the result into variable "z". if "</td>" is not found, the script halts (dies).

   Optional extended use, can search for successive terms (up to 10):

vRes findh vStartvDatasSearch sSearch2sSearch3...etc 

   Note: this will halt the script if the last "" is not found in order starting from the location of the first term. This us useful to make sure you are working with the expected HTML output.

find -- Searches a string for another string. Typically Stores the location of the string as a integer into the return variable.
   Returns: Number

vRes find vStartvDatasSearch )

   if the String is NOT found, will return `0`

findrev -- Searches in reverse for a string in a variable.
   Returns: Number

vRes findrev vStartvDatasSearch)

   searches from the end of "t" for the location of "title=" and stores it in "x"
   Note: "-1" for the vStart always searches from the END of the string.

crop -- Crops a string based on a starting and ending locations
   Returns: String

vRes crop vDatavStartvEnd)

mid -- Cuts a string based on a starting location and length (number of characters to include)
   Returns: String

vRes mid vDatavStartvLength)

   Note: vLength is optional -- if not supplied, then the string will be cut from the starting location and include everything after that position.


split -- Used to split up a data block into the arrays.
   Returns: String() Array

   This is a special function any only 2 result variables are allowed: r & q

r=split(@data,`</tr>`) - sets up the "@r" array delimiting with </tr>
q=split(@r,`</td>`) - sets up the "@q" array delimiting with </td>

   Note: the delimiter can be anything you like, the result variables can not be changed. The use of "@r" is automatically the STRING of the array starting at Array(0). Each time the "loop" or "aloop" is used, then the Array(#) is automatically increased when you access "@r" next, so that "@r" always is the current array of the "results".

array -- Used to access data from the "@q" array and stores into a variable for manipulation.
   Returns: String


   stores the 3rd item in the "@q" array to the string varriable "t".
   note: arrays always start numbering with 0 for the first item which means when accessing the array items:
   0=1st 1=2nd 2=3rd ..etc

replace -- searches a string variable for a specific string and replaces it with another
   Returns: String

vRes replace vDatasSearchsReplace)

   Useful when Bit Che needs to parse tricky HTML code,etc.

extract -- special function that combines searching, cutting, extracting, and cleaning.
   Returns: String

vRes extract vPositionvDatasFindStartsFindEnd)

   searches variable "t" starting at the value of "z" for "<bc>" and extracts the data until "[-bc-]". this extracted data is then saved into variable $name. The extracted data is automatically "scrubbed" and cleaned from unwanted HTML codes.


vRes extract vPositionvDatasFindStartsFindEndsAddFrontsAddEnd)
$page=extract(z,t,`<bc>`,`[-bc-]`, ``,`?action=view`)

   both sAddFront and sAddEnd are OPTIONAL. the function is the same as without, but if present, then sAddFront will be added to the FRONT of the new string, and sAddEnd will be added to the END of the new result string.

put -- allows you to store a string/number into a variable
   Returns: String/Number

vRes put sString )
t=put(`hello world`)

   stores "hello world" into "t"


   stores "1" into "t"

   Note: you can store numbers or strings into variables.

& -- allows you to combine strings OR variables into one variable.
   Returns: String

vRes = & ( vFirstvSecondetc..)

   combines "k" with "m" and saves it as variable "t"

   Note: You can also combine text strings instead of variables. Example:
   t = & ( ``, q, `.torrent`)
   If variable q = "/download.php?name=file", then t would equal

len -- returns the Length of a string Variable
   Returns: Number
vRes len sVar)


   if "d" contains the string "hello world" then x would be set to the Length: 11

+/- -- allows you to add or subtract a number from a variable
   Returns: Number
vRes = + ( sNum)

variable "x" "x" 1

variable "x" "x" 5


start -- indicates the line number in the script where Bit Che should "loop" back to to process the next array item in the result array "@r".
   Returns: <none>


aloop -- adds the currently stored special torrent information variables to a torrent result in Bit Che and loops back to the "start" of the script. automatically advances to the next "@r" array item.
   Returns: <none>


loop -- loops back to the "start" of the script. automatically advances to the next "@r" array item. does NOT save the special torrent information to a result in Bit Che
   Returns: <none>


Other Special Functions:

vacuum -- removes characters like "tab" and "line return/breaks" from a string
   Returns: String


scrub -- removes HTML from a string (note: done automatically when saving a function"s result to a $special variable)
   Returns: String


die-- halts the script execution
   Returns: <none>


Currently Undocument:
reset -- reset @data back to the original HTML (as it was at the beginning of the script execution) (used for debugging)

urlencode(sString) -- URL encodes a string for HTTP.

urldecode(sString) -- converts/decodes a URL coded string.

utf8decode(sString) -- converts/decodes a UTF8 coded string.

utf8encode(sString) -- converts/encodes a string to UTF8.

code(sString, sNum) -- used to specify a second code section. this is used when Bit Che must fetch a 2nd page, execute another script, and extract more info.

#=resubmit(sPage) -- used to redirect or resubmit a HTTP request. The # is the amount times the script can resubmit. Usually this # is 1 or 2 to prevent unexpected endless script loops.

#=notify ( sTitle, sMessage ) -- used to provide User with a pop up notification that will hide after 5 seconds. The # is required but not used.

MergeURL(sBaseURL, sNewPage) -- useful when crafting HTTP URLs.

htmldecode(sText) -- decodes &#HTML; characters found in the sText

« Last Edit: January 25, 2015, 03:16:56 am by chip! »
  -  -   And...  boom goes the dynamite.