Script error

  • MrDucku
    2nd Jun 2016 Member 0 Permalink

    in the script

    local function checkev(i, x, y, n, nt)
      if sim.partProperty(i, sim.FIELD_TEMP) >= 373 then
        if math.random(1,2) = 1 then
          sim.partChangeType(i, elem.MYMOD_PT_DIRT)
        else then
          sim.partChangeType(n, elem.DEFAULT_PT_WTRV)
        end
      end
    end
    elem.property(mud, "Update", checkev)

     

    it says it wants a then statment near the = when we choose the random number

    could someone please tell me what is wrong (I have all the element defined)

    Edited once by MrDucku. Last: 1st Jun 2016
  • jacob1
    2nd Jun 2016 Developer 0 Permalink
    There are two broken lines. This should be an ==

    if math.random(1,2) == 1 then

    and you don't need the "then" after the else. Only after if and elseif. Besides that I think it looks good! (I didn't test it)
  • MrDucku
    2nd Jun 2016 Member 0 Permalink

    awesome, thanks, overlook small things XD