Functions

From vx
Jump to: navigation, search

Contents

[edit] Functions contained by the vx namespace

[edit] Graphical

These functions are visual in nature.

vx.Render()

vx.ShowPage()

  • Flips the buffers and transfers any video changes to the screen. Also refreshes the input and processes a bunch of engine hooks.

vx.RGB(red, green, blue) -> number
vx.MakeColor(red, green, blue) -> number

  • Returns an RGB color index with the specified RGB values.

vx.MixColor(color1, color2, ratio)

  • Returns an RGB color that is a mix of the two passed colors where ratio (values 0-255) determines the strength of each color. When ratio is 0, it will return color1, at 255 will return color 2, while a ratio of 128 will return a perfect blend of the two.

vx.GetR(color) -> number

  • Returns the red channel of an RGB color.

vx.GetG(color) -> number

  • Returns the green channel of an RGB color.

vx.GetB(color) -> number

  • Returns the blue channel of an RGB color.

vx.HSV(hue, saturation, value) -> number

  • Returns an RGB color index with the specified HSV values.

vx.GetH(color) -> number

  • Returns the hue (a 0-359 position on the color spectrum) of an RGB color.

vx.GetS(color) -> number

  • Returns the saturation (a 0-255 measure of 'coloredness') of an RGB color.

vx.GetV(color) -> number

  • Returns the value (brightness) of an RGB color.

vx.SetLucent(lucent)

  • Changes the percentage of translucency of drawing operations, taking in the range 0-100%. 0 is fully opaque, 100 is completely invisible.

vx.GetLucent() -> number

  • Returns the current (most recently set) translucency, ranging from 0-100%. 0 is fully opaque, 100 is completely invisible.

vx.SetOpacity(opacity)

  • Changes the percentage of opacity of drawing operations, taking in the range 0-100%. 100 is fully opaque, 0 is completely invisible. Setting either the opacity or translucency will set both to appropriate values; the opacity option is provided purely for semantic convenience.

vx.GetOpacity()

  • Returns the current (most recently set) opacity, ranging from 0-100%. 100 is fully opaque, 0 is completely invisible. Setting either the opacity or translucency will set both to appropriate values; the opacity option is provided purely for semantic convenience.

vx.SetCustomColorFilter(color1, color2)

[edit] Entities

These functions deal with all entities map-wide.

vx.PauseEntities()

  • Pauses all entity interaction on the map.

vx.UnpauseEntities()

  • Resumes all entity interaction on the map.

vx.CountEntities() -> number

  • Gives the count of how many entity handles are currently active.

[edit] Miscellaneous

These functions are hard to categorize, but might be handy.

vx.Random(low, high) -> number

  • Returns a random number between low and high, inclusive.

vx.SetAppName(title)

  • Changes the title of the application to the specified title string.

vx.SetResolution(xres, yres)

  • Changes the title of the application to the specified title string.

vx.UpdateControls()

  • Refreshes the input devices.

vx.CallFunction(func)

  • Attempts to resolve and call a global function by its name. You might want to just use Lua function pointers where you can, since this primarily used for looking up map events.

vx.Log(...)

  • Prints the passed list of arguments as a string with tabs between each message. If the object attempting to be printed does not have a tostring() representation, it will inevitably do bad stuff. So be careful if you're using the class system which vx provides. You need a __tostring() object method for any vergeclass objects you use. If you want messages to not be tabulated, use the .. string concatination operator instead of a comma!
  • If you include vx, the global function print does the exact same thing (vx replaces it with an alias to vx.Log).

vx.Exit(...)

  • Exits verge with the passed list of arguments as a quit message, each separated by tabs. Same deal as vx.Log as far as possible problems. If you want messages to not be tabulated, use the .. string concatination operator instead of a comma!
Personal tools