Not recognizing variables

  • Neospector
    27th May 2011 Member 0 Permalink
    #include

    int update_SOAP(UPDATE_FUNC_ARGS) {
    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 {
    if ((r&0xFF)==PT_OIL && 15>(rand()%1000))
    part_change_type(r>>8,x+rx,y+ry,PT_SUDS);
    }
    }

    The debug will run properly, but when I place the element it breaks, saying it cannot recognize variable "r" which, even I can tell, shouldn't be happening because of the int r, rx, ry; line.
    So...what am I doing wrong this time?
  • me4502
    27th May 2011 Member 0 Permalink
    Why have you got
    in your code???


    Also r>>8 should be in []'s - the one in the change part type
  • Neospector
    27th May 2011 Member 0 Permalink
    @me4502 (View Post)
    That just gives me errors. This is taken from the neut.c code, so it should be working.
    I don't know what that is in there.
    Edit: I don't have it in there, it's the forum doing that.
  • me4502
    27th May 2011 Member 0 Permalink
  • Neospector
    27th May 2011 Member 0 Permalink
    @me4502 (View Post)
    Visual Studios.
  • me4502
    27th May 2011 Member 0 Permalink
    @Neospector (View Post)
    It hates everything... Try compiling in code::blocks... I know it's terrible but its nit an idiot
  • Neospector
    27th May 2011 Member 0 Permalink
    @me4502 (View Post)
    But then I have to learn how to set everything up again. D:
    image
    But normally it's just my failure at coding. You sure there's nothing wrong?
    I found out what you meant by the []'s but it still wont reconize "r"
  • me4502
    27th May 2011 Member 0 Permalink
    @Neospector (View Post)
    I don't think they are necessary after looking at neut.c

    I got it :)

    You are missing
    r = pmap[y+ry][x+rx];
    if ((r>>8)>=NPART || !r)
    continue;
  • Neospector
    27th May 2011 Member 0 Permalink
    @me4502 (View Post)
    And where does this go?
  • me4502
    27th May 2011 Member 0 Permalink
    @Neospector (View Post)
    Just above your if oil