Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Accessing records of existing DBP commands

Author
Message
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 15th May 2012 17:09
Hello

I'm trying to access the individual elements of the Set Shadow Shading On command. They are as follows: Object#,Mesh#,Range,Shader. I created a Type and defined records to match the elements of the above mentioned DBP command. My thinking is that if I'm able to set the Type's records that I created to that of the DBP command's records, I might be able to manipulate an individual objects shading settings(specifically the range element) within a loop.
Thank you for your help.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 15th May 2012 22:07
I'm not entirely sure what you mean. Could you be more specific, and define the word "record" for me.

TheComet

Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 15th May 2012 23:30
Hello Comet,

Apologies. I misread the terminology in the HandsOnDarkBasicPro Book. I was referring to a field, not a record. The word record refers to all of the contents(fields) within a given type. I meant to equate "fields" with "elements"...Object#,Mesh#,Range,Shader are all fields within the type Set Shadow Shading On. Combined, all of the fields make the Set Shadow Shading On record. Here's some sample code I created in an attempt to pass the field data from Set Shadow Shading On to a custom type.


I get an error message saying shadow doesn't receive a value from Set Shadow Shading On. As previously mentioned, my goal is to be able to access the range field within my custom type(ObjectShadows) so that I can manipulate it within a loop.
Thank you for your interest in this post and any help you can offer.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 16th May 2012 00:47
Thank you for clarifying.

Try removing the brackets from the command Set Shadow Shading on. Also, the command does not return a value. If you're in the DBP editor, click on the command and press F1 to get more information on how to use it.

You should also note that the mesh must be in a valid range or the command will fail. The valid range is 1-65535.



I've never used the command so I'm not sure why you have to pass a mesh to it... Let's hope someone knowledgeable pops up and answers that.

TheComet

zeroSlave
17
Years of Service
User Offline
Joined: 13th Jun 2009
Location: Springfield
Posted: 16th May 2012 00:48 Edited at: 16th May 2012 04:13
SET SHADOW SHADING ON does not return a value, so nothing can = SET SHADOW SHADING ON. It would be similar to saying thisVariable = PRINT "Hello, World!"
PRINT also does not return a value.

You would probably just want to use this:
SET SHADOW SHADING ON a, b, c, d
Instead of:
shadow = Set Shadow Shading On (a, b, c, d)


TheComet got it first.

Also, These lines,
are already setting the variables in your type to those values. What you could do is


Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.
Jediam
14
Years of Service
User Offline
Joined: 14th Apr 2012
Location:
Posted: 16th May 2012 06:21
Hello friends,

Thank you for your help...This seems to have worked. I created a small sample which allows you to move around a light and modify the shadows range. You can use this freely if it helps you any. Take care.

Login to post a reply

Server time is: 2026-07-22 00:35:31
Your offset time is: 2026-07-22 00:35:31