Miscellaneous functions

From HEWIKI
Jump to: navigation, search

Contents

This page contains a list of functions which either have not yet been filed in their appropriate categories, or don't fit under any of the existing categories. For an index of categorized functions, please see the Function Index.

The orphan functions

Preload script functions

functions that make it easier for scripts to load

  PreloadScript()
  PreloadScriptList()

Create ID

CreateID() as ID

This server-side function, when called, takes one of the numbers from the universally unique number list, and provides it to the calling function for whatever purpose it needs. So the number can be guaranteed to not be a noderef. Can also be used to generate unique identifiers for a Group.

Get enum values

Built-In:

function GetEnumValues(enumName as string) as list of string

Has function

function HasFunction(myScript as ScriptRef, funcName as String) as Boolean

Note: Another place to check for syntax of external functions, is to look at the client-side utility script "External functions".

Notify state change

NotifyStateChange(string as string)

Client-side function, for in-house use only. Client-only. Depending on the value of the string that has been passed, it takes and various and esoteric options.

Get keyboard modifiers

Client function that gets the current state of ctrl, alt, and shift keys on the keyboard. A value of TRUE means that the key is currently pressed.

  GetKeyboardModifiers(ctrl references boolean, alt references boolean, shift references boolean)


Does anim float knob exist? and does anim string knob exist?

DoesAnimFloatKnobExist(char as NodeRef, name as String) as Boolean
DoesAnimStringKnobExist(char as NodeRef, name as String) as Boolean

Animation sequences can create knobs. There are two types: a string knob, and a floating point number knob (numerical). Whenever the sequences run, they add knobs to the character. These functions can be used to determine whether or not the knobs exist or not.

Get selected nodes

 GetSelectedNodes() as List of NodeRef

Client-side function which returns the IDs of the instances which are currently selected by the client.

Is HeroBlade?

IsHeroBlade() as boolean   // Returns TRUE if the script is executing on Heroblade
                           // Returns FALSE if running on the client


Unselect all nodes and select node

UnselectAllNodes()  //HeroBlade-only, unselects all selected nodes
 
SelectNode(whichnode as noderef, isSelected as boolean) // HeroBlade-only, selects or
                                                        // unselects a node

Vector drawing functions

OnVectorDrawingUpdate()
SetHeroicVectorDrawing(isVectorDrawingOn as boolean)   // enables vector drawing mode, taking over the mouse control
ClearHeroicVectorDrawings() - clears vector drawings
SerializeHeroicVectorDrawings() as string              // saves vector drawing data to a string
DeserializeHeroicVectorDrawing(data as string)         // loads vector drawing data from a string
UpdateHeroicVectorDrawings(data as string)
For real-time drawing updates
 
HSL callback to BaseClient:OnVectorDrawingUpdate(updateData as string)
For real-time drawing updates


Open GM note

OpenGMNote(nodeID as ID)

For the GM Notes system, so that creating a new note can auto-open it. May only be called after PopulateGMNoteData().


Align fly camera

AlignFlyCamera()

Matches FLY camera position/rotation exactly to GAME camera position/rotation; does nothing if there is no FLY camera


Set cursor visibility

SetCursorVisibility(cursorOn as Boolean)

This function sets the mouse cursor to be visible or invisible. Note that if the cursor is hidden, moving the mouse will not affect GUIControls.

When a cursor is set to visible again, its position is restored to where it was when it was hidden.

Get random point on action mark

GetRandomPointOnActionMark(actionmark as noderef, heading references float, position references vector3)

Sets the referenced "position" variable to a random point along the cue line of an ActionMark, and the "heading" variable to the heading of the ActionMark.

Get and set node position

Main page: GUI functions

GetNodePosition()
SetNodePosition()

These are more efficient than using the "Position" property, because no type conversion needs to take place.

Is character in area?

client side external:

IsCharacterInArea(characterID as id) as Boolean

Enable minimap

EnableMiniMap(enabled as boolean)

This is a function which toggles the rendering of the minimap texture. By default, minimap texture updates are disabled. The minimap script should call this when showing or hiding the map.

Cursor control for GUIs

Set ignore cursor

SetIgnoreCursor(ignore as boolean)

While IgnoreCursor is set to TRUE, mouse movement will not move the cursor. This allows the input system to interpret mouse movement as camera/character rotation instead, as is done in the clean engine HE_Camera input layer's DragRotate command state.

Get ignore cursor

GetIgnoreCursor() as boolean

Set caret

SetCaret(textinputbox as NodeRef, start as Integer, end as Integer)

Sets the position of the cursor on the text input box. The start and end positions are used when you want to highlight a section of text in the inputBox via HSL. inputBoxNode.value.length will give you the over all count of characters stored in the inputBox.

Get caret

GetCaret(textinputbox as NodeRef, start references Integer, end references Integer)

This will grab the position of the caret in a text input box. Before the first letter it is position zero.

Example

public function textInputBox_OnKeyDown(args references Class GUIKeyboardEvent)
  if args.keyCode = 13               // enter key was pressed
    args.interrupt = true            // stop submit and make it add a line break
    args.handled = true
    textInput as NodeRef of Class GUITextInputBox = args.source         // find the inputBox that sent this.
    caretStart as Integer
    caretStop as Integer
    getCaret(textInput, caretStart, caretStop)            // this will grab the start and stop position of where the caret is
    if caretStart = textInput.value.length                // it's already at the end, no need to check for a stop
      textInput.value = textInput.value + "$R"            // Add a line break to the text.
      setCaret(textInput, textInput.value.length, textInput.value.length)         // move caret back to the end.
    else            // the caret was in the middle somewhere, remove any highlighted text (if any) and add a line break.
      firstString as String
      secondString as String
      firstString = subString(textInput.value, 1, caretStart)        // this grabs the text before the caret
      secondString = subString(textInput.value, caretStop + 1, textInput.value.length)        // this grabs the text after the caret
      textInput.value = firstString + "$R" + secondString            // this combines the two lines back adding a line break in between
      setCaret(textInput, caretStart + 1, caretStart + 1)            // move the caret to right after the line break and not the end.
    .
  .
.
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox