gazzxr Posted November 17, 2010 Share Posted November 17, 2010 Hey , whats up , i'm new , and i'm learning Lua scripting , my 1st mission was to make object go up and down . so i wrote this : --DDC OMG generated script: function omgInit() omg6537 = createObject(8546,-294.5478515625,1006.5712890625,144.27891540527,0,0,0) omgMoveomg6537(1) end function omgMoveomg6537(point) if point == 1 then moveObject(omg6537,250,-294.5478515625,1006.5712890625,150.9789276133,0,0,0) setTimer(omgMoveomg6537,250 + 1500, 1, 2) elseif point == 2 then moveObject(omg6537,250,-294.5478515625,1006,5712890625,144.27891540527,0,0,0) setTimer(omgMoveomg6537,250 + 1500, 1, 2) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omgInit) and all was OK , then when i started my resource ( script ) object just goes up, then after 1500ms it returns to its normal position . How do i make this loop? up&down? Link to comment
greacius Posted November 17, 2010 Share Posted November 17, 2010 well when it is at point 2... it should go back to point 1 right? So in the function omgMoveomg6537() replace the timer after the point == 2 with: setTimer(omgMoveomg6537,1500,1,1) It should work then. Link to comment
gazzxr Posted November 17, 2010 Author Share Posted November 17, 2010 greacius said: well when it is at point 2... it should go back to point 1 right?So in the function omgMoveomg6537() replace the timer after the point == 2 with: setTimer(omgMoveomg6537,1500,1,1) It should work then. Damn , it does not work. i replaced it , now it looks like --DDC OMG generated script: function omgInit() omg6537 = createObject(8546,-294.5478515625,1006.5712890625,144.27891540527,0,0,0) omgMoveomg6537(1) end function omgMoveomg6537(point) if point == 1 then moveObject(omg6537,250,-294.5478515625,1006.5712890625,150.9789276133,0,0,0) setTimer(omgMoveomg6537,250 + 1500, 1, 2) elseif point == 2 then moveObject(omg6537,250,-294.5478515625,1006,5712890625,144.27891540527,0,0,0) setTimer(omgMoveomg6537,1500,1,1) end end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omgInit) ANd yes , it should go back to same point as it started from , at the same speed. Link to comment
greacius Posted November 17, 2010 Share Posted November 17, 2010 Does it give any error? Link to comment
gazzxr Posted November 17, 2010 Author Share Posted November 17, 2010 greacius said: Does it give any error? No Link to comment
Aibo Posted November 17, 2010 Share Posted November 17, 2010 you didn't "wrote" this script, it was generated by my resource. and unless you've edited it (and it looks like you did), it should work fine. line 11(12): moveObject(omg6537,250,-294.5478515625,[color=#FF0000]1006,5712890625[/color],144.27891540527,0,0,0) 1006,5712890625 > 1006.5712890625 fix this. Link to comment
gazzxr Posted November 17, 2010 Author Share Posted November 17, 2010 Aiboforcen said: you didn't "wrote" this script, it was generated by my resource. and unless you've edited it (and it looks like you did), it should work fine. line 11(12): moveObject(omg6537,250,-294.5478515625,[color=#FF0000]1006,5712890625[/color],144.27891540527,0,0,0) 1006,5712890625 > 1006.5712890625 fix this. Silly me , stupid mistakes >.> , thanks man , it realy helpd , but i'm still not getting it to go up&down all the time... looping. AND YES , its Copied from you're program (OMG) so i "Wrote" it down... Useful dough... Link to comment
dzek (varez) Posted November 17, 2010 Share Posted November 17, 2010 Your posts suggested that's your work, but whateveer.. Link to comment
gazzxr Posted November 17, 2010 Author Share Posted November 17, 2010 dzek (varez) said: Your posts suggested that's your work, but whateveer.. You got it wrong .... now can someone help me? Link to comment
dzek (varez) Posted November 17, 2010 Share Posted November 17, 2010 "OMG" generates movement back and forth. If you broken it with your edits - just make it perfect in generator, don't edit it if you don't know what are you doing. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now