HeroScript

From HEWIKI
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
 
Line 6: Line 6:
  
 
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 <code>functionname(arg1, arg2)</code> whereas commands usually use the format <code>commandname arg1 arg2 arg3</code>.  Please see the bottom of this page for specific examples.
 
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 <code>functionname(arg1, arg2)</code> whereas commands usually use the format <code>commandname arg1 arg2 arg3</code>.  Please see the bottom of this page for specific examples.
 +
  
 
==Related links==
 
==Related links==
Line 31: Line 32:
 
* [[Invoking scripts]]
 
* [[Invoking scripts]]
 
** ''The different ways that a script can be called or triggered''
 
** ''The different ways that a script can be called or triggered''
 +
 +
===Video Tutorials===
 +
''My First HSL Script, a brief, step-by-step tutorial.''
 +
<videoflash>O_bJ32D7eaw&hd=1</videoflash>
 +
 +
<br>
 +
 +
''HeroScript for Programmers pt 1''
 +
 +
<br>
 +
 +
<videoflash>OSkuAv_tZtE&hd=1</videoflash>
 +
 +
<br>
 +
 +
''HeroScript for Programmers pt 2''
 +
 +
<br>
 +
 +
<videoflash>chxMHwd_grA&hd=1</videoflash>
 +
 +
<br>
 +
 +
''HeroScript for Programmers pt 3''
 +
 +
<br>
 +
 +
<videoflash>K8n4pLvCboc&hd=1</videoflash>
  
 
== Script Names ==
 
== Script Names ==

Latest revision as of 16:48, 19 January 2012

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

Contents

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

Video Tutorials

My First HSL Script, a brief, step-by-step tutorial.


HeroScript for Programmers pt 1

HeroScript for Programmers pt 2

HeroScript for Programmers pt 3

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:

//
  orc27:foo()
  "orc27":foo()
 
  aVariable = 27
  "orc"+aVariable:foo()           
 
  mainScript as scriptref
  mainScript = "orc"+aVariable
  mainScript:foo()
 
  ScriptReferenceVariable as scriptref = "orc"+27
  ScriptReferenceVariable:foo()


Line Continuation Note

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

Example:

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 &gt; 4) 
    println("This string is more than 4 characters long.")
  else
    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
  printV3(v)
 
  // 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
Namespaces
Variants
Actions
Navigation
Toolbox