Creation/Dev/Script/Client: Difference between revisions

From Graal Bible
(reformat)
Line 535: Line 535:


===Graal 2D===
===Graal 2D===
* addtiledef(str prefix, str tilesetimage, int tilesettype)
{| border="1" cellpadding="2" width="100%"
* addtiledef2(str prefix, str tilesetimage, int x, int y)
| '''Name'''
* attachplayertoobj(int x, int y)
| '''Type'''
* callnpc(int npcindex, params...)
| '''Description'''
* callweapon(int weaponindex, params...)
|-
* commandtoserver(str text)
| addtiledef(str prefix, str tilesetimage, int tilesettype)
* detachplayer()
|
* disabledefmovement()
|
* disablemap()
|-
* disablepause()
| addtiledef2(str prefix, str tilesetimage, int x, int y)
* disableselectweapons()
|
* disableweapons()
|
* enabledefmovement()
|-
* enablefeatures(int flags)
| attachplayertoobj(int x, int y)
* enablemap()
|
* enablepause()
|
* enableselectweapons()
|-
* enableweapons()
| callnpc(int npcindex, params...)
* explodebomb(int bombindex)
|
* findani(str) - returns object
|
* findlevel(str levelfilename) - returns object
|-
* findplayer(str accountname) - returns object
| callweapon(int weaponindex, params...)
* findplayerbyid(int playerid) - returns object
|
* findweapon(str weaponname) - returns object
|
* freezeplayer(float seconds)
|-
* getimgheight(str imagefilename) - returns integer
| commandtoserver(str text)
* getimgwidth(str imagefilename) - returns integer
|
* getmapx(str levelname) - returns integer
|
* getmapy(str levelname) - returns integer
|-
* gettextheight(float, str, str) - returns integer
| detachplayer()
* gettextwidth(float, str, str, str) - returns integer
|
* getz(float x, float y) - returns float
|
* hideplayer(float seconds)
|-
* hidesword(float seconds)
| disabledefmovement()
* hitnpc(int, float, float, float)
|
* hitobjects(float, float, float)
|
* hitplayer(int, float, float, float)
|-
* lay2(str extraname, float x, float y)
| disablemap()
* loadmap(str mapfilename)
|
* noplayerkilling()
|
* onwall(float x, float y) - returns boolean
|-
* onwall2(float x, float y, float width, float height) - returns boolean
| disablepause()
* onwater(float x, float y) - returns boolean
|
* onwater2(float x, float y, float width, float height) - returns boolean
|
* play(str soundfilename)
|-
* play2(str, float, float, float)
| disableselectweapons()
* playlooped(str soundfilename)
|
* putleaps(int leapstype, float x, float y)
|
* removetiledefs(str prefix)
|-
* replaceani(str defaultaniname, str newaniname)
| disableweapons()
* resetfocus()
|
* say(int signindex)
|
* say2(str text)
|-
* screenx(float x, float y) - returns integer
| enabledefmovement()
* screeny(float x, float y) - returns integer
|
* setani(str aniname, str aniparams)
|
* setbeltcolor(str color)
|-
* setcoatcolor(str color)
| enablefeatures(int flags)
* seteffect(float r, float g, float b, float a)
|
* setfocus(float x, float y)
| Flags can comprise of:
* setgender(str gendername)
  {| border="0" cellpadding="2" width="100%"
* sethead(str imagefilename)
  | '''Value'''
* setletters(str imagefilename)
  | '''Description'''
* setmap(str, str, float, float)
  |-
* setminimap(str, str, float, float)
  | 1
* setmusicvolume(float, float)
  | M key (map)
* setplayerdir(str)
  |-
* setshield(str imagefilename, int shieldpower)
  | 2
* setshoecolor(str color)
  | P key (pause)
* setshootparams(str params)
  |-
* setskincolor(str color)
  | 4
* setsleevecolor(str color)
  | Q key (weapon select)
* setsword(str imagefilename, int swordpower)
  |-
* showstats(int statsflag)
  | 8
* spyfire(int x, int y)
  | S+A key combination for dropping items
* stopmidi()
  |-
* stopsound(str soundfilename)
  | 0x10
* takeplayercarry()
  | S+D key combination for switching weapons
* takeplayerhorse()
  |-
* testplayer(float x, float y) - returns integer
  | 0x20
* triggeraction(float x, float y, str dest, params...)
  | S+D key combination for switching weapons
* triggerserver(str dest, str params)
  |-
* updateboard(int x, int y, int width, int height)
  | 0x40
* updateratings(obj) - returns object - updates an array of {rating1,ratingdeviation1, rating2,ratingdeviation2, ...}, init them at 1500 and 350
  | TAB key (if disabled then you cannot switch to the chat field with TAB)
* worldx(float x, float y) - returns float
  |-
* worldy(float x, float y) - returns float
  | 0x80
* wraptext(int fontsize, str format, str text) - returns object
  | Display of chat text
* wraptext2(int, float, str, str) - returns object
  |-
  | 0x100
  | Display of the hearts over player heads
  |-
  | 0x200
  | Display of nicknames
  |-
  | 0x400
  | Toall/PM-icons on the minimap
  |-
  | 0x800
  | Right-click on players opens their profile
  |-
  | 0x1000
  | Emoticons (disable it if you want to do other stuff with control+keys)
  |-
  | 0x2000
  | Alt+5 for making snapshots  ''(deprecated)''
  |-
  | 0x4000
  | Alt+8/9 for zooming ''(deprecated)''
  |-
  | 0x8000
  | The logframe where savelog stuff is added
  |}
|-
| enablemap()
|
|
|-
| enablepause()
|
|
|-
| enableselectweapons()
|
|
|-
| enableweapons()
|
|
|-
| explodebomb(int bombindex)
|
|
|-
| findani(str) - returns object
|
|
|-
| findlevel(str levelfilename)
| object
|
|-
| findplayer(str accountname)
| object
|
|-
| findplayerbyid(int playerid)
| object
|
|-
| findweapon(str weaponname)
| object
|
|-
| freezeplayer(float seconds)
|
|
|-
| getimgheight(str imagefilename)
| integer
|
|-
| getimgwidth(str imagefilename)
| integer
|
|-
| getmapx(str levelname)
| integer
|
|-
| getmapy(str levelname)
| integer
|
|-
| gettextheight(float, str, str)
| integer
|
|-
| gettextwidth(float, str, str, str)
| integer
|
|-
| getz(float x, float y)
| float
|
|-
| hideplayer(float seconds)
|
|
|-
| hidesword(float seconds)
|
|
|-
| hitnpc(int, float, float, float)
|
|
|-
| hitobjects(float, float, float)
|
|
|-
| hitplayer(int, float, float, float)
|
|
|-
| lay2(str extraname, float x, float y)
|
|
|-
| loadmap(str mapfilename)
|
|
|-
| noplayerkilling()
|
|
|-
| onwall(float x, float y)
| boolean
|
|-
| onwall2(float x, float y, float width, float height)
| boolean
|
|-
| onwater(float x, float y)
| boolean
|
|-
| onwater2(float x, float y, float width, float height)
| boolean
|
|-
| play(str soundfilename)
|
|
|-
| play2(str, float, float, float)
|
|
|-
| playlooped(str soundfilename)
|
|
|-
| putleaps(int leapstype, float x, float y)
|
|
|-
| removetiledefs(str prefix)
|
|
|-
| replaceani(str defaultaniname, str newaniname)
|
|
|-
| resetfocus()
|
|
|-
| say(int signindex)
|
|
|-
| say2(str text)
|
|
|-
| screenx(float x, float y)
| integer
|
|-
| screeny(float x, float y)
| integer
|
|-
| setani(str aniname, str aniparams)
|
|
|-
| setbeltcolor(str color)
|
|
|-
| setcoatcolor(str color)
|
|
|-
| seteffect(float r, float g, float b, float a)
|
|
|-
| setfocus(float x, float y)
|
|
|-
| setgender(str gendername)
|
|
|-
| sethead(str imagefilename)
|
|
|-
| setletters(str imagefilename)
|
|
|-
| setmap(str, str, float, float)
|
|
|-
| setminimap(str, str, float, float)
|
|
|-
| setmusicvolume(float, float)
|
|
|-
| setplayerdir(str)
|
|
|-
| setshield(str imagefilename, int shieldpower)
|
|
|-
| setshoecolor(str color)
|
|
|-
| setshootparams(str params)
|
|
|-
| setskincolor(str color)
|
|
|-
| setsleevecolor(str color)
|
|
|-
| setsword(str imagefilename, int swordpower)
|
|
|-
| showstats(int statsflag)
|
|
|-
| spyfire(int x, int y)
|
|
|-
| stopmidi()
|
|
|-
| stopsound(str soundfilename)
|
|
|-
| takeplayercarry()
|
|
|-
| takeplayerhorse()
|
|
|-
| testplayer(float x, float y)
| integer
|
|-
| triggeraction(float x, float y, str dest, params...)
|
|
|-
| triggerserver(str dest, str params)
|
|
|-
| updateboard(int x, int y, int width, int height)
|
|
|-
| updateratings(obj)
| object
| Updates an array of {rating1,ratingdeviation1, rating2,ratingdeviation2, ...}, init them at 1500 and 350
|-
| worldx(float x, float y) - returns float
|
|
|-
| worldy(float x, float y) - returns float
|
|
|-
| wraptext(int fontsize, str format, str text)
| object
|
|-
| wraptext2(int, float, str, str)
| object
|
|}


===Graal 3D===
===Graal 3D===

Revision as of 13:33, 2 February 2006

Client Supported Script Features

Settings

Name Type Description
$camera::movementspeed float
$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::graal::allowglobalpms boolean
$pref::graal::automapping boolean
$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::terrain::enabledetails boolean
$pref::video::detailfactor float
$pref::video::fogdistance float
$pref::video::fullscreenmode string
$pref::video::screenshotformat string
$pref::video::visibledistance float
$pref::video::windowmode string
$scenelighting::lightingprogress float (read only)

Variables

Name Type Description
allfeatures integer (read only) A bitflag of all features currently enabled
allplayerscount integer (read only)
allstats integer (read only) A bitflag of all stats currently enabled
canspin boolean (read only)
carriesblackstone boolean (read only)
carriesbush boolean (read only)
carriesnpc boolean (read only)
carriessign boolean (read only)
carriesstone boolean (read only)
carriesvase boolean (read only)
downloadfile string (read only)
downloadpos integer (read only)
downloadsize integer (read only)
editingmission boolean
emoticonchar string (read only)
focusx float (read only)
focusy float (read only)
graalversion float (read only) Graal version
gravity float
iscarrying boolean (read only)
isfocused boolean (read only)
isgraal3d boolean (read only)
isleader boolean (read only)
isonmap boolean (read only)
lastdownloadfile string (read only)
leftmousebutton boolean (read only)
levelorgx float (read only)
levelorgy float (read only)
lighteffectsenabled boolean (read only)
middlemousebutton boolean (read only)
mousebuttons integer (read only)
mousescreenx integer X coordinate of the mouse on the GUI layer
mousescreeny integer Y coordinate of the mouse on the GUI layer
mousewheeldelta integer (read only)
mousex float X coordinate of the mouse on the tile layer
mousey float Y coordinate of the mouse on the tile layer
musiclen integer (read only)
musicpos integer (read only)
rightmousebutton boolean (read only)
screenheight integer (read only) Height of the Graal window
screenwidth integer (read only) Width of the Graal window
scriptedcontrols boolean (read only)
scriptedplayerlist boolean (read only)
selectedlistplayers object
selectedsword integer
selectedweapon integer
servername string (read only) Name of the current server
serverstartconnect string
serverstartparams string
shotbybaddy boolean (read only)
shotbyplayer boolean (read only)
showterraingrid boolean
timevar integer (read only)
timevar2 float (read only)
wasshooted boolean (read only)
waterheight float
weapons object (read only) An array of weapon objects
weaponsenabled boolean Are weapons enabled? (Player can trigger onWeaponFired...)
worldclockstopped boolean
worldhour integer
worldminute float
worldminutesofday float
worldrealsecondsperday float

Functions

Note: Currently this doesn't list the functions which are optimized at compile time, see Starting Guide: Standard functions for those.

  • aindexof(float, obj) - returns integer
  • echo(str text)
  • getbasepackage() - returns object
  • getdisplaydevicelist() - returns string
  • getdownloadedupdatepackagesize() - returns integer
  • getdownloadingpackage() - returns object
  • getdownloadingpackagescount() - returns integer
  • gethttprequest(str, int, str) - returns THTTPRequest object
  • getkeycode(str keyname) - returns integer
  • getpackagesdownloadcomplete() - returns boolean
  • getpackagesdownloaded() - returns boolean
  • getplatform() - returns string
  • getresolutionlist(str) - returns string
  • getservername() - returns string
  • gettotalupdatepackagesize() - returns integer
  • getupdatepackage(str) - returns object
  • isadminguild(str guildname) - returns boolean
  • isdevicefullscreenonly(str devicename) - returns boolean
  • isobject(str objectname) - returns boolean
  • keydown(int keycode) - returns boolean
  • keydown2(int keycode, bool ignorecase) - returns boolean
  • keyname(int keycode) - returns string
  • opengraalurl(str url)
  • openurl(str url)
  • openurl2(str url, int width, int height)
  • requesthttp(str, int, str) - returns THTTPRequest object
  • requestmysql(str, str, str, str, str) - returns object
  • requesttext(str, str)
  • requesturl(str url) - returns THTTPRequest object
  • savelog(str text)
  • sendrpgmessage(str text)
  • sendtext(str, str, params...)
  • sendtorc(str text)
  • serverwarp(str serverunixname)
  • synctimeofday(float, float)

Common

Files

  • extractfilebase(str filepath) - returns string, '/an/example/path/and/file' would return '/an/example/path/and/'
  • extractfileext(str filepath) - returns string, 'filename.ext' would return '.ext'
  • extractfilename(str filepath) - returns string, '/an/example/path/and/file' would return 'file'
  • extractfilepath(str filepath) - returns string, '/an/example/path/and/file' would return '/an/example/path/and/'
  • fileexists(str filepath) - returns boolean, checks if a file exists
  • filesize(str filepath) - returns integer, returns the size of a file
  • fileupdate(str filepath) - returns boolean
  • findfiles(str, int) - returns object
  • findfirstfile(str) - returns string
  • findnextfile(str) - returns string
  • getextension(str filepath) - returns string, 'filename.ext' would return '.ext'
  • reloadfile(str filepath)
  • requestfiledeletion(str filepath), requests a file to be deleted on the server
  • requestfilerename(str filepath, str newfilepath), requests a file to be renamed on the server
  • requestfilesmove(str filepath, str newfilepath), requests a file to be moved on the server
  • selectfilefordownload(str filter)
  • selectfileforupload()

Watch the TGraalVar object for loading and saving of files (loadlines etc.)

Math

  • degtorad(float value) - returns float
  • radtodeg(float value) - returns float
Matrices
  • matrixcreate(str, str) - returns string
  • matrixcreatefromeuler(str) - returns string
  • matrixmulpoint(str, str) - returns string
  • matrixmultiply(str, str) - returns string
  • matrixmulvector(str, str) - returns string
Vectors
  • vectoradd(str, str) - returns string
  • 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

Strings

  • base64decode(str text) - returns decoded string
  • base64encode(str text) - returns encoded string
  • checksum(str text) - returns checksum float
  • contains(str haystack, str needle) - returns boolean, you should probably do haystack.contains(needle) instead
  • getascii(str character) - returns ascii value integer
  • getstringkeys(str) - returns object
  • lowercase(str text) - returns lowercased string
  • md5(str tet) - returns md5 hash string
  • randomstring(str) - returns string
  • strcmp(str text1, str text2) - returns integer
  • strequals(str text1, str text2) - returns boolean, you probably should do text1.equals(text2) instead
  • uppercase(str text) - returns uppercased stringg

GUI

  • addcontrol(obj)
  • cursoroff()
  • cursoron()
  • iscursoron() - returns boolean
  • popdialog()
  • pushdialog(obj)
  • setcontentcontrol(obj)
  • setcursor2(str imagefilename)

Graal 2D

Name Type Description
addtiledef(str prefix, str tilesetimage, int tilesettype)
addtiledef2(str prefix, str tilesetimage, int x, int y)
attachplayertoobj(int x, int y)
callnpc(int npcindex, params...)
callweapon(int weaponindex, params...)
commandtoserver(str text)
detachplayer()
disabledefmovement()
disablemap()
disablepause()
disableselectweapons()
disableweapons()
enabledefmovement()
enablefeatures(int flags) Flags can comprise of:
Value Description
1 M key (map)
2 P key (pause)
4 Q key (weapon select)
8 S+A key combination for dropping items
0x10 S+D key combination for switching weapons
0x20 S+D key combination for switching weapons
0x40 TAB key (if disabled then you cannot switch to the chat field with TAB)
0x80 Display of chat text
0x100 Display of the hearts over player heads
0x200 Display of nicknames
0x400 Toall/PM-icons on the minimap
0x800 Right-click on players opens their profile
0x1000 Emoticons (disable it if you want to do other stuff with control+keys)
0x2000 Alt+5 for making snapshots (deprecated)
0x4000 Alt+8/9 for zooming (deprecated)
0x8000 The logframe where savelog stuff is added
enablemap()
enablepause()
enableselectweapons()
enableweapons()
explodebomb(int bombindex)
findani(str) - returns object
findlevel(str levelfilename) object
findplayer(str accountname) object
findplayerbyid(int playerid) object
findweapon(str weaponname) object
freezeplayer(float seconds)
getimgheight(str imagefilename) integer
getimgwidth(str imagefilename) integer
getmapx(str levelname) integer
getmapy(str levelname) integer
gettextheight(float, str, str) integer
gettextwidth(float, str, str, str) integer
getz(float x, float y) float
hideplayer(float seconds)
hidesword(float seconds)
hitnpc(int, float, float, float)
hitobjects(float, float, float)
hitplayer(int, float, float, float)
lay2(str extraname, float x, float y)
loadmap(str mapfilename)
noplayerkilling()
onwall(float x, float y) boolean
onwall2(float x, float y, float width, float height) boolean
onwater(float x, float y) boolean
onwater2(float x, float y, float width, float height) boolean
play(str soundfilename)
play2(str, float, float, float)
playlooped(str soundfilename)
putleaps(int leapstype, float x, float y)
removetiledefs(str prefix)
replaceani(str defaultaniname, str newaniname)
resetfocus()
say(int signindex)
say2(str text)
screenx(float x, float y) integer
screeny(float x, float y) integer
setani(str aniname, str aniparams)
setbeltcolor(str color)
setcoatcolor(str color)
seteffect(float r, float g, float b, float a)
setfocus(float x, float y)
setgender(str gendername)
sethead(str imagefilename)
setletters(str imagefilename)
setmap(str, str, float, float)
setminimap(str, str, float, float)
setmusicvolume(float, float)
setplayerdir(str)
setshield(str imagefilename, int shieldpower)
setshoecolor(str color)
setshootparams(str params)
setskincolor(str color)
setsleevecolor(str color)
setsword(str imagefilename, int swordpower)
showstats(int statsflag)
spyfire(int x, int y)
stopmidi()
stopsound(str soundfilename)
takeplayercarry()
takeplayerhorse()
testplayer(float x, float y) integer
triggeraction(float x, float y, str dest, params...)
triggerserver(str dest, str params)
updateboard(int x, int y, int width, int height)
updateratings(obj) object Updates an array of {rating1,ratingdeviation1, rating2,ratingdeviation2, ...}, init them at 1500 and 350
worldx(float x, float y) - returns float
worldy(float x, float y) - returns float
wraptext(int fontsize, str format, str text) object
wraptext2(int, float, str, str) object

Graal 3D

  • addmaterialmapping(str, str) - returns boolean
  • getboxcenter(str) - returns string
  • getdatablocktypes() - returns object
  • getobjectat(float, float) - returns object
  • getobjectatmouse() - returns object
  • getobjectbyray(str, str) - returns object
  • getsurfacetype(float, float) - returns string
  • lightscene() - returns boolean
  • mapshapeanimation(str, str, str, float) - returns boolean
  • setfogcolors(obj)
  • setinteriorrendermode(int)
  • setshadowdetaillevel(float)
  • setskybandcolors(obj)
  • setskybandsizes(obj)
  • setsuncolors(obj)
  • setterrainrendermode(int)
  • updateterrain()
  • updatevisibledistance()

Other

  • adventure_installgraal(str, bool, bool)
  • adventure_openexternaloptions() - returns boolean
  • adventure_openexternalpm(obj) - returns boolean
  • adventure_openserverlist()
  • adventure_quit()
  • adventure_savegraaloptions()
  • adventure_selectpath(str) - returns object
  • adventure_setaccountname(str)
  • adventure_setchat(str)
  • adventure_setnickname(str)
  • adventure_setpassword(str)
  • adventure_startofflinemode()
  • adventure_updateaccountfield()
  • adventure_updatemicroactivationlevel()
  • adventure_updatemidivolume()
  • adventure_updatemp3volume()
  • adventure_updateplayermuted()
  • adventure_updateplayerprofile(bool, str, str, int, str, str, str, str, str, str)
  • adventure_updateradiovolume()

(these functions are only available to privileged scripts from the Login server)

Classes / Object Types