Revision as of 18:56, 24 June 2011 by HE-NICK (Talk | contribs)
Jump to: navigation, search

Welcome  ·  Tutorials  ·  The Engine  ·  HeroScript  ·  HeroBlade  ·  Art  ·  HE Setup  ·  Wiki Help


HeroScript, or HSL, for HeroScript Language, is the underlying scripting language used by game designers to build the game itself.

A script is a named set of functions and/or methods, referenced either by the field mainScript on nodes, or via a class on the node which calls a similarly named class methods script. When something happens to a node, the appropriate function or method is called in the script on that node. Scripts are contained in a file with the .hsl extension.

When writing a script, it will generally be necessary to use a combination of commands, HSL-written functions, and built-in functions. The main difference between these is one of syntax. HSL and built-in functions use the format functionname(arg1, arg2) whereas commands usually use the format commandname arg1 arg2 arg3. Please see the bottom of this page for specific examples.

Related links

Quick overview of the HSL language, for experienced programmers

Script Names

Script names are strings like "GetString" or "orc27" or "attack"

A script name can also be built as part of a string. For example, to call the shared function foo() which exists in script orc27.hsl, all of the following would work:

  aVariable = 27
  mainScript as scriptref
  mainScript = "orc"+aVariable
  ScriptReferenceVariable as scriptref = "orc"+27

Line Continuation Note

It is possible to continue a long line in HeroScript with the continuation character "\".


someReallyLongVariableName.someReallyLongFieldName = \

"The rest of the statement"

More Information

Other script-related topics which are worthy of their own explanations are:

HeroScript Examples

  str as string
  str = "BigWord"
  if (str.length > 4) 
    println("This string is more than 4 characters long.")
    println("This string is less than 4 characters long.")

  // the old way
  v as vector3
  v.x = 1.0
  v.y = 2.0
  v.z = 3.0
  // or as of version 1.23
  var v2=(1.0, 2.0, 3.0)

  n as noderef
  n = 5
  if (n = 0) 
     // 5 wasn't a valid node id
Personal tools