errors with element coding

  • tommig
    15th Mar 2011 Member 0 Permalink
    hi again
    so I started coding my mod, and i started with the tutorial element, i correctly copied out the code, but on compiling i was given these errors
    1>------ Build started: Project: powder toy mod version 0, Configuration: Debug Win32 ------
    1> hetr.c
    1>src\elements\hetr.c(7): error C2059: syntax error : 'for'
    1>src\elements\hetr.c(7): error C2143: syntax error : missing '{' before '<'<br />1>src\elements\hetr.c(7): error C2059: syntax error : '<'<br />1>src\elements\hetr.c(7): error C2143: syntax error : missing '{' before '++'
    1>src\elements\hetr.c(7): error C2059: syntax error : '++'
    1>src\elements\hetr.c(7): error C2059: syntax error : ')'
    1>src\elements\hetr.c(8): error C2143: syntax error : missing '{' before '<'<br />1>src\elements\hetr.c(8): error C2059: syntax error : '<'<br />1>src\elements\hetr.c(8): error C2143: syntax error : missing '{' before '++'
    1>src\elements\hetr.c(8): error C2059: syntax error : '++'
    1>src\elements\hetr.c(8): error C2059: syntax error : ')'
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    sorry I can't pastebin, the school network blocks it (I go to a boarding school)
    any help?
    thanks again
    tommig
  • PizzaPlatypus
    15th Mar 2011 Member 0 Permalink
    @tommig
    Why have you made hetr.c!
  • vanquish349
    15th Mar 2011 Member 0 Permalink
    i feal sorry for you
  • tommig
    15th Mar 2011 Member 0 Permalink
    @PizzaPlatypus
    this does not solve my problem
  • Diissaster
    15th Mar 2011 Member 0 Permalink
    Would you give me the code. I will debug it.
  • tommig
    15th Mar 2011 Member 0 Permalink
    ok.
    here
    #include

    int update_HETR(UPDATE_FUNC_ARGS) {
    return 0;
    }
    int r, rx, ry;
    for(rx=-1; rx<2; rx++)<br /> for(ry=-1; ry<2; ry++)<br /> if(x+rx>=0 && y+ry>0 && x+rx pmap[y+ry][x+rx] &&
    (pmap[y+ry][x+rx]&0xFF)!=PT_HETR&&
    (pmap[y+ry][x+rx]&0xFF)!=0xFF)
    {
    r = pmap[y+ry][x+rx];
    if(parts[r>>8].temp+ (parts[r>>8].temp*0.2f)<=MAX_TEMP)<br /> parts[r>>8].temp += parts[r>>8].temp*0.2f;
    else
    {
    parts[r>>8].temp = MAX_TEMP;
    }
    return 0;
    }
  • PizzaPlatypus
    15th Mar 2011 Member 0 Permalink
    Is this in powder.c?
  • tommig
    15th Mar 2011 Member 0 Permalink
    @PizzaPlatypus
    no, it isn't, the wiki suggests that anew file is made for every element, view the latest source, there is a .c for every element
  • jacksonmj
    15th Mar 2011 Developer 0 Permalink
    Remove the
    return 0;
    }

    near the beginning. You only need that at the end of the function.
  • tommig
    15th Mar 2011 Member 0 Permalink
    nearly done, but not quite
    1>------ Build started: Project: powder toy mod version 0, Configuration: Debug Win32 ------
    1> hetr.c
    1>src\elements\hetr.c(21): fatal error C1075: end of file found before the left brace '{' at 'src\elements\hetr.c(3)' was matched
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    thats all, but there is only 20 lines in my code
    ????