Jump to content




Mob Farm Code Error

help lua computer

  • You cannot reply to this topic
4 replies to this topic

#1 cocotoffee

  • Members
  • 12 posts

Posted 03 September 2014 - 12:34 AM

I am trying to create a code for an advanced monitor that I can click to change the active mob in a MFR auto-spawner. I am trying to automate this with a peripheral proxy but the basic selection part of the code I can not seem to get working. I want to just click the menu at the top then the mob, but when I try to click the menu the error: mobfarm:57: attempt to compare nil with number occurs. I greatly appreciate any help that is given! Thank you!

Code (I couldn't get the paste function to work): Pastebin at BSdryL92

Picture: Pastebin at ZmZS5kqT.

Please and thank you!

#2 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 03 September 2014 - 01:39 AM

lua is case sensitive.
while true do
local event, button, x, y = os.pullEventRaw() --#lowercase x, y
  if slc == 0 then
    if event == "mouse_click" then
      if X >=2 and X <=8 and Y ==1 and button ==1 then --#uppercase X, Y
      drawMenu1()
      slc = 1
        else
        drawDesktop()
      end
    end
   elseif slc == 1 then
     if X >=1 and X <=11 and button ==1 and Y==3 then slc = 0 --#uppercase X, Y
       os.reboot()
       else
       slc = 0
       drawDesktop()

     end
  end
end


#3 cocotoffee

  • Members
  • 12 posts

Posted 03 September 2014 - 04:09 AM

Oh my gosh! Thank you so much!!! It is working perfectly now! On a side note, if I were to make all the coordinates lowercase would that work, as long as they are consistent? Or do they have to be uppercase for lua no matter what?

#4 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 03 September 2014 - 07:25 AM

It doesn't matter whether they're uppercase or not, so long as they're consistent.

#5 cocotoffee

  • Members
  • 12 posts

Posted 03 September 2014 - 09:45 PM

Thank you! I'll be sure to remember this in the future.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users