Scripting for noobs

  • minecraft-physics
    17th Mar 2015 Member 1 Permalink
    Hi all, self-professed lua noob here working on writing my first script.
    I'm trying to write a script that, given a set of parameters (startx, starty, step, start) will start at the point (startx, starty) and change every [step]th element's ctype to 2^(position in stack) e.g. to set a line of 30 FILT pixels to each sequential wavelength.
    I have two main questions:
    • What is the correct/best way to build a loop to satisfy these conditions? (i.e. limit global variables)?
    • How does one change the properties of an element at coordinates (x,y)? is it sim.partProperty(sim.pmap(x,y), "ctype", value)?
  • boxmein
    17th Mar 2015 Former Staff 0 Permalink
    Something like this should be your action code:
    -- you can replace sim.FIELD_CTYPE with "ctype"
    -- and elem.DEFAULT_PT_DUST with an integer between 0 and 255, because that's the range element IDs come in
    sim.partProperty(sim.partID(x, y), sim.FIELD_CTYPE, 2^stack_pos)


    And you could fashion a for-loop over the particles, incrementing stack_pos independently.
  • friddo
    23rd Mar 2015 Member 0 Permalink
    This post has been removed by jacob1: spam