Lua element: RAND

  • ssccsscc
    4th Jan 2014 Member 0 Permalink

    RAND create random element.

    local RAND = elements.allocate("MOD", "RAND")
    elements.element(elements.MOD_PT_RAND, elements.element(elements.DEFAULT_PT_DMND))
    elements.property(elements.MOD_PT_RAND, "Name", "RAND")
    elements.property(elements.MOD_PT_RAND, "Description", "Random element")
    elements.property(elements.MOD_PT_RAND, "Colour", 0x00744484)
    elements.property(elements.MOD_PT_RAND, "MenuSection", 11)
    local function rand(i)
    local w=math.random(1,176)
    tpt.parts[i].type=w
    end
    tpt.element_func(rand,RAND)

    Edited 10 times by ssccsscc. Last: 4th Jan 2014
  • Nobody905
    4th Jan 2014 Member 0 Permalink

    Looks fun.

  • CeeJayBee
    4th Jan 2014 Member 0 Permalink

    Does look fun, imma check this out tomorrow.  Currently on my tablet.

  • antoine
    5th Jan 2014 Banned 0 Permalink
    This post is hidden because the user is banned
  • CeeJayBee
    5th Jan 2014 Member 0 Permalink

    Maybe you could make some types of rand? Like PRAN (powders) SRAN (solids) or GRAN (lol, gases). You'd have to isolate the numbers of the powders 'n' shizzle like that.

  • ssccsscc
    8th Jan 2014 Member 0 Permalink

    CeeJayBee:

    Maybe you could make some types of rand? Like PRAN (powders) SRAN (solids) or GRAN (lol, gases). You'd have to isolate the numbers of the powders 'n' shizzle like that.

     you mean this?
    https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=18279

  • CeeJayBee
    8th Jan 2014 Member 0 Permalink

    @ssccsscc (View Post)

     I actually meant ones that spawn random powders or solids or gases, not an element with random properties xD

    Edited once by CeeJayBee. Last: 8th Feb 2014
  • Millions
    8th Jan 2014 Member 0 Permalink

    @CeeJayBee (View Post)

     I just did that. I used there powder toy ID's and put them into a table :P 

  • nucular
    8th Jan 2014 Member 1 Permalink
    I hacked together a fast script for that too.
    It features the RAND, GRAN, LRAN and SRAN elements that can be found inside the "special" element menu.

    They morph into different elements once they get in contact with fire. The script is quite laggy at the moment though.

    http://pastebin.com/cFdiqfEc
  • Millions
    8th Jan 2014 Member 0 Permalink

    @nucular (View Post)

     Nice. its quite addicting :P