Watching variables in a script

When debugging a script, it's sometimes valuable to check the value of a variable, or the contents of a structure or array. This can be done quite easily in FRED's scripting editor.

However, the one thing to note is that you have to specify each item "to watch" individually - you can't just browse the whole of an array or structure

  1. Open the script editor
  2. Left-click in the gray margin at the left side to add a breakpoint at a line of your choosing
  3. Run the script
  4. In the area at the top, note that there is a tab on the left side labelled "Watch", click this.
  5. Then, in the blank window, write in the variables that you wish to keep an eye on. In the picture at the top of this page there are three examples:
    1. a single variable: lens
    2. a member of the T_ENTITY structure:
    3. the contents of one cell of an array: myArray(2)
  6. Then as you step through the script (e.g. by using the "step into" button) the value of these variables will be dynamically updated at the top.

Note: if you don't see this mini toolbar at the top of the script debug window, then select from the FRED main menu select Tools / Preferences... / Format tab/ Script Editor Window / Show toolbar

Still need help? Contact Us Contact Us