Creation/Dev/Script/Clientside Functions

From Graal Bible
Revision as of 20:17, 19 September 2011 by Tolnaftate2004 (talk | contribs) (→‎Functions: links)
[R] denotes it is read-only.
[3D] denotes it is a Graal3D function.
[opengl] denotes it is functional only in opengl mode.


Variables

Variable Type Notes
allfeatures integer [R]
allplayerscount integer [R] Returns the count of all players on your playerlist, including IRC bots.
allrenderobjecttypes integer [R]
allstats integer [R] Used with showstats() in order to show all stats.
canspin boolean [R] Returns true of false if the player has spin attack.
carriesblackstone boolean [R] Returns whether the player is carrying a black stone.
carriesbush boolean [R] Returns whether the player is carrying a bush.
carriesnpc boolean [R] Returns whether the player is carrying an NPC
carriessign boolean [R] Returns whether the player is carrying a sign.
carriesstone boolean [R] Returns whether the player is carrying a stone.
carriesvase boolean [R] Returns whether the player is carrying a vase.
downloadfile string [R] Returns the currently downloaded file.
downloadpos integer [R] Returns the position of the currently downloaded file.
downloadsize integer [R] Returns the size of the currently downloaded file.
editingmission boolean
emoticonchar string [R]
focusx float [R] Position of the camera in tile units.
focusy float [R] Position of the camera in tile units.
ghostsnear boolean [R] If a ghost(observer) is in the same level as the player.
graalplugincookie string [R]
graalversion float [R] Version of Graal the player is using.
gravity float The gravity value that effects how fast projectiles fall. It universally effects all projectiles.
installedlanguages string [R]
isapplicationactive boolean [R] Is Graal window active?
iscarrying boolean [R] Returns true of false if the player is carrying something.
isfocused boolean [R]
isgraal3d boolean [R]
isgraalplugin boolean [R]
isleader boolean [R] Player was the first to enter the level.
isonmap boolean [R] Player is on a map.
isopengl boolean [R] Graal is in opengl mode.
isrecordingvideo boolean [R] Player is currently recording(alt+6) Graal.
jpegquality integer
isgraalplugin boolean [R]
lastdownloadfile string [R] The last file downloaded.
leftmousebutton boolean [R] If the left mouse button is pressed.
leftmousebuttonglobal boolean [R] If the left mouse button is pressed. Returns whether mouse is in focus of GUIs or not.
levelorgx float [R]
levelorgy float [R]
lighteffectsenabled boolean Whether the player has their lights enabled via options.
middlemousebutton boolean [R] If the middle mouse button is pressed
middlemousebuttonglobal boolean [R] If the middle mouse button is pressed. Returns whether mouse is in focus of GUIs or not.
mousebuttons integer [R]
mousebuttonsglobal integer [R]
mousepitch float [R] [3D]
mousescreenx integer Position of the mouse in the Graal screen, in pixel units on the x-axis.
mousescreeny integer Position of the mouse in the Graal screen, in pixel units on the y-axis.
mousewheeldelta integer [R] How much the mouse wheel has been scrolled.
mousex float Position of the mouse in the level, in tile units, on the x-axis.
mousey float Position of the mouse in the level, in tile units, on the y-axis
mouseyaw float [R] [3D]
musiclen integer [R] Length of current playing MP3
musicpos integer [R] Position of current playing MP3
particleeffectsenabled boolean If player has particles enabled in their options.
rightmousebutton boolean [R] If the right mouse button is pressed
rightmousebuttonglobal boolean [R] If the right mouse button is pressed. Returns whether mouse is in focus of GUIs or not.
screenheight integer [R] Height of the Graal screen in pixel units.
screenwidth integer [R] Width of the Graal screen in pixel units.
scriptedcontrols boolean [R]
scriptedplayerlist boolean [R] Whether the player has the scripted playerlist enabled.
scriptlogwritetoreadonly boolean
selectedlistplayers object An object of all players selected on the playerlist.
selectedsword integer
selectedweapon integer Index of the currently selected weapon.
servername string [R] Name of the server.
serverstartconnect string
serverstartparams string
shotbybaddy boolean [R] If the player is shot by a baddy(default) arrow.
shotbyplayer boolean [R] If the player is shot by another players arrow.
showterraingrid boolean
spritesimage string Filename of the currently set sprite image.
statusimage string Filename of the currently set state image.
timevar integer [R].
timevar2 float [R]
timevar3 float [R] [3D] Synchronized time which works on both server and client-side, precision is milliseconds.
wasshooted boolean [R] If the player is shot by a default arrow.
waterheight float
weapons object [R] all the players weapons, this includes login inherited weapons.
weaponsenabled boolean If the players weapons are enabled via disableweapons()/enableweapons().
weathereffectsenabled boolean If weather is enabled in the players options.
worldclockstopped boolean
worldhour integer
worldminute float
worldminutesofday float
worldrealsecondsperday float


Functions

Function Type Notes
addcontrol(object) adds 'object' to the parent control.
addmaterialmapping(string, string) [3D] returns boolean.
addtiledef(string image, string prefix, int format) Adds a tileset definition with the supplied tileset image, level prefix and tileset format (0=pics1, 1=new world, 5=terrain).
addtiledef2(string image, string prefix, int x, int y) Overlays an image on the tileset with the supplied tileset image and level prefix. Parameters 'x' and 'y' represent the x and y position on the tileset of where to place the new image.
aindexof(float, array) Returns integer - the position of 'float' in the array.
arccos(float) Returns float - the arc cosine of 'float'.
arcsin(float) Returns float - the arc sine of 'float'.
attachplayertoobj(integer1, integer2) Attaches the player to the object with the matching ID where integer1 is the object type (currently only NPCs - 0) and integer2 is the ID of the desired object.
base64decode(string) Returns string - Decodes a base64 string.
base64encode(string) Returns string - Encodes string in to several characters of a 64 printable character set (A-Z, a-z, 0-9, + and /, while "=" is a special suffix code)
boxcontains(string, string) returns boolean.
boxcontainsvector(string, string) returns boolean
boxintersect(string, string) returns string
boxoverlaps(string, string) returns boolean
boxscale(string, string) returns string
callnpc(int index, string function) Calls a function from an NPC where 'index' is the NPC's index and 'function' is the function name.
callweapon(int index, string function) Calls a function from a weapon where 'index' is the weapon's index and 'function' is the function name.
castray({x,y,x}, {x,y,z}, string type) [3D] returns object - specify the start and end of the ray, and the object types (e.g. "staticts,terrain,interior")
checksum(string) returns float
contains(string2, string1) returns boolean - True if string1 is contained within string2.
copystrings(string, string)
cursoroff() [opengl] Disables the visible mouse cursor.
cursoron() [opengl] Enables the visible mouse cursor.
degtorad(float) returns float - Converts angle measurements of degrees to radians
detachplayer() Detaches a player from an attached object.
disabledefmovement() Disables the default movement system and controls(including weapons, sword, grab. Does not include Q-menu, pause, map...).
disablemap() Disables the default map (M).
disablepause() Disables the default pause (P).
disableselectweapons() Disables the default Q-menu (Q).
disableweapons() Disables the default sword (S) and weapons (D).
echo(string) echos 'string' to the debug window(F2).
enabledefmovement() Enables the default movement system.
enablefeatures(int)
enablemap() Enables the default map system(M).
enablepause() Enables the default pause system(P).
enableselectweapons() Enables the default Q-menu(Q).
enableweapons() Enables the default sword(S) and weapons(D).
escapestring(string) returns string - adds \\ in front of ", ' and \\, and removes non-printable characters
explodebomb(integer) explodes the bomb with the id of 'integer'.
extractfilebase(string) returns string
extractfileext(string) Takes in a file name, and returns its extension.
extractfilepath(string) returns string
fileexists(string) returns boolean of whether the file 'str' exists in the players Graal/ directory(does not search subfolders).
filesize(string) Returns the size(int) of the file 'string' in the players Graal/ directory(does not search subfolders).
fileupdate(string) returns boolean
findani(string) returns object
findfiles(string, integer) returns object
findlevel(string) returns object
findnearestplayer(float1, float2) Returns the closest player's object relevant to float1 and float2.
findnearestplayers(float, float) Returns the closest players' object relevant to float1 and float2.
findnpcbyid(integer) Returns the NPC object with the ID of 'int'.
findpathinarray(obj1, obj2, obj3, obj4, obj5, int, int, int) Returns object - Simple path-finding: Obj1 being tiles that allow walking, Obj2 being tiles that don't allow walking, Obj3; tiles that shouldn't be allowed to walked on, Obj4; tiles that are able to be walked on, Obj5; tiles where we may stop. Integers are relevant to the startx, starty and maximum path length. - Arrays for allowed/non-allowed tiles are only checked if they aren't null.
findplayer(string) Returns the player object with the account equal to string.
findplayerbycommunityname(string) Returns the player object with the community name equal to string.
findplayerbyid(integer) Returns the player object with the ID equal to integer.
findweapon(string) Returns the weapon object with the name equal to string.
format(string, string, ...) See format().
format2(string, array) Like format(), except that this expects the format string and an array of variables instead of passing the variables as separate parameters.
freefileresources(string)
freezeplayer(float) Freezes the player for the number of seconds specified by float.
get3dobjectat(float, float, boolean) [3D] Gets the 3d object at the specified screen position, third parameter true if it should do box collision.
get3dobjectatmouse(boolean) [3D] Gets the 3d object at the mouse. Parameter true if it should do box collision.
get3dobjectbyray(string, string) [3D] returns object
get3dobjectsbybox(string, string) [3D] 1st parameter defines the box {minx,miny,minz, maxx,maxy,maxz}. Second parameter specifies the type of object to find (e.g. "staticts,terrain,interior")
get3dscreenposition(string, boolean) [3D] returns string
getanglesfromvector({x, y, z}) Returns an array that contains the angles the 3D vector {x, y, z} makes with the X-Y and X-Z axes.
getascii(string) Returns the ascii code for string.
getbasepackage() returns object
getboxcenter(string) Returns an array containing the center of a 3D box specified by string ({x0,y0,z0,x1,y1,z1,...}).
getdesktopresolution() returns string
getdisplaydevicelist() returns string
getdownloadedupdatepackagesize() Returns the size of the downloaded update package.
getdownloadingpackage() Returns a reference to current update package being downloaded.
getdownloadingpackagescount() Returns a count of the number of update packages to download.
getdropz(string) returns float
getExtension(string) This function is the same as extractFileExt(). Takes in a file name, and returns its extension.
getfilemodtime(string) Returns a timestamp of when the file was last modified (in unix time compatible to timevar2). This function accepts both exact file path and plain file name.
gethttprequest(string, integer, string) returns object (This function is the same as requestHttp())
getimgheight(string) Returns the height (in pixels) of the filename indicated by string.
getimgpixel(string, integer, integer) returns object
getimgwidth(string) Returns the width(in pixels) of the filename indicated by string.
getkeycode(string) Returns the keycode of the key indicated by string. The keycode returned can be used in keydown2().
getloginaccountname() Presumably used for the login server. Use player.account instead.
getmapx(string) Gets the x coordinate location in the gmap of the level indicated by string. The top-left level starts at (0, 0).
getmapy(string) Gets the y coordinate location in the gmap of the level indicated by string. The top-left level starts at (0, 0).
getmusicfilename() Returns the filename of the music currently playing.
getmusicstatus() Returns the status of the music currently playing.
getmusictags() Returns the tags of the music currently playing. This function can be used to retrieve the title and artist info of the music.
getnearestplayer(float, float) Deprecated. Use findnearestplayer() instead.
getnearestplayers(float, float) Deprecated. Use findnearestplayers() instead.
getpackagesdownloadcomplete() Returns 'true' if the package downloads are complete.
getpackagesdownloaded() Returns 'true' if the most recent packages are already downloaded.
getplatform() Returns the platform that the player is using. (i.e. windows, mac, or linux)
getresolutionlist(string) returns string
getservername() Returns the name of the server the player is currently connected to.
getstringkeys(string) Returns an array of the variables that begins with the supplied string.
getterraintexture(float, float) returns string
getterraintextureindex(float, float) returns integer
gettextheight(float zoom, string style, string font) returns integer - The height in pixels of the text with the given zoom, style and font.
gettextwidth(float zoom, string style, string font, string text) returns integer - The width of the text with the given zoom, style, font and text.
gettileset() returns string - the current main tileset (pics1.png, picso.png etc.)
gettilesettype() returns integer - the current tileset type (pics1.png:0, picso.png:5 etc.)
gettotalupdatepackagesize() returns integer - The total size of the update packages.
getupdatepackage(string name) returns object - A reference to the update package with the given name.
getvectorfromangles(float, float) returns string
getz(float, float) returns float
graalcontrolhasfocus(bool) returns boolean - Whether or not the graal control has focus. Parameter says if it should also check if the chat bar has the focus
hideplayer(float time) Hides player for the specified amount of time.
hidesword(float time) Hides the player's sword for the specified amount of time.
hitnpc(int index, float halfhearts, float fromx, float fromy) Hit's npc with specified index causing the specified amount of halfhearts in damage. It also knocks back the npc based on the from X and Y coordinate passed to it.
hitobjects(float power, float x, float y) Hurts all the npcs with the specified power on the position passed to it.
hitplayer(int index, float halfhearts, float fromx, float fromy) Hit's player with specified index causing the specified amount of halfhearts in damage. It also knocks back the player based on the from X and Y coordinate passed to it. Use 0 as the index to hit your own player.
isadminguild(str guildname) returns boolean - If the passed guildname is an admin guild or not.
isclassloaded(str classname) returns boolean - If the passed classname is loaded for the client.
iscursoron() returns boolean - If the cursor is on or not.
isdevicefullscreenonly(str device) returns boolean - If the device is full screen only or not.
isdownloading(str filename) returns boolean - If a file is currently downloaded or requested from the server.
isdownloadingfiles() returns boolean - checks if Graal is currently downloading or requesting files from the server.
isfullscreenmode() returns boolean - checks if Graal is currently in fullscreen mode.
isimgrectangletransparent(str, int, int, int, int) returns boolean
ismusicplaying() returns boolean
isobject(str) returns boolean
issoundplaying(str) returns boolean
keydown(int) returns boolean
keydown2(int, bool) returns boolean
keydown2global(int, bool) returns boolean
keydownglobal(int) returns boolean
keyname(int) returns string
lay2(str, float, float)
lightscene() returns boolean
loadclass(str)
loadmap(str)
loadtranslation(str)
lowercase(str) returns string
ltmfs(bool)
ltmmax(float, float)
ltmmin(float, float)
makescreenshot2(str, int, float, float, float, int, int)
matrixcreate(str, str) returns string
matrixcreatefromeuler(str) returns string
matrixmulpoint(str, str) returns string
matrixmultiply(str, str) returns string
matrixmulvector(str, str) returns string
md5(str) returns string
noplayerkilling()
onwall(float, float) returns boolean
onwall2(float, float, float, float) returns boolean
onwater(float, float) returns boolean
onwater2(float, float, float, float) returns boolean
opengraalurl(str)
openurl(str)
openurl2(str, int, int)
play(str)
play2(str, float, float, float)
play3d(str, bool, str, str)
playlooped(str)
playlooped2(str, float, float, float)
popdialog()
pushdialog(obj)
putleaps(int, float, float)
radtodeg(float) returns float
randomstring(str) returns string
removetiledefs(str)
replaceani(str, str)
requestfiledeletion(str)
requestfilerename(str, str)
requestfilesmove(str, str)
requesthttp(str, int, str) returns object
requesttext(str, str)
requesturl(str) returns object
resetfocus()
rotationadd(str, str) returns string
rotationaddeuler(str, str) returns string
rotationfromeuler(str) returns string
rotationsub(str, str) returns string
rotationtoeuler(str) returns string
rungarbagecollector()
savelog(str)
say(int)
say2(str)
screenx(float, float) returns integer
screeny(float, float) returns integer
selectfilefordownload(str) opens the select
selectfileforupload() opens the select
sendrpgmessage(str)
sendtext(str, str, params...)
sendtorc(str)
serverwarp(str)
setani(str, str)
setbeltcolor(str)
setcoatcolor(str)
setcontentcontrol(obj)
setcursor2(str)
seteffect(float, float, float, float)
setfocus(float, float)
setfogcolors(obj)
setgender(str)
sethead(str)
setinteriorrendermode(int)
setletters(str)
setmap(str, str, float, float) sets a text map (you can see the tiles of other levels but not the npcs), parameters are text file with level names, the map image (not used anymore), default x and y for the head icons; use gmaps if possible instead of this
setminimap(str, str, float, float) parameters are a text file with level names, the image, default x and y; use gmaps if possible instead of this
setmusicvolume(float, float)
setplayerdir(str)
setshield(str, int)
setshoecolor(str)
setshootparams(str)
setskincolor(str)
setskybandcolors(obj)
setskybandsizes(obj)
setsleevecolor(str)
setspritesimage(str)
setstatusimage(str)
setsuncolors(obj)
setsword(str, int)
setterrainrendermode(int)
showstats(int)
spyfire(int, int)
startrecordvideo() returns boolean
stopmidi() same as stopmusic(), kept for compatibility
stopmusic()
stoprecordvideo() returns boolean
stopsound(str)
strcmp(str, str) returns integer
strequals(str, str) returns boolean
switchtoopengl()
synctimeofday(float, float)
takeplayercarry()
takeplayerhorse()
testplayer(float, float) returns integer
trace(str) same as echo()
triggeraction(float, float, str, params...)
triggerserver(str, str)
update3dterrain(float, float, float, float)
updateboard(int, int, int, int)
updateterrain()
updatevisibledistance()
uploadfile(str) uploads a file, you must provide the full path provided by a onDropFiles() event, also this will only work if the scripted RC has currently a file browser window open; once the file is uploaded an onFilesUploaded event will be invoked
uppercase(str) returns string
vectoradd(str, str) returns string
[[Cross Product|vectorcross(str, str)] returns string
vectordist(str, str) returns float
vectordot(str, str) returns float
vectorlen(str) returns float
vectornormalize(str) returns string
vectororthobasis(str) returns string
vectorscale(str, float) returns string
vectorsub(str, str) returns string
worldx(float, float) returns float
worldy(float, float) returns float
wraptext(int, str, str) returns object
wraptext2(int, float, str, str) returns object


Objects

Object Navigation


GUI Objects

GUI Objects are currently well documented starting here Creation/Dev/Script/Client/GuiControl.

Preference Variables

Variable Type Notes
$pref::audio::choosenvoicecodec integer
$pref::audio::microactivatebyvolume boolean
$pref::audio::microactivationlevel integer
$pref::audio::microinputdevice integer
$pref::audio::microon boolean
$pref::audio::microvolumefactor integer
$pref::audio::midivolume integer
$pref::audio::mp3volume integer
$pref::audio::radiovolume integer
$pref::audio::reversestereo boolean
$pref::audio::sfxvolume integer
$pref::audio::voicevolume integer
$pref::capture::allowbyscript boolean [R]
$pref::capture::area string
$pref::capture::audiobitrate integer
$pref::capture::disabledaynight boolean
$pref::capture::format string
$pref::capture::fps integer
$pref::capture::hideinterface boolean
$pref::capture::recordaudio boolean
$pref::capture::showmouse boolean
$pref::capture::size string
$pref::capture::videobitrate integer
$pref::graal::allowglobalpms boolean
$pref::graal::automapping boolean
$pref::graal::defaultfontname string
$pref::graal::defaultfontsize integer
$pref::graal::dontconnectlevels boolean
$pref::graal::dontloadlistheads boolean
$pref::graal::dontsavepasswords boolean
$pref::graal::dontsavepms boolean
$pref::graal::fixedport boolean
$pref::graal::fixedudpport integer
$pref::graal::language string
$pref::graal::limitnicknames boolean
$pref::graal::loadbuddylistfromserver boolean
$pref::graal::nicknamelimit integer
$pref::graal::nomassmessages boolean
$pref::graal::notoalls boolean
$pref::graal::noudp boolean
$pref::graal::showyourselfonbuddylists boolean
$pref::input::mousesensitivity float
$pref::interior::lockarrays boolean
$pref::video::defaultguistyle string
$pref::video::detailfactor float
$pref::video::fogdistance float
$pref::video::fullscreenmode string
$pref::video::resolution integer
$pref::video::screenshotformat string
$pref::video::visibledistance float
$pref::video::windowmode string