Author Topic: Bit Che - Script Engine 3.5 - Function List Quick Overview  (Read 21916 times)

Offline chip!

  • Bad Ass
  • Administrator
  • Unstoppable
  • *****
  • Posts: 2301
  • Karma: +629/-6
    • View Profile
Bit Che - Script Engine 3.5 - Function List Quick Overview
« on: April 18, 2014, 09:43:48 am »
Variable Handling:

Strings -- all strings must be escaped with ` -- for example this specifies test as a string: `test`
Variables -- anything not a String or a Special Variable is treated as a Variable -- for example this specifies test as a variable: test
$Special Result Variables -- variables that hold info regarding the result
@Special Data Variables -- variables that act special


Most basic script commands follow this pattern:


varName
=Function(p1,p2,p3)


where:

  • varName is the return variable (can be either a Variable, $Special Result Variables, or @Special Data Variables)
  • Function() is the function name
  • p1..p3 are parameters (can be Strings, Variables (any type), or Numeric) and separated by comma



$Special Result Variables:

$name - Result Name
$size - Result Size
$page - Page/URL to view more info about the Result
$date - Result Date (or time, etc)
$seeds - Result seeds/peers
$leeches - Result leeches/downloaders
$torrent - URL for the .torrent or magnet link
$source - Site Name where the Result came from


@Special Data Variables:

@r - (array) - the entire results table split into the array
@q - (array) - result from the @r array further split to parse the single result
@data - (string) - the HTML response data sent to the script engine
@i - (integer) - index counter. initialized as 1 and always reset to 1 after =array() function
@home - (string) - the URL for the source of the @data (as supplied in the script file from [profile])

@Additional (available only during [initialize] section)

@descriptions - (numeric) - either 1 for include description results OR 0 for no description results
@search - (string) - the search terms
@profile - (string) - the search URL
$form  - (string) - the FORM string from [login] section
$cookie  - (string) - set or update a cookie  (format of the input string must be  "COOKIE=VALUE;")



Script Engine 3.0 Functions List:

find - searches for a string
findh - searches for a string(s) and HALTS if not found
findrev - searches for a string in reverse
crop - crops/cuts a string
split - split a data block into an array
array - access data from the 'q' array
replace - replace a string with another
extract - extract: combines search, crop/cut, and clean.
put - store a String into a variable
& - combine Strings OR variables
+ - add a Number from a variable
- - subtract a Number from a variable
len - returns the length
ucase - returns a string in uppercase
lcase - returns a string in lowercase

urlencode - URL encodes a string for HTML
urldecode - decodes a string for HTML
utf8decode - decodes a UTF8 string

vacuum - removes extra characters
scrub - removes HTML tags
code - used to add functionality for second code section

getcookie - retrieves a specific cookie's data
resubmit - stops script execution and resubmits/redirects to a new url


Script Control Functions
start - indicates the start of the result parsing loop
add - adds the current torrent to the results list
aloop - adds the current torrent to the results list and loops back to 'start' with the next result in @q
loop - loops back to 'start' with the next result in @q
die - ends the script
reset - resets the @data variable back to its original value


Conditional/Loop Functions
if () then
else
elseif () then
end if

while
wend


IF THEN EXAMPLES:


if (x>and x<1then
...code...
elseif (
x=5then
...code...
else
...
code...
end if



WHILE EXAMPLE:

while(x!or y!0)
...
code...
wend



NOTE: for the above 2 examples, the following is true:

1. evaluation:
">" - greater than
"<" - less than
"!" - NOT equal
"=" - equal to

2. multiple conditions (IF, ELSEIF, WHILE can accept a SINGLE evaluation or a SECOND evaluation using):
"and" -- both evaluations are valid
"or" -- either evaluation are valid




Notes: Scripts are designed to parse HTML output into 2 arrays (@R and @Q). The first array '@r' stores the data that contains all of the 'results' and is parsed based on whatever delimiter is required to put each complete result into its own array element of '@r'. The delimiter for '@r' is typically "</TR>". The second array '@q' is used when looping through each result in '@r' and splits the data into a organized data array. The delimiter for '@q' is typically something like "/TD>". Then we loop through the information array and store the torrent information to special variables.



« Last Edit: January 18, 2015, 02:46:30 am by chip! »
  -  https://convivea.com  -   And...  boom goes the dynamite.