HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: DOM basics  (Read 1889 times)

Thazager

  • General Accounts
  • *
  • Posts: 1160
  • Never stop learning
    • View Profile
DOM basics
« on: Feb 06, 14, 03:35:12 PM »

Working with the DOM

The DOM can be found on the HeroScript tab on the top line of the Editor.
The wiki, on this page - http://hewiki.heroengine.com/wiki/DOM_Editor - show users how  to work with the DOM.

In my tutorials, I make use of the DOM. Here is an example:

In the DOM, create a new (client side) class
name = TMP_Button
archtype = guicontrol
add a parent to the class, _GUIButton

click open script

To create a new class, make sure the Read Only box is not checked. Make sure you are on the right type, by checking the client or server button. Then click the New Class button.



Add in the values to the small window. You will need some type of description. Then click OK. This will create the class in the DOM. To add a parent, follow on the wiki under Definition Display and Editing. This will give the class a base to inherit from. After adding the parent click save. It will then add all the fields with the parent class to your new class. From there, you can add fields if you need to. The click open script. It automatically assigns the correct name to the script so you don't have to worry about typos.


Making changes - fields.

This is similar to making a new field, then adding it in, and removing the old field, where you need to change the name in script to access that new field.

When changing a field from one variable type to another, you need to first remove that field from the class definition. This disassociates the field from the class, so the class no longer knows about this field. Changing the variable type of the field is now similar to making a totally new field with the same name. You need to go into the script and comment out every use of that field, so that the script no longer relates to that field. After the field gets the new variable type, you can then add it to the class. At this point it is now a new field. Then in script you can uncomment the field, and make sure you now accept it with its new variable type. For example: when changing a float to an integer, make sure the code is not expecting a float value.

Logged
Lead scripter for EO, Repop helper.
HSL Video tutorials:
https://community.heroengine.com/forums/index.php/topic,1719.msg36858.html#msg3685

Tarra2012

  • General Accounts
  • *
  • Posts: 113
    • View Profile
Re: DOM basics
« Reply #1 on: Feb 11, 14, 12:42:35 PM »

*Ignore this*
Saw you already mentioned the default "read-only" checkbox.
« Last Edit: Feb 11, 14, 04:59:58 PM by Tarra2012 »
Logged