Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

isdflash

Members
  • Content Count

    2
  • Joined

  • Last visited

About isdflash

  • Rank
    Junior Member

Profile Information

  • Gender
    Male
  • Location
    UK
  1. thanks. could not see for looking.
  2. hi i have a problem i have been trying to figure out for a few days now and i am drawing up a blank. I have to code below which i have to admit is not my own. i have this saved as move.lua local robot = require('robot') local component = require('component') local move = {} local commands = {} commands['f'] = robot.forward commands['b'] = robot.back commands['u'] = robot.up commands['d'] = robot.down commands['tl'] = robot.turnLeft commands['tr'] = robot.turnRight commands['ta'] = robot.turnAround commands['s'] = robot.swing commands['sd'] = robot.swingDown commands['su'] = robot.swingUp commands['p'] = robot.place commands['pd'] = robot.placeDown commands['pu'] = robot.placeUp commands['dr'] = robot.drop commands['dru'] = robot.dropUp commands['drd'] = robot.dropDown commands['su'] = robot.suck commands['sud'] = robot.suckDown commands['suu'] = robot.suckUp commands['us'] = robot.use commands['usu'] = robot.useUp commands['usd'] = robot.useDown --if component.piston then -- commands['p']=component.piston.push --end --if component.inventory_controller then -- commands['e']=component.inventory_controller.equip --end function move.act(act) local status, reason, c c = commands[act] if c then status, reason = c() return else print("Not found" .. act) end if not status then end end function move.move(path) --path = ('f2,r,f1,b') for word in string.gmatch(path, '([^,]+)') do local num = string.match(word, '%d+') or 1 local word = string.match(word, '[^%d]+') for i=1,num do move.act(word) end end end if i pass the instructions to move the robot at the end of this script then it moves but when i try passing instructions to move the robot via a different script like below then i get an error attempt to index a local 'move' ( a nil value) the code i am using to pass the information is this local move = require("move") for i=1,10 do move.move('f') end move.move('b10') anybody got any ideas. thanks in advance
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.