oooooooooott Posted March 24, 2015 Share Posted March 24, 2015 Yo, friendly peeps! I've been having trouble sorting out some code I wrote earlier today for a mod I've been working on.I've been using This tutorial as reference/help, and same goes with Robomat's astounding lockpicking mod (the way he made sounds in the world? Eek! ). Although... I haven't used that much (make that any) Lua in the past (used to C# ._.), and I'm sure I've made a mistake somewhere (the compiler agrees), but I haven't the slightest idea what I did wrong or how to fix it. If any of you amazing peeps would like to lend a hand, that would be great. SetNoisemaker = {};function SetNoisemaker.createMenu(_player, _context, _items) local player = getSpecificPlayer(_player); local clickedItems = _items; local item; local stack; local time; if #clickedItems > 1 then return; end item = entry; if item then _context:addOption("Set timer for 15 seconds", clickedItems, SetNoisemaker.setTimer(0.25 ,player, item)); _context:addOption("Set timer for 30 seconds", clickedItems, SetNoisemaker.setTimer(0.5 ,player, item)); _context:addOption("Set timer for 45 seconds", clickedItems, SetNoisemaker.setTimer(0.75 ,player, item)); _context:addOption("Set timer for 60 seconds", clickedItems, SetNoisemaker.setTimer(1 ,player, item)); endendfunction SetNoisemaker.setTimer(_time, _player, _item) time = _time; _item:getContainer():Remove(_item); _player:Say("This should do it. Better move!");endlocal noisemaker = self.object;local tile = noisemaker:getSquare();local startTime = GameTime:getInstance():GetMinutes();local refreshTimer = function() noisemaker = self.object; tile = noisemaker:getSquare(); local currentTime = GameTime:getInstance():GetMinutes(); if(currentTime == startTime + time) getSoundManager():PlayWorldSound("sledgehammer", false, tile, 0, 35, 30, true); addSound(door, tile:getX(), tile:getY(), tile:getZ(), 15, 30); end endEvents.OnTick.Add(refreshTimer); Link to comment Share on other sites More sharing options...
oooooooooott Posted March 24, 2015 Author Share Posted March 24, 2015 I am... stupid ._.I was still in C# mode, and forgot a 'then'.Well, that's one down... Edit: Aaand.... I also forgot to make an event for the context menu... Aaand... I declared a variable twice O.OI've got it working now. Sorry to bother anybody who read this >.< Edit Edit: Also I forgot an event. And I think that's about it. I hope I documented exactly what I did wrong well enough >.<Also, I forgot to put the code in a spoilers. So ouch, there's another thing. D: Link to comment Share on other sites More sharing options...
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