This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. <jumbotron> FAQ: Scripting Hints and Tips {{icon>asterisk?24&pack=glyphicon}} Information related to the script editor and lua mechanics etc. Some useful mini scripts and other tips. </jumbotron> <grid><col sm="6"><well> Q) Is there any way to get the object ID on mouse over? Yes there sure is, try this in an object script or scene script: function onUpdate(timeDelta) x,y,z = sky.raycastToCursor(); hitID = entity.getLastHitEntityID(); sprint("> "..hitID) end </well></col> <col sm="6"><well> Q) Delete an object when clicked on To delete an object when its clicked on requires two things to happen. One is to enable the mouse click events by calling this command once (This can be in a scene script.): game.enableMouseRay(1); The second is on the object its self in a micro or external script: obj = 0; function onInit(objID) obj = objID; end function onClick( hitID ) entity.delete( obj ); end </well></col></grid> <grid><col sm="6"><well> Q)How to Communicate between Scripts The are many times when developing complex systems and classes there is the need to send and receive data between different objects. This could be done by using global variables but would never be practical on a large project where there cold be 1000,s of dynamically controlled objects. It is far better to have the scripts send and receive data between each other, this way each object can manage its own data. <lead> Examples of communicating between scripts on other objects can be found here:<text background="success"> Communicating with Scripts</text> </lead> </well></col> <col sm="6"><well> Q) How to Communicate with Modules Not all dynamic controllers are created by script. In some situations it is easier and better for performance to use the module system. Skyline will happily run an object containing both a script, either external or micro script and a visual module graph. Tools have been provided for inter system communication between scripts and modules, lets take a look. <lead> Examples of communicating between scripts and Modules can be found here:<text background="success"> Communicating with Modules</text> </lead> </well></col></grid> <grid><col sm="6"><well> Q) How to Communicate with Actions Actions add a lot of performance friendly game mechanic functionality and are at the core of constructing cool game objects from entities. Actions themselves have their own Lua library “action.command()“ for getting and setting property values and specific actions have direct lua Event calls such as the “function doDamage(..)“ <lead> More information can be found here:<text background="success"> Communicating with Actions</text> </lead> </well></col> <col sm="6"><well> Bullets and spaceships Physics for space ships, bullets etc, this is generally done using kinematic bodies that do not respond to forces such as gravity, with these you have to program the forces yourself. This is a far more efficient route rather than tring to manipulate individual objects gravity and used by many top games as you have full control over the body and is better for performance as its not calculated in the main physics world, yet still can interact. </well></col></grid> <grid><col sm="6"><well> Q) How do I access the weapons editor by script? The weapons editor has its own library found here: Weapon Class -- Examples vol = weapon.getEmptyClipVolume("scar"); animName = weapon.getAnim("scar", "shoot"); power = weapon.getPower("scar"); clips = weapon.getMaxClips("scar"); rounds = weapon.getMaxRounds("scar"); damage = weapon.getDamage("scar"); --etc </well></col> <col sm="6"><well> Q) TEXT </well></col></grid> <-help:faq:faq_sceneworking|FAQ Scenes^help:faq|FAQ Index^help:faq:faq_assets|Next:FAQ Assets→ Detach Close Document TOC Developer Sidebar SidebarDev HTML5 Bootstrap Commands Nav Menu Example TOC Ideas Site Index Layout: Tutorial Intro Layout: Tutorial Page Layout: FAQ Page Layout: Index Home Welcome What is Skyline Terminology FAQ FAQ Index Working on Scenes Scripting Assets General Info Installation and Setup Game Objects Manual Scripting Index Script Overview Micro Scripts External Scripts Scene Scripts Events Tags and ID's Communicating with Scripts Communicating with Modules Communicating with actions Dynamic Properties Learning Tutorials Index Basic Character Basic Shooting Guides Index Getting Started Video Tutorials Index