Category | Scripting |
Created | 06.08.2013 07:20 |
Michael Hellmuth (Unknown) | 06.08.2013 07:24 |
---|---|
Hi There, after programming a lua for a precise seeding machine, where i would like to rotate some parts, i get the error: Error: LUA running function 'update' D:/code/lsim2013_desktop/build/finalbin/dataS/scripts/shared/scenegraph.lua(19) : attempt to perform arithmetic on local 'x' (a nil value) as i read the docu, i can rotate the parts, whithout give em before the coordinates. Or is it need to get the rotation with getRotate() before trying to rotate it? Here´s the lua: -- T6Z = {}; function T6Z.prerequisitesPresent(specializations) return SpecializationUtil.hasSpecialization(SowingMachine, specializations); end; function T6Z:load(xmlFile) self.seedwheel1 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.seedwheel_1#index")); self.seedwheel2 = Utils.indexToObject(self.components, getXMLString(xmlFile, "vehicle.seedwheel_2#index")); end; function T6Z:delete() end; function T6Z:mouseEvent(posX, posY, isDown, isUp, button) end; function T6Z:keyEvent(unicode, sym, modifier, isDown) end; function T6Z:update(dt) if self:getIsActive() then if self.isTurnedOn then rotate(seedwheel1,2.5,1,1); rotate(seedwheel2,2.5,1,1); end; end; end; function T6Z:updateTick(dt) end; function T6Z:draw() end; print("Script loaded: T6Z.lua"); -- |
Michael Hellmuth (Unknown) | 07.08.2013 06:55 |
---|---|
it´s working now. I forgot the self. before the seedwheel1+2 in the update function ... so it is clear that the enginge don´t know what to do |
Note: Log in to post. Create a new account here.