IPB

Welcome Guest ( Log In | Register )

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 
Closed TopicStart new topic
> Function List, List and explinations
Snap
post Apr 11 2009, 01:10 AM
Post #1


The following post is supplementry information
*****

Group: Global Moderators
Posts: 2,922
Joined: 29-January 06
From: Eugene Oregon
Member No.: 31



%functionname (non-optional-argument,[Optional argument] = Default of the optional argument)

%round (NUMBER,TO DECIMAL)


Rounds a number to the Xth decimal.
%round(22.1234,1) -> 22.1

%if (TEST,True Response,[False Response] = NULL)


The most powerful function of all. A simple if statement, similar to the popular IIF function.

%ifnot (TEST,False Response,[True Response] = NULL)


Same as %if only backwards.

%switch (Compare String,String,Response,[String],[Response] - ETC) - Often understood as a PARAM ARRAY


Attempts to copy the Switch method - available in most programming languages
A very handy function.
Example:
!addcc pickgame 10 %switch(%rand(1,3),1,Starcraft,2,Diablo,3,Warcraft)

%for (START,STOP,STRING TO SAY,[Variable to replace with Number] = %i)


%i is default, but you can have it replace any string to be replaced with the number.
Functions are nested and executed correctly as of 1.6
Example:
!addcc dofor 10 Look! I can count to 4!: %for(1,4,%i)

%rand (LOWEST,HIGHEST)


Picks a number between LOWEST and HIGHEST randomly.

%ucase(STRING)


%ucase(i'm not yelling); returns I'M NOT YELLING

%lcase(STRING)


%lcase(NOT YELLING!); returns not yelling!

%mid (STRING,START,[HOW DEEP]) - {This function may be upgraded to mimic PHP's StrStr function}


Mimics VBs's Mid function.

%item (STRING,POSITION OF ITEM,[SEPARATOR] = Space)


%item(hello world,2); returns "world"

%xitem (STRING,POSITION OF ITEM TO REMOVE,[SEPARATOR] = Space)


The opposite of %item, this function instead of picking one out, it removes one out.
%xitem (hello world,2); returns "hello"

%replace(STRING,REPLACE THIS, WITH THIS)


Mimics the VBs Replace function;
%replace(hexxo world,x,l); returns hello world

%count (STRING,SEARCH)


%count(HELLO,L); returns 2

%instr (STRING,SEARCH,[Ignore Case] = true)


Returns the amount of characters between the start and the first sighting of SEARCH

%len(String)


Returns the amount of chars in String.

%chr (NUMBER CODE)


Mimics VBs's Chr function (Found in almost any programming language)
Used to create any character. Valid entries 0-255

%[email protected] (USERNAME)


Removes the # or @ suffix at the end of a username.
[email protected] -> Bob

%var (DL NAME,[LOCATION ENTRY] = main)


AKA %getdl returns the variable. See %setvar and %withvar

%getgid (USERNAME,NUMBER KEY)


Mimics StealthBot's GetInternalDataByUsername

%now([Seconds from current time] = 0)


Returns the time - A number can be used to add to to the current time - negative numbers allowed.
- Also note, a time/date can be used in the %if function to compare 2 different times.
Very useful if you store a time in a variable, and then wish to compare it later.


%secf (SECONDS)


Notes:
Seconds to Full. 60 = 1:00.
2147 = 35:47
- For use with the %gid function
Example:
!addcc lasttalked 10/ %if(%getgid(%1, 7) = -5,"%1" is not in channel!,%1 Last talked %secf(%getgid(%1, 7)) ago.

%listout (List Name, [Custom Output seperator])


Outputs the content in a list entirely.
Custom Output style has 3 variables:
## The numerical position
#R The position in Roman-Numerals, I.E. I: II: III:
#A The position in alphabetical letters, I.E. A: B: C:
Recommendations:
%listout(MyList, #R. )
%listout(MyList, #A. )

%listitem(List Name, Item Position)


Returns the item in defined position

%listsize(List Name)


Returns the amount of items in the list.

%wins(Username)


Returns the amount of wins that Username has (Applys to Starcraft and WC2)

%math(Operation)


Does the math.
%math(1+1); returns 2


PRIORITY 2 Functions:


The following lists Priority 2 functions
These functions all 'do' something - like set data or change a setting. They execute only after all Priority 1 functions have.

%die (STRING) - SPECIAL


This function acts like PHP's die. It will respond with the arguments, and everything else is ignored.
Example:
!addcc TestDie 10 %if(%user<>Snap,%die(This CC will only work for Snap))Hi Snap I Wuv your CC System!
Result:
!testdie
This CC will only work for Snap
!testdie
Hi Snap I Wuv your CC System

%runcc (Custom Command Name)


Runs the command - if the user has enough access to use that command.

%setvar (DL NAME,NEW SETTING,[RETURN RESULT] = False,[LOCATION ENTRY] = main)


AKA %setdl
Sets a var to be recalled with %var.

%withvar (DL NAME,OPERATION,[RETURN RESULT] = False,[LOCATION ENTRY] = main)


AKA %withdl
Uses a operator to apply a concatenation, or a mathematical operation.
& - Appends to.
%setvar(MYVAR,ello)
%withvar(MYVAR,& World)
%withvar(MYVAR,H&)
%var(MYVAR) now contains Hello World

+ Addition
* Multiplecation
/ Division
^ Power
MOD Modulo Division
%setvar(TEST,10)
%withvar(TEST,/2)

Currently, Subtraction is done with the use of negative numbers. Also - you can't currently divide in both directions. 1.91.

%listadd(List Name, Data to add,[Show Position] = false)


Adds an entry to a list. If Show position is true - it will return that number.

%listdel(List Name,Position or String to delete)


Deletes the list item - found by position or string.
[This is currently buggy in versions 1.91 and below - the revisit to this function should include an optional 'return position' of item deleted]

%listclear (List Name)


Clears the list of all items.


List as of 1.91;
These are how the functions Should work.

List last modified 04/11/09


--------------------
~Life is all busy and stuff right now. - Car accident, lots of dr. appointments... Other stuff too. I still <3 StealthBot.net - - I'll be around.
Thinking about PMing me? Post it instead! CCX Forums | SnapNJacks Trivia Forums
IPB Image
IPB Image
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Closed TopicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 14th November 2019 - 01:56 PM
Skin by Andrea
Website Legal Information | Hosted by LunarPages