Sphere.Colour

From Liberty Unleashed Wiki
Revision as of 23:54, 8 November 2010 by AdTec 224 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This Sphere class member returns or sets the colour ID of the sphere.

Syntax

You can either return or set a new value using this member:

  1. Colour Sphere.Colour
  1. Sphere.Colour = Colour col

Arguments

  • col - This is the pointer to a pre-defined RGB colour object.

Example 1. Returning

This example will message the player with the current RGB colour of the sphere.

  1.  
  2. function onPlayerFootSphereHit( player, sphere )
  3. {
  4. local col = sphere.Colour;
  5. MessagePlayer( format( "The current RGB colour of this sphere is: %i, %i, %i", col.r, col.g, col.b ), player );
  6. return 1;
  7. }
  8.  

Notes

The function MessagePlayer and event onPlayerFootSphereHit were used in this example. More info about them in the corresponding pages.

Example 2. Setting

This example will turn the sphere red when a player enters it.

  1.  
  2. function onPlayerFootSphereHit( player, sphere )
  3. {
  4. sphere.Colour = Colour( 255, 0, 0 );
  5. }
  6.  

Notes

The call onPlayerFootSphereHit was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox