Message 1 of 6
Struct: call member function from another member function for same instance

Not applicable
03-24-2008
11:12 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need to call one member function from another inside struct, but it dosen't work just like that. When i try to call another function it says it's "undefined".
I did few google searches and found this forum: http://forums.cgsociety.org/archive/index.php/t-272425.html
On that forum same problem was addressed and resolved with this snippet:
struct objectStruct
(
--Function Definitions, those two are the magic lines 🙂
Function1=fn Function1(), --define functions
Function2=fn Function2(),
--locals
--Functions
fn Functions1=
(
Function2()--this would not work if they were not defined as empty above
),
fn Function2=
(
--function2 stuff.
)
)
Looks like all i needed were function definitions in the top of a struct. Well, sounds right...
But it didn't work for me!! MaxScript parsed these definitions as they were struct functions and therefore spited out
syntax errors about missing "=" signs :)). It looks like it doesn't even know about function definitions :(.
Maxscript documentation doesn't say about function definitions ether, why is that?
So if this solution didn't work how else do i call one function from another inside same instance of a struct?
I did few google searches and found this forum: http://forums.cgsociety.org/archive/index.php/t-272425.html
On that forum same problem was addressed and resolved with this snippet:
struct objectStruct
(
--Function Definitions, those two are the magic lines 🙂
Function1=fn Function1(), --define functions
Function2=fn Function2(),
--locals
--Functions
fn Functions1=
(
Function2()--this would not work if they were not defined as empty above
),
fn Function2=
(
--function2 stuff.
)
)
Looks like all i needed were function definitions in the top of a struct. Well, sounds right...
But it didn't work for me!! MaxScript parsed these definitions as they were struct functions and therefore spited out
syntax errors about missing "=" signs :)). It looks like it doesn't even know about function definitions :(.
Maxscript documentation doesn't say about function definitions ether, why is that?
So if this solution didn't work how else do i call one function from another inside same instance of a struct?