+Darmstaedter Posted June 24, 2011 Share Posted June 24, 2011 (edited) Hi, I tried t = os.time('!*t') with t defined as number globally. However, I got the error message "Bad argument #1 to 'time' (expected table, got string) I tried with t = os.time([[!*t]]) but no success. What is wrong here? Thx for help! Edited June 24, 2011 by Darmstaedter Quote Link to comment
+cantuland Posted June 24, 2011 Share Posted June 24, 2011 This is something that I found within the programming of ZoneListLimiter. I remembered that I had toyed with this concept but found a workaround. This is just a copy-and-paste of some text that was commented out by starting the lines with two dashes. --This was the previous version. It is suspected to be the cause of crashes --so it is being replaced with the function below. Somehow, the process --occasionally got successfully started and everything worked after that. --function SecondsToWait(NeedToWaitThisLong) -- -- This is a function used only at the end of WaitForZLLToStop(). -- -- -- -- This function can also be used as a general WAIT feature without -- -- using a Wherigo countdown timer. -- -- -- -- TimeCode is how many SECONDS that have elapsed this YEAR, so timechecks -- -- done over New Years midnight celebration will not work right -- -- due to time starting over after the turn of the year. -- -- local Time1 = os.date("!*t") -- local TimeCode1 = (Time1.sec+(Time1.min *60)+(Time1.hour *60*60)+(Time1.yday *60*60*24)) -- local WaitTimeSoFar = 0 -- while WaitTimeSoFar < NeedToWaitThisLong do -- local Time2 = os.date("!*t") -- local TimeCode2 = (Time2.sec+(Time2.min *60)+(Time2.hour *60*60)+(Time2.yday *60*60*24)) -- WaitTimeSoFar = TimeCode2 - TimeCode1 -- end --while --end --function SecondsToWait Hope this helps you out. Quote Link to comment
+Darmstaedter Posted June 24, 2011 Author Share Posted June 24, 2011 (edited) Thanks a lot! It works at least partly for the things I have planned it to use. Interesting, that without argument of os.date() the calculation gives a runtime error in "min". local Time3 = os.date() local TimeCode3 = (Time3.sec+(Time3.min *60)+(Time3.hour *60*60)+(Time3.yday *60*60*24)) Edited June 24, 2011 by Darmstaedter Quote Link to comment
+Tequila Posted June 26, 2011 Share Posted June 26, 2011 Here is how I did it. For example, to get the current hour, set up the following in User Functions: --Return the Hour function FullMoonHour() t=os.date('*t') start_day_hour=t.hour return start_day_hour; end In your code, simply set you local variable equal to this User Expression. Let me know if you want ne to post screen caps of URWIGO. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.