Basic Problem (Function definition)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/11/2006 at 02:02, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   10 
    Platform:      Mac OSX  ; 
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    im checking the cinema r10 scripting capabilities and
    i seem to be stupid but the simplest examples dont work!
    i m talking about function definitions, and the main function

      
    main ()  
    {  
    println("hello");  
    }  
    

    ends with "FAIL, Too , many parameters" ...

      
    test_func (str)  
    {  
    println (str);  
    }  
      
    main ()  
    {  
    test_func ("test")  
    }  
    

    ends with "FAIL, Variable or function expected" ...

    ??? i dont get why this does not work...
    there is no R10 coffee SDK yet,
    but is it possible that these basic things have changed?
    help !
    :)



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/11/2006 at 03:00, xxxxxxxx wrote:

    The main function needs 2 parameters, doc and op.

    Here the corrected code:

      
    main (doc,op)  
    {  
    println("hello");  
    }  
      
    /*--------------*/  
      
    test_func (str)  
    {  
    println (str);  
    }  
      
    main (doc,op)  
    {  
    test_func ("test");  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/11/2006 at 04:01, xxxxxxxx wrote:

    thanks for the help! but it does NOT work ! both scripts just fail !

    for dummies as me to be sure :

    1. i open the console
    2. i open the script manager
    3. i select new (script)
    4. i paste the script into the script manager

    <CODE>test_func (str)
    {
    println (str);
    }

    main (doc,op)
    {
    test_func ("test");
    }</CODE>

    5. i press execute
    6. i look at console window
    7. there it says "[FAIL] Script 'test' Line 1 Pos 12 : Variable or function expected"

    this is about cinema R10, maybe because it's the demo version?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/11/2006 at 04:25, xxxxxxxx wrote:

    Sorry, made a little mistake, you have of course to remove the spaces in the functions so for instance you write main(doc,op) instead of main (doc,op).

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/11/2006 at 05:07, xxxxxxxx wrote:

    hey, that worked ! THANKS! :)

    one LAST QUESTION...

    about main(doc,op) :
    what is "doc" ? the active document? and what is op?



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 20/11/2006 at 06:06, xxxxxxxx wrote:

    yes, "doc" is the active document and "op" is the selected object. it originally comes from where there were only COFFEE tags and not scripts. these tags were attached to an object and thus had always a guaranteed document and object. with scripts you have to check if the op parameter is true.

    cheers,
    Matthias


Log in to reply