Jump to content




I get a :12: expected string, number {solved}


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

#1 Tiberium_117

  • Members
  • 23 posts

Posted 31 January 2016 - 09:30 PM

hello there fellow Coders I am attempting to build the ultimate Lock for a piston Door that will secure my applied energistics Core and only allow certain people to enter and leave... the build uses project red bundled wires and the open periphial sensor. I tried everything to get this to work but to no success.. I keep getting the error DoorLock:12: Expected String, Number...
please help

  • local sensor = peripheral.wrap("top")

  • local output = ("right")

  • local initial = ("colors.combine(colors.white, colors.orange)")

  • local minX = ("-5")

  • local maxX = ("5")

  • local minY = ("5")

  • local MaxY = ("5")

  • local MinZ = ("-2")

  • local MaxZ = ("2")

  • redstone.setBundledOutput(output,initial)

  • function getLocation()

  • info = sensor.getPlayerData(name)

  • pos = info.position

  • if pos.x >= minX and pos.x <= maxX and

  • pos.y >= minY and pos.y <= maxY and

  • pos.z >= minZ and pos.z <= maxZ then

  • redstone.setBundledOutput(output1, not initial)

  • end

  • end

  • while true do

  • players = sensor.getPlayerNames()

  • if players == 0 then

  • redstone.setBundledOutput(output1, initial)

  • sleep(0.7)

  • else

  • if name == "name1" then

  • getLocation()

  • break

  • else

  • if name == "name2" then

  • getLocation()

  • break

  • else

  • if name == "name3" then

  • getLocation()

  • break

  • else

  • if name == "name4" then

  • getLocation()

  • break

  • end

  • end

  • end

  • sleep(0.5)

  • end

  • end

  • end

Edited by Tiberium_117, 31 January 2016 - 10:52 PM.


#2 KingofGamesYami

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

Posted 31 January 2016 - 09:39 PM

I'm guessing you've got some spacing in there that's different from what you posted, since line 12 couldn't error like that. This line could though:
redstone.setBundledOutput(output,initial)

..and most certainly would, since your initial is
local initial = ("colors.combine(colors.white, colors.orange)")

And should be
local initial = colors.combine(colors.white, colors.orange)

(You can remove the parenthesis from all your variable declarations FYI)

#3 Tiberium_117

  • Members
  • 23 posts

Posted 31 January 2016 - 09:50 PM

that worked, now I get a new error ("face Palm")

.temp:25: attempt to call nil

I never heard of that before?

#4 KingofGamesYami

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

Posted 31 January 2016 - 10:28 PM

Again, your 25th line couldn't throw that error. I suspect you've spelled getLocation incorrectly somewhere, as that's called on lines close to that one.

attempt to call nil means you are trying to use a function that doesn't exist. For example, if I created a program like this:
thisisafunctionidoubtanyonewouldevermake()

It'd throw that error (filename:1:attempt to call nil)

#5 Tiberium_117

  • Members
  • 23 posts

Posted 31 January 2016 - 10:52 PM

thank you for the help KingofGamesYami :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users