| Table of Contents Advanced:ZeoScript filterFilter infoLooks likeInput pins
Input pins may be accessed in scripts using the variable names  Output pins
Output pins may be accessed in scripts using the variable names  Options
The only options stored within the  
 
It is unnecessary to save the filter's script using the L3DT Script Editor window, as the script is stored in the filter and thus is saved in the graph file. 
 CommentsScript return valueScripts must return 0 to indicate success, or -1 to indicate failure. Example
A substantial example of the  int i j nx ny
hvar hMap
float period
float direction
float amplitude
float f
set hMap in0
set nx in1
set ny in2
set period in3
set direction in4
set amplitude in5
set out0 in0 // map from input to output
assert <isgt nx 0> "Heightfield is not initialised!"
//
// prepare progress box
//
progbox ProgBox
int64 p pmax
set p 0
set pmax ny
progbox.ShowWnd &ProgBox
progbox.SetTitle &ProgBox "Calculating"
//
// prepare some variables for the loop
//
float fx fy phase freq Angle_rad
set freq <div <mul 3.14159 2> period>
set Angle_rad <mul <div direction 180.0> 3.14159>
set Angle_rad <sub <div 3.14149 2> Angle_rad> // makes angles clockwise, with 0 at north
//
// here we go!
//
set j 0
do
  // set progress every line
  progbox.SetProgress &ProgBox p pmax
  incr p
  set i 0
  do
    set fx <mul <cos Angle_rad> i>
    set fy <mul <sin Angle_rad> j>
    set phase <add fx fy>
    
    set f <sin <mul freq phase>>
    set f <mul f amplitude>
    map.SetPixel hMap i j &f
        
  while <islt <incr i> nx>
while <islt <incr j> ny>
//
// flag map as being ready and modified
//
map.SetFlag hMap 1 true // MAPFLAG_ISREADY
map.SetFlag hMap 5 true // MAPFLAG_ISMODIFIED
return 0Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported |