Creation/Dev/Releases/Client/5.006

From Graal Bible

Release date

July 13th 2007 for Mac, Linux and Windows. This is the first public version of v5.

New Features

General

  • improved external playerlist (Windows):
    • the external playerlist is now working on the login server
    • you can dock it to the left or right side of the desktop
    • you can show/hide it individually from the main Graal Window
    • shows a tray menu icon for displaying incoming PMs
    • fixed problems with the transparency of some head icons
    • displays the head on Kingdoms and Zone
  • PMs are now always using the internal scripted PM window
    • prevents problems with javascript exploits inside PMs
    • allows us to improve and customize the PM window in the future (since it is scripted)
    • prevents problems with missing dlls on some Windows installations
  • new log window:
    • on Windows it is using the internal log window
    • it is using several different tabs which only display log messages for files, scripts, sounds etc. instead of displaying everything in one huge log
    • optimized to not lag when the window is not visible
  • the Graal window is snapping to the desktop border when moved near the border
  • the profile window on Windows is resizable now
  • the in-game option window and profile window on Linux/Mac are resizable now
  • improved the login to servers:
    • it shows a message "Connecting to ..."
    • the login to servers using GS2 is much faster
    • it is directly connecting to the login server instead of displaying the start screen first
  • when a PM from a npcserver is received and the PM history for it is more than 100k bytes then the history for it will be deleted, for preventing too huge files (many servers send a welcome message each time you login)
  • files that contain "bomy" or start with "b_" are no longer saved into levels/bomys (requested by the Graal2001 developers)
  • Linux packaging:
    • it is possible again to start graal by just typing "graal" on the command line (instead of typing "graalexe")
    • SDL is not used anymore, which fixes some problems with the keyboard input (key repeat)
  • drastically reduced the memory taken by scripts and the scripting engine
  • the setup is not scanning the current folder anymore, so it's starting much faster when being downloaded to the temporary internet folder and started from there
  • improved protection against memory hacking
  • for saving screenshots it is now using the internal file dialog instead of the Windows file dialog which often made problems with messed up Windows installations (missing dlls)
  • the Graal executable is signed, so it's easier to check that it hasn't been modified, and advanced Antivirus-programs don't complain anymore when Graal is updating

Translation System

  • the client is now multi-language again: it is using the translation file format .po like on Graal Kingdoms
    • you can find the files in translations/*.po (requires you to run the setup to see the files) and you can add new files if you want to translate the Graal interface into other languages (right now only German-de and French-fr are provided beside English)
    • to start a new translations copy gui_en.po to gui_DOMAIN.po and guiwindows_en.po to guiwindows_DOMAIN.po (domain can be en,fr,de,pt,es etc.)
    • po files can be edited either with text editor or a specialized po-editor like poedit.net
    • as encoding use ISO 8859-15 (or ISO 8859-1 or Windows codepage 1252)
  • the new client-side language support can also be used on servers with GS2:
    • create a .po file on the serverside and make it downloadable, the filename must end with "_de.po" if it is a german translation, "_fr.po" if it's a french translation etc.
    • on client-side load the translation with the command loadtranslation(file) - that will download "file_DOMAIN.po" depending on the players language
    • in scripts you can use the translated strings with the script function "_()" (it is very short for easy usage) - that call will return the translation if one is existing, otherwise the original text
    • it is planned in the future that an RC command is added which let's you easily generate a blank po file based on the occurances of _() in the scripts, for that also use the function N_() which is not changing the text, but is marking the text for being included in the scan (for text that you don't want to translate immediately)
    • if the player is connecting for the first time then the translation might not be downloaded yet, thats why there is an event onTranslationUpdated(file)
    • when the player changes the language in the options then an event onPlayerLanguageChanges(playerobject) is invoked, the same like on server-side
      • on clientside the playerobject is always the local player (there is no event yet when other people change their language)
      • it is recommended to update the text on GUI controls when the language changes

GUI

  • GuiControl:
    • added function clearControls() for removing all controls[] at once
    • you can make controls easily alpha-transparent or color them by accessing the following attributes:
      • red (0..1)
      • green (0..1)
      • blue (0..1)
      • alpha (0..1)
      • color (for changing all color attributes at once, format is {0..255,0..255,0..255,0..255})
      • mode (0 - add, 1 - alpha transparent, 2 - subtract, 3 - daynight effect)
      • this will also colorize the sub-controls or make the sub-controls alpha-transparent
      • if sub-controls don't want to be made transparent then use an alpha value greater than 1 (e.g. 10)
    • the attribute "clipmove" is now also taken into account when resizing the control - by default the engine is making sure that you don't move a control out of the parents bounds, by setting clipmove = false that check is disabled
    • fixed problems with the onShow/onHide events, they are now invoked when a control is becoming actually visible or invisible on the screen (corresponding to control.isActuallyVisible())
    • you can let controls "flicker" by setting flickering = true;
      • you can change the flicker interval by setting "flickertime"
      • let controls flicker non-synchronized by setting "flickerbasetime" to a random value
    • added attribute "hinttime" (by default 0.5 seconds) which says after how much time of the mouse not moving the hint will be shown
    • fixed problems with centered GUI-controls (horizSizing = "center", vertSizing = "center") which are now correctly centered when added, not only when the parent control is resized
    • fixed odd resizing of the parent control when a child control uses horizSizing = "left" and x is below 0, or vertSizing = "top" and y is below 0
    • new script event: onFirstResponderChanges(newfirstresponder) is invoked when the input focus switched to another control
    • fixed some problems with added controls receiving the input focus even if they shouldn't
    • onKeyDown() and onKeyUp() now give an exact keycode as first parameter which includes modifier keys
      • modifier values are 0x100 for shift, 0x200 for control key, 0x400 for alt key
      • you can check e.g. for control key by if ((keycode & 0x200)!=0)
    • added support for dragging files from files explorer to Graal GUI controls to expand the functionality of scripted RC and level editors:
      • set control.acceptdropfiles = true
      • once the user drops a file on the control an event controlname.onDropFiles(mousexpos,mouseypos,files) will be invoked, parameters are the mouse x and y positions and an array of filenames (with at least one file in it, but can be more than that)
      • to let the scripted RC upload the file call uploadFile(filename)
      • if you script editors, then you can use this to let the user place graphics or gani files in the level or editor space
      • this is currently working on Windows and Linux (where it only shows the drop-icon when the control under the mouse is actually accepting the files)
  • GuiFlash:
    • accepts urls (on Windows) for displaying videos and similar
    • if you want the file downloaded instead of streamed, set downloadWebfiles=true;
    • the position of the flash control is correctly updated when the parent control is moving
    • flash controls can be partially clipped (e.g. be inside a scroll control)
    • flash controls work on Linux
      • it is automatically checking for libflashplayer.so in the firefox or mozilla plugin folder
      • web videos are currently not working
    • some attributes have been renamed, but the old variant is still work: use "tryplugin" instead of "tryactivex" and "requiresplugin" instead of "requiresactivex"
    • when the parent control is hidden then the flash control will be hidden too
  • GuiContextMenuCtrl:
    • correctly draws the icon even if an entry has no text
    • updates the icons when an image drawn on the icon has been downloaded
    • readded attribute "maxpopupheight" which limits the height of the menu for preventing the menu from covering the whole screen (also works for GuiPopUpCtrl and GuiPopUpEditCtrl since they are using a GuiContextMenuCtrl for displaying the menu)
    • new function openAtMouse() which opens the menu at the mouse position, use this if possible instead of open(x,y)
  • GuiPopUpCtrl:
    • when closing a combo box (GuiPopUpCtrl) or similar then it is not wrongly switching the focus to the next control anymore
  • GuiScrollCtrl:
    • added functions scrollToTop() and scrollToBottom() which simply call scrollto(0, 0) and scrollto(0, 0x7fffffff)
    • added checks for HOME and END key for scrolling to the top or to the bottom
    • when profile.bitmap is updated (or the file is updated) then the size of the up/down button and scroll bar are updated
  • GuiMLTextCtrl:
    • added html-tag <blink>blinking text</blink>
    • added support for ampersand character codes like &amp; which displays a "&"
    • fixed a problem with two new lines adding a space in front of the line (when they should be ignored)
    • fixed a problem with lists (ul-tag) not being correctly indented
    • fixed a problem with scrolling back to the last click position when resizing the control when it's inside a scroll control (only supposed to happen for GuiMLTextEditCtrl)
    • set "htmllinks = true" if you want Graal to automatically open a webbrowser when clicking on a link
    • scrollToTag(tagname) accepts tagnames starting with "#" (it will automatically remove the "#" to match the tag names)
    • better compatibility for the "size" attribute inside "font" tags:
      • when the size is between 1 and 7 then it will use HTML-compatible font sizing (1 - small, 3 - default size, 7 - large text)
      • when size is above 7 then it will still use it for the exact font size for compatibility with existing Graal scripts
    • fixed problems with breaking words at the end of the line
    • html comments are ignored now, as well as several non-supported tags (form, head, label, object, select)
  • GuiTextListEntry:
    • added "flickertime" (by default 1 second) which specifies the flicker interval of the icon of the list entry
    • easier selection of multiple entries via keyboard: you can now use the Home and End keys and select several entries by pressing Shift and moving the cursor keys
  • GuiTextEditSliderCtrl:
    • support for floating point ranges (e.g. range = {0.1,1}), to display floating point values set format = "%.1f" or similar
  • GuiTextEditCtrl:
    • fixed resizing problems when horizSizing is "width", it is not allowing anymore that the parent control is made smaller and messing up the size of the text edit field
  • GuiWindowCtrl:
    • new attribute "clientrelative" - if enabled then sub-controls are positioned automatically to not overlap the header or the borders;
      • use clientwidth and clientheight to get the available space for sub-controls
      • this allows to use different GUI styles/profiles without manually updating the position of sub-controls
      • clipping is only done for left, right and bottom side to allow placing of custom buttons on the title bar
    • new function isActiveWindow() to know if this is the currently selected window (top window in the list of its parents children) and is drawn highlighted
    • a window is activated / put on top of the other windows when you click with the mouse on a sub-control (previously you needed to click on the window title for that)
  • GuiSliderCtrl:
    • the slider can be moved by keyboard (Up/Left for reducing the value, Right/Down for increasing the value, Home and End for jumping to the minimum or maximum value)
    • the position of the thumb is automatically updated when the control is resized
  • GuiCheckBoxCtrl:
    • draws the graphics for the pressed-state also when the mouse is over the control, for improving the look
  • GuiButtonCtrl (also GuiCheckBoxCtrl, GuiRadioCtrl):
    • added support for hot-keys: if the button text contains a "&" then the following character will be underlined and the button will be activated when that key is pressed, e.g. you can activate a button that has the text "&Close" by pressing 'C'
      • use "&&" if you just want to display a "&" without the hot-key function
    • improved the support to navigate the GUI via keyboard:
      • buttons, tabulator buttons, check boxes, radio buttons, combo boxes (GuiPopUpCtrl) and sliders are now by default tabable which means that you can move the focus to them by pressing the Tab key (if the window has the input focus)
      • when a button, check box or radio button has the focus then you can move the focus to the next or previous control by pressing up/left/down/right (e.g. scrolling through a list of buttons)
  • GuiShowImgCtrl:
    • fixed clipping of GuiShowImgCtrls which use "text" - you need to specify width, height, offsetx and offsety if you don't want to have the text clipped (especially needed when you use style "c" for centered text or "r" for right-aligned text)
  • GuiInputCtrl:
    • Linux/Mac: fixed a problem with GuiInputCtrl capturing the focus on creation even if it's not visible

Graphics

  • Video capture:
    • press Alt+6 for recording videos, configure it in the options
    • the video is saved in the Graal folder under videos/ (*.avi format)
    • it is currently saving uncompressed and without sound
  • Easy skinning of GUI controls:
    • set GuiControl.style to "mytheme.wba" or "mytheme.zip" for skinning controls
    • it will replace the graphics and colors for most controls, except the font size/style
    • use the new attribute "clientrelative" for GuiWindowCtrl for making them compatible with different styles without needing to reposition the sub controls
    • known problems:
      • not all styles look perfectly yet
      • when switching between styles that use the same name for graphics then it might still show the graphics from the old style; restart the game to fix that
      • some controls still use the font type and size defined in the regular GUI profiles (control.profile)
    • there are new GUI controls for using taskbar skins:
      • GuiTaskBar - displays a bar with space for a start button on the left side, 'task'-buttons in the middle, and a tray or time display on the right side; if the control is not using any 'style' then it will look like a normal GuiControl
      • GuiStartMenuCtrl - similar to a GuiContextMenuCtrl, but displays a bigger menu like the Windows start menu
      • GuiButtonCtrl.stylesection - buttons can be skinned, by changing 'stylesection' you can specify what look the button should use, e.g. "Taskbar.StartButton", "Taskbar.ButtonHorz"
  • players and npcs can be made transparent - you can now use the same attributes like for showimgs/findimgs for setting red,green,blue,alpha and mode
  • fixed a bug with reading pngs that had a bad palette size
  • added support for 1-bit pngs
  • when an image is downloaded from the web and doesn't have a known file extension then the engine is trying to guess the file type by reading the content and displaying it correctly in most cases
  • when a web image is not existing then it is printing an error in F2 now and is not saving the data returned by the webserver anymore
  • Windows version graphics:
    • printing an error in the F2 window when the graphics card is out of video RAM (some images will not appear then)
    • trying to free all possible resources when the graphics card is out of video RAM to reduce that error
    • when loading images the engine is cutting out all fully transparent parts to minimize the use of video memory
    • fixed some problems with icons and classic bodies not refreshing or not displaying
  • Linux/Mac version graphics:
    • optimized the usage of graphics - it is using directly 8-bit palettized images with OpenGL and for tile drawing (before: always converting to 24 bit or 32 bit)
    • smoother drawing of stretched images (like in windows version)
    • improved font system which is more compatible, better looking and taking less ressources
  • Text drawing: right-aligned italic text is shifted 2 pixels to the left to prevent clipping problems
  • Improved support for bmp:
    • fixed a bug in the bmp reader so that bmps with odd width or height are correctly displayed
    • support for 32 bit bmps
    • not crashing on unsupported formats
  • particles support text shadow (emitter.particle.textshadow, shadowcolor, shadowoffset)
  • Linux/Mac: the scripted effects can be turned off directly in the options now (that only works when servers support those options)

Sounds

  • playlooped() is updating the volume each time it is called depending on the distance to the player
  • music files are now played non-looped by default when using the play() command, use playlooped() if you want to play a looped music or stream
  • when the volume is zero then wavs and mp3s are not downloaded anymore
  • downloaded wav files are automatically played (with the right volume and looping if requested)
  • when a music file (mp3, midi etc.) is played but is not existing yet then it is automatically played once it is downloaded
  • on Windows XP/Vista 64 bit it is by default not trying to use sounds because it freezes Graal, you can turn off this behaviour by setting "tryloadsoundson64bit=true" in the Graal options file - open game_config.txt with Wordpad

Scripting

  • correct class loading on clientside - onCreated() will be called on the joining object once the class has been downloaded from the server
  • Full support for client-side classes:
    • caching of classes
    • when a class is downloaded then the script is suspended while downloading
    • when calling a function of an object which is waiting for classes then the calling script will be suspended until it is loaded (to avoid errors with missing functions)
    • you can pre-load classes by calling loadclass(classname)
    • you can check if a class is loaded with isClassLoaded(classname)
    • when a class is downloaded from the server then an event onClassLoaded(classname) will be invoked
  • class-scripts are deleted from memory when switching servers
  • script function: obj.addArrayMember(name) adds an array member with a name, returns the added object so that you can easily add sub variables
    • use obj.getArrayMember(name) to find a named array member (the first occurance in the array)
  • the script function isObject(objectname) is working better - checks if the variable exists, and if it's a static variable (GUI, TStaticVar etc.), is an array, or is linking to some other variable - before it was only checking if a global variable with that name exists;
    • if you want to check if that variable is actually a static object, then check var.objecttype()!=2
  • added function obj.clearVars() which removes all dynamic sub variables, it doesn't send deletion of client. vars and similar yet though
  • added script variable obj.scripterrors which gives the list of errors reported for the object, e.g. "Function func not found"
  • New script function getFileModTime(filename)
    • gets the time of the last modificatin of a file
    • it's using unix time which is compatible to timevar2 (seconds since 1970-01-01)
    • accepts both exact file path and plain file name
  • When a script function is requiring more parameters than provided then the error message is also displaying the object type (not just the function name)
  • obj.getfunctions() also lists functions contained in joined classes
  • new script function object.hasfunction(functionname) - tells if the object has the specified function and can be called
  • Added support for function objects:
    • this will print "param: 123"
   function onCreated() {
     this.func = this.func1;
     this.func(123);
   }
   function func1(param) {
     echo("param: " @ param);
   }
    • You can also do this, but keep care to add a semicolon behind the function declaration:
   this.func = function() {
     echo("nameless function");
   };
    • There is a protection against unsetting functions, since often scripts use the same name for functions and variables. If the variable is not linking to a function but the script contains a function with that name, then it will use the function defined in the script instead. You can however link to another function.
  • You can now create empty arrays simplier by doing "var = {};" (it was displaying a syntax error before)
  • when array members are updated then printing the array will correctly show the updated state (in most cases)
  • New script command object.loadini(inifilename) for loading an ini file into a variable; you can access the variables by object.inisection.varname
  • added script functions findnearestplayer(x,y) and findnearestplayers(x,y) on clientside, also getnearestplayer(x, y) and getnearestplayers(x, y) (which return indices instead of objects)
  • keydownglobal(0..10) has been fixed - with this function you can check the status of the default keys (which also use joystick input) even when some GUI control has the input
  • added a way to increase the loop limit for scripts: obj.maxlooplimit = 100000; will increase the number of maxmimum allowed loop iterations for the object to 100000 (default 10000)
    • if you have some script that is sometimes requiring more than 10000 loop iterations then this helps to prevent problems
    • the allowed range for maxlooplimit might be restricted on some servers though
  • scripts can access image files; currently supported file extensions:
   .txt,.rtf,.htm,.html,.xml,.nw,.gani,.gmap,.gupd,.hfl,
   .cs,.gs,.arc,.dat,.css,.ini,.uis,.png,.mng,.gif,.jpeg,
   .jpg,.jp2,.bmp,.bm8,.tga,.dds
  • scripts can read files from the updatepackages/ folder and tileobjects/ folder (tileobjects contain files required for the scripted editor)
  • it is finally possible to replace sprites.png and state.png by script:
    • GS1: setspritesimage filename; setstatusimage filename;
    • GS2: setspritesimage("filename"); setstatusimage("filename"); or use the global variables spritesimage or statusimage
    • those images will then be used to draw the default classic GUI (state.png) and default sprite effects like when carrying a bush or swimming (sprites.png)
    • the images will be reset to the default value when switching a server
  • fixed some problems with weapons when switching from GS1 to GS2: because weapons are basicly npcs, some built-in variables like 'hp' were protected, but since the weapons are not really requiring those they have been removed now, so you can use them as normal variables again (e.g. this.hp = 50.2; );
    • the built-in variables that were removed are:
 alpha, ani, aniparams, 
 anistep, blue, green, mode, gmap, height, hp, maxhp, red, rotation, stretchx, 
 stretchy, width, zoom
  • new function for detecting if the game is currently in fullscreen mode: isfullscreenmode() returns true or false; it is also possible to switch to fullscreen mode or window mode, but only for authorized scripts
  • it is now possible to trigger npcs from clientside using the triggerserver() function:
    • triggerserver("npc",npcname,params) is invoking an onActionServerSide(params) event on the server-side
    • it works even if the player is not near the npc (so you need to check that if required)
    • to use this in GS1 you need to do triggeraction 0,0,servernpc,npcname,params; and check for "if (actionserverside)" in the triggered npc
  • improved support for displaying flash resources in Graal:
    • in showimgs/findimgs and GuiShowImgCtrl you can set flashfile = "name.swf" and then access the attributes by the variable "flash"
    • fixed some major compatibility problems
    • gradient brushes are correctly handled and displayed
    • it is possible now to list all available flash resources of a file by displaying flash.objectnames
    • display the number of frames: flash.framecount
    • you can also set the frame number of sub objects: do flash.objectname = "clipname", flash.object.frame = subframenumber you can change the color of the flash resource (by setting red,green,blue,alpha of the showimg)
    • correct scaling when the GuiShowImgCtrl is inside a GuiStretchCtrl (or the showimg is displayed in the gani script of a scaled player/npc)
    • you can access the layers (depths) of the flash movie with flash.getLayer("name" or index), and then change red,green,blue,alpha (or 'color' for changing all at once) and frame or even access sub-layers, use flash.layernames to get the available names
    • resources (meshes, gradient textures) are removed from memory after a few seconds of non-usage
  • improved the support for moving and resizing the GraalControl so that other controls can be placed in the game window without hiding parts of the game
  • when using string.tokenize(delimiters) and the delimiter is new line ('\n') then it is also skiping line feeds ('\r') which are in front of new line, which makes it easier to read DOS/Windows formated texts
  • new player attribute player.communityname which displays the name the player is using for the forums etc.
    • by default players have now an account name which is basicly just a number (Graal12345) and can later register a communityname which is then used for the fourms, wiki etc.
    • on the playerlist and PMs it will display the community name instead of the account name, scripts are supposed to do the same
  • for improving the playerlist and similar things it is now possible to force the gserver to send player attributes (#P/player.attr[]) to all players on the server instead to only people that see you
    • set the server options sendtoallattr=1,2,3 for sending attributes 1, 2 and 3 to all players
    • when #P1/attr[1] is changing then it is also invoking the event onPlayerChanges(player,id) like when the head is changing
  • getstringkeys(variablenamestart) is now also returning the names of sub variables which are empty but have themself sub-variables
  • added player.mapicon which is used for drawing the head on the map and mini-map, this is usually updated by the playerlist script
  • TDrawingPanels (icons) have a new attribute: icon.isclear says if the icon is empty (no drawing operation done yet or everything cleared with clearall())

Bug Fixes

  • General bugs
    • fixed a problem that crashed the client on serverswitch when still having PMs on the player list from players that already logged out
    • when downloading files with the scripted RC into the Graal folder then it is using the correct path and is not moving the file to the level/images/download folder anymore
    • fixed a problem with defaultmovement where the player was not moved on the map when the player was moved by script
    • on vista it doesn't display a runtime error when you close the program anymore
  • Script engine bugs
    • fixed the script garbage collector (deleting unused/unlinked TStaticVar)
    • showimgs/findimgs that are attached to the player via attachtoowner=true are correctly synchronized to the player position (and don't lag behind)
    • hideimg() is not crashing the engine anymore if it contains gani scripts
    • the destroy() function for GuiControls and TStaticVar are not causing crashes anymore, but the objects are disappearing from scripting so you can correctly recreate them
    • fixed a problem with the random function - int(random(0,upperlimit)) was sometimes returning 'upperlimit' due to rounding if a floating point value is very close to an integer value - the random() function is now preventing that the result is identical to the upper limit
    • fixed a script problem where "-" was seen as number (-1)
    • fixed a crash when returning a temp. array from a suspended function (sleep/waitfor in a public function)
    • fixed the modulus operator 'a % b' for the case that a is negative and b is high number (>10000), previously it was giving a negative number which should not happen (-3 % 100000 should give 99997)