Some questions 'bout some stuff

  • tommig
    10th Nov 2011 Member 0 Permalink
    Hi guys!
    I have a couple of questions about variable in the code

    1) I would like to have it, so that two elements react, and the products heat up.
    E.g. If (r&0xFF)==PT_X
    { part_change_type(i,x,y,PT_Y);
    insert heat code here
    }

    2) How do I say "if the life of the element is X"?

    3) How do I set the pressure (e.g. for a pressure insulator)

    Thanks
    Tommig
  • cctvdude99
    10th Nov 2011 Member 0 Permalink
    @tommig (View Post)
    1:
    parts[i].temp=parts[i].temp+(number here)
    That's my guess...
    If you look in acid's code, there is probably some more complex and better way of doing it, but meh.

    2:
    if (parts[i].life == x)
    Pretty simple, really.
    x is the number you want, btw.

    3:
    I used to know that... Now I have no idea. D:

    Hope they help anyway. :)
  • tommig
    10th Nov 2011 Member 0 Permalink
    Well, 1 works
    Can't quite do 2
  • Xenocide
    10th Nov 2011 Former Staff 0 Permalink

    1. parts[i].temp+=int; is the shorthand solution.



    2. if(parts[i].life == int){
          doStuff();
      }




    3. pv[y/CELL][x/CELL]=int;


    In all of the above, replace int with the integer of your choice.
  • tommig
    10th Nov 2011 Member 0 Permalink
    @Xenocide (View Post)
    You sir, are awesome!

    Xenocide:


    if(parts[i].life == int){
        doStuff();
    }


    doStuff! YEAH!