View Single Post
  #13  
Old 03-26-2011, 10:15 PM
Twinny Twinny is offline
My empire of dirt
Twinny's Avatar
Join Date: Mar 2006
Location: Australia
Posts: 2,422
Twinny is just really niceTwinny is just really nice
Send a message via AIM to Twinny
OK so, in order for that code to be executed, you need a function/event. Functions and events need to be called.

Say you want to have this executed,'
PHP Code:
echo("I'm a snippet!"); 
You can place this in an event. Events are called when certain criteria are met. For instance, function onCreated() is called when the script is first created. For clients, this is every time you login. There are others like function onWeaponFired() which is called whenever you press D while the weapon is selected.

Classes, unlike weapons, cannot operate by themselves. They need to be joined to an object in order to function. This can things like weapons, temporary NPCs or even the player object. This is why we say you need a weapon. A weapon is truly the easiest way for your GUI to work. It's possible to have the class join the player object (thus negating the need for the weapon) but it seems this is quite beyond your technical level at the moment.

You should take a moment to really understand the language before diving into complex operations. Try reading the tutorials section at http://wiki.graal.net/index.php/Creation/Dev/GScript

To utilise the weapon method, create a weapon in RC and add the GUI script to the onCreated event. Next, add an entry in the onActionPlayerOnline to check whether the player has the weapon. If not, add it to them.
Reply With Quote