I get a compilation error whenever I try to use the
set effect constant vector element and certain other Dark Shader commands.
Here's some typical code put together from the Dark Shader Export All option and the Dark Shader Help file for Passing Lights To a Shader:
rem Initialise
sync on
sync rate 60
rem Load model and shader effect
load object "cube.dbo", 1
autocam off
load effect "Normal Mapping.dbs", 1, 1
set object effect 1, 1
`get object effect(1, -1) ` is this needed? - see Dark Shader Help file (but gives same compilation error)
` add the lights - see DarkShader Help file under Exporting
null = make vector4(1)
` set the ambient light
set vector4 1, 0.2, 0.2, 0.2, 0.0
set effect constant vector 1, "AmbientColor", 1
` set three lights
set effect technique 1, "DBLight3"
` first light
set vector4 1, -400.0, -100.0, 0.0, 1000.0
set effect constant vector element 1, "LightPos", 0, 1 ` this fails to compile
` confusingly, the syntax seems to be:
` set effect constant vector element fxID, constant$, lightID, vectorID
set vector4 1, 1.0, 0.0, 0.0, 0.0 ` full red light
set effect constant vector element 1, "LightColor", 0, 1 ` ditto confusing syntax
` second light
set vector4 1, 400.0, 100.0, 0.0, 1000.0
set effect constant vector element 1, "LightPos", 1, 1
set vector4 1, 0.0, 1.0, 0.0, 0.0 ` full green light
set effect constant vector element 1, "LightColor", 1, 1
` third light
set vector4 1, 0.0, -400.0, 0.0, 1000.0
set effect constant vector element 1, "LightPos", 2, 1
set vector4 1, 0.0, 0.0, 1.0, 0.0 ` full blue light
set effect constant vector element 1, "LightColor", 2, 1
do
rem Draw main camera
sync mask %001 : sync
loop
Edit I might be doing something silly but I can't see it. I get the same error using U6.3, U6.7 and U7.7. Perhaps there's a file missing on my system?
Here's the compiler output window: