+MtnGoat50 Posted September 10, 2008 Share Posted September 10, 2008 I'm working on a cartridge that involves touring a park. One particular area of the park is closed in the Winter. Can I design the cartridge so it will automatically skip that area during the winter? Quote Link to comment
+Geofellas Posted September 11, 2008 Share Posted September 11, 2008 I'm working on a cartridge that involves touring a park. One particular area of the park is closed in the Winter. Can I design the cartridge so it will automatically skip that area during the winter? You could include some author code that uses the lua function os.date (google "lua os.date" for more info) to determine the current date and insert logic based on that. This is definitely stepping outside the builder Here is some code (incomplete) that I have been playing with in case it helps: dow = {"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" } month = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" } function ztimerEvery5seconds:OnTick() -- #GroupDescription=Script -- -- #Comment=Script Comment -- local i = os.date("!%c") Wherigo.MessageBox{Text=[[]] .. i .. [[ Processed = ]] .. getdow(i) .. [[ ]] .. getdom(i) .. [[ ]] .. getmonth(i) .. [[(]] .. getmonthnum(i) .. [[)]] .. getyear(i) .. [[ ]] .. get24hour(i) .. [[:]] .. getmin(i) .. [[:]] .. getsec(i),} end function getdow(t) for j = 1 , 7, 1 do if string.sub(dow[j], 1, 3) == string.sub(t,1,3) then return dow[j] end end end function getmonth(t) for j = 1 , 12, 1 do if string.sub(month[j], 1, 3) == string.sub(t,5,7) then return month[j] end end end function getmonthnum(t) for j = 1 , 12, 1 do if string.sub(month[j], 1, 3) == string.sub(t,5,7) then return j end end end function getdom(t) return tonumber(string.sub(t,9,10)) end function getyear(t) return tonumber(string.sub(t,21,24)) end function get24hour(t) return tonumber(string.sub(t,12,13)) end function getmin(t) return tonumber(string.sub(t,15,16)) end function getsec(t) return tonumber(string.sub(t,18,19)) end Quote Link to comment
+MtnGoat50 Posted September 11, 2008 Author Share Posted September 11, 2008 Cool!! I think that's exactly what I was looking for. Thanks!!!! 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.