Graal Forums

Graal Forums (http://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (http://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Script events (http://forums.graalonline.com/forums/showthread.php?t=85749)

Skyld 05-26-2009 05:52 PM

Script events
 
You might find the following list of clientside script events useful:
HTML Code:

Global:
  onClassLoaded(str) - a class script has been updated: name of the class
  onConnectingToServer(str, str, int) - connecting to: servername, address, port
  onDefaultStyleChanges(str) - the $pref::Video::defaultguistyle has been changed
  onFileChunkReceived(str, int, int) - file download progress: filename, current position, full size
  onFileDownloaded(str, int) - a game file has been downloded: filename, size
  onFilesUploaded() - finished uploading all files to the file browser
  onFirstResponderChanges(obj) - the control that received the keyboard input changed
  onFolderLog(str) - scripted RC file browser message
  onLevelFileUpdated(str) - a game file has been updated: filename
  onLogMessage(str, float, float, float, str) - log message: text, red, green, blue, log type
  onMapClick(obj) - clicked on a player on the map: player object
  onMouseYawPitch(int, int) - the mouse moved in 3D mode: yaw and pitch
  onMusicDataReceived(str, str) - music meta data received: name and value
  onOfflineModeStarted() - the offline mode is started because there is no connection to the server
  onOpenHelpWindow() - the key for opening the help window (F1) has been pressed
  onOpenLogWindow() - the key for opening the log window (F2) has been pressed
  onOpenOptionsWindow() - the key for opening the options window (F3) has been pressed
  onOpenPlayerList() - the key for opening the player list (F7) has been pressed
  onOpenPlayerPositionWindow() - the key for opening the positon window (F5) has been pressed
  onOpenProfileWindow(obj) - right click on a player or call to showProfile() to open the profile window
  onOpenServerList() - the key for opening the serverlist (F8) has been pressed
  onPackagesDownloadComplete() - all update packages (.gupd files) have been downloaded
  onPackagesDownloaded() - some update packages (.gupd files) have been downloaded
  onPlayerChanges(obj, int) - the look of a player changed: player object and id
  onPlayerLanguageChanges(obj, str) - the language of the player has changed: player object, new language
  onPlayerLogin(obj, int) - a player logged in: player object and id
  onPlayerLogout(obj, int) - a player logged out: player object (might be NULL) and id
  onPM(obj) - received a PM from a player: player object
  onRCChat(str) - scripted RC chat: text
  onRemotePlayerChats(obj, str) - another player is saying something: player object, text
  onServerListerConnect() - a connection to the server-lister (central server) established
  onServerLogin() - logged into a server
  onToall(obj, str) - received a toall message: player object and message
  onTranslationUpdated(str) - a translation file (.po) has been updated
  onUpdatePackageDownloaded(obj) - downloaded an update package (.gupd): package object

  GuiControl (TGraalVar):
    onAction() - an action happened (e.g. button pressed)
    onAdd() - the control has been added as child to another control
    onDialogPop() - the control is no longer the dialog control (popDialog())
    onDialogPush() - the control is now the dialog control (pushDialog())
    onDropFiles(int, int, obj) - files dropped from explorer/finder to the control (acceptdropfiles must be true): x, y, filelist
    onHide() - the control is no longer visible on the screen
    onKeyDown(int, str, int) - a key has been pressed: keycode, keytext, scancode
    onKeyUp(int, str, int) - a key has been released: keycode, keytext, scancode
    onMouseDown(int, int, int, int) - mouse click: key modifiers, mouse x and y, click count
    onMouseDragged(int, int, int, int) - mouse moved while holding the mouse button down: key modifiers, mouse x and y, click count
    onMouseEnter(int, int, int, int) - mouse enters the area of the control: key modifiers, mouse x and y, click count
    onMouseLeave(int, int, int, int) - mouse leaves the are of the control: key modifiers, mouse x and y, click count
    onMouseMove(int, int, int, int) - mouse moved: key modifiers, mouse x and y, click count
    onMouseUp(int, int, int, int) - mouse button released: key modifiers, mouse x and y, click count
    onMouseWheelDown(int, int, int, int) - mouse wheel scrolled down: key modifiers, mouse x and y, click count
    onMouseWheelUp(int, int, int, int) - mouse wheel scrolled up: key modifiers, mouse x and y, click count
    onMove(int, int) - the control has been moved to x, y
    onRemove() - the control has been removed from its parent
    onResize(int, int) - the control has been resized to width, height
    onRightMouseDown(int, int, int, int) - right mouse click: key modifiers, mouse x and y, click count
    onRightMouseDragged(int, int, int, int) - mouse moved while holding the right mouse button down: key modifiers, mouse x and y, click count
    onRightMouseUp(int, int, int, int) - right mouse button released: key modifiers, mouse x and y, click count
    onShow() - the control becomes actually visible on the screen
    onSleep() - the control is not part of the screen anymore
    onStartDrag() - the user is moving the control
    onStopDrag(int, int, int, int) - stopped moving a control: key modifiers, mouse x and y, click count
    onStyleChanges() - the GUI style has changed
    onWake() - the control has been added to the screen

    GuiAnimationCtrl (GuiControl):
      onAnimationEnd(int) - finished moving: new entry index
      onAnimationStart(int, int) - started moving: current entry index, destination entry index

    GuiArrayCtrl (GuiControl):
      onOpenMenu(int, int, int, int) - right click on an entry: column, row, mouse x and y
      onSelect(int, int) - an entry has been selected: column and row

      GuiTextListCtrl (GuiArrayCtrl):
        onDblClick(int, str, int) - double click on a list entry: id, text, row
        onDeleteKey(int, str, int) - delete key pressed for an entry: id, text, row
        onIconResized(int, int) - the size of the icons has been changed: new width and height
        onMouseOverCell(int, str, int) - the mouse is hovering over a list entry: id, text, row
        onOpenMenu(int, str, int) - right-click on a list entry: id, text, row
        onSelect(int, str, int) - a list entry has been selected: id, text, row

      GuiTreeViewCtrl (GuiArrayCtrl):
        onDblClick(obj, str, str) - double-click on a node: node object, slash-path, dot-path
        onExpand(obj, str, str) - a node is expanding: node object, slash-path, dot-path
        onFold(obj, str, str) - a node is folded: node object: slash-path, dot-path
        onIconResized(int, int) - the size of the icons has been changed: new width and height
        onMouseOverCell(obj, str, str) - the mouse is hovering over a node: node object, slash-path, dot-path
        onOpenMenu(obj, str, str) - right click on a node: node object, slash-path, dot-path
        onSelect(obj, str, str) - a node is selected: node object, slash-path, dot-path

    GuiContextMenuCtrl (GuiControl):
      onCancel() - the menu has been closed without selecting an entry
      onSelect(int, str, int) - a menu entry has been selected: id, text and row

      GuiStartMenuCtrl (GuiContextMenuCtrl):
        onCancel() - the menu has been closed without selecting an entry
        onSelect(int, str, int) - a menu entry has been selected: id, text and row
        onTextChanged(str) - the menu text has been changed

    GuiMenuCtrl (GuiControl):
      onCancel() - the menu has been closed without selecting a menu entry
      onIconResized(int, int) - the size of the icons has been changed: new width and height
      onSelect(str, int, str, int) - a menu item has been selected: menu name, selection id, text and row

    GuiMLTextCtrl (GuiControl):
      onCursorLineChanged(int) - cursor moved: new line number
      onReflow(int, int) - the displayed content changed: new visible width and height
      onRightSelectTag(str) - right click on: tag id
      onSelectTag(str) - the user clicked on a tag or bitmap: tag id
      onURL(str) - the user clicked on an url

    GuiSliderCtrl (GuiControl):
      onAction(float) - the slider value has been changed (by script or user): new slider value
      onReleaseSlider(float) - the user has finishzed moving the slider: new slider value

    GuiSpriteCtrl (GuiControl):
      onPlayerDies() - the player died
      onUpdateScore(int, int) - new score: new total score, added points

    GuiTabCtrl (GuiControl):
      onDeselect(int, str, int) - a tab is no longer selected: id, text, row
      onIconResized(int, int) - the size of the icons has been changed: new width and height
      onMouseOverCell(int, str, int) - the mouse is hovering over a tab: id, text, row
      onOpenMenu(int, int, int) - the user has clicked with the right mouse button on an entry: row, mouse x and y
      onSelect(int, str, int) - a tab has been selected: id, text, row

    GuiTextCtrl (GuiControl):
      onTextChanged(str) - text has been changed

      GuiPopUpEditCtrl (GuiTextCtrl):
        onCancel() - the menu has been closed without selecting an entry
        onSelect(int, str, int) - a menu entry has been selected: id, text and row

      GuiPopUpMenuCtrl (GuiTextCtrl):
        onCancel() - the menu has been closed without selecting an entry
        onSelect(int, str, int) - a menu entry has been selected: id, text and row

      GuiTextEditCtrl (GuiTextCtrl):
        onAction(str) - a text has been entered (return key pressed)
        onTabComplete(bool) - the tab key has been pressed (with or without shift key)

      GuiWindowCtrl (GuiTextCtrl):
        onCloseQuery() - the player clicked on the close button and closequery=true
        onTextChanged(str) - the window title has been changed

I don't know whether all of the global events will be available to unprivileged (non-login) scripts like onConnectingToServer() but I guess they are not a lot of use to unprivileged scripts anyway.

Crow 05-26-2009 06:41 PM

I have to spread first >_<
Thanks a bunch!

[email protected] 05-26-2009 06:42 PM

You're great- thank you!
Could you compile a list for all script functions (onCreated, onTimeout) etc.

DustyPorViva 05-26-2009 07:33 PM

That's great, a lot of events I didn't know existed :)

Tigairius 05-26-2009 07:35 PM

This is great, thanks :D

fowlplay4 05-26-2009 08:08 PM

onOfflineModeStarted()

Makes me wonder why we can't work and test GS2 scripts offline.

Inverness 05-26-2009 11:10 PM

+rep

cbk1994 05-26-2009 11:11 PM

Awesome, thanks Skyld.

Quote:

Originally Posted by [email protected] (Post 1494285)
You're great- thank you!
Could you compile a list for all script functions (onCreated, onTimeout) etc.

They're called events.

Skyld 05-27-2009 11:00 PM

Quote:

Originally Posted by [email protected] (Post 1494285)
You're great- thank you!
Could you compile a list for all script functions (onCreated, onTimeout) etc.

I guess there is a sorta-partial list at http://wiki.graal.us/CategoryFunctionEvent but it is not complete; people should help to document what they know more.

Pelikano 05-28-2009 12:36 PM

Quote:

Originally Posted by cbk1994 (Post 1494392)
Awesome, thanks Skyld.



They're called events.

ysosmart?

Crow 05-28-2009 02:12 PM

Quote:

Originally Posted by Pelikano (Post 1494838)
ysosmart?

Because "functions" is not the correct term.

Pelikano 05-28-2009 04:18 PM

still using [i] on the word, is very ***gy

Codein 05-28-2009 05:11 PM

Quote:

Originally Posted by Pelikano (Post 1494882)
still using [i] on the word, is very ***gy

How is emphasising a word, especially a key word, '***gy'?

Pelikano 05-28-2009 05:15 PM

Quote:

Originally Posted by Codein (Post 1494890)
How is emphasising a word, especially a key word, '***gy'?

it was an attack, we all know that

Codein 05-28-2009 05:46 PM

Quote:

Originally Posted by Pelikano (Post 1494893)
it was an attack, we all know that

Or, rather, a pretty legitimate correction? This is from a standing point where I've known no previous bitterness between Chris and Andy. I've certainly seen none shown on the forums. Maybe you could correct me on that? :P


All times are GMT +2. The time now is 05:43 AM.

Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (C) 1998-2008 Linux cyberjoueurs All Rights Reserved.