Talk:Showing the Time in A.M. and P.M.
I encountered this issue when making a clock in my mod, the following has been extracted from the article.
Now we have the minutes in decimals but we need to translate it to minutes. To that we use this:
set time to ((time / 5) * 3)
From the previous line we have retrieved the value of minutes passed in decimal form, correct? eg. 30mins = 0.5. The above line of script should effectively change the minute value from a base 10 number system to a base 60 number system. But all is not well with this. Observe
Message "The Current time is %.2f A.M. " time
It would appear that converting into base 60 is negated here by the modulus operation (integer division with remainder).
Does anyone know how get the ingame message to display what appears to be a decimal but is in fact adhering to a base 60 number system?
Please forgive any formatting discrepancies, I joined the wiki today. --Antares 01:43, 25 August 2008 (EDT)
- %.2f is a message formatting code that will display a variable with two decimal places. This has nothing to do with the modulus operation. See the Message page for more information.
- --Qazaaq 05:54, 25 August 2008 (EDT)
- Yes, thankyou for the timely respone. It seems rather it was simply my Oblivion game or PC that was at fault because now all of a sudden it seems to work perfectly in base 60. Feel free to remove this talk page once you have read it. I would do it now but I think other members need to know that the issue is resolved and was fully and completely functional to begin with.Antares 01:26, 26 August 2008 (EDT)
- There has been development! The script itself seems to work fine, but some weird bug seems to prevent the game (mine at least) from executing it properly. I have a save file inside the same cell as an activator using this script. I have tried loading from the main menu and saves that aren't in the cell to no effect. However, in the same cell I have another activator which removes 200 gold and adds a Welkynd Stone. After the appropriate items have been added/taken from my inventory further use of the "time activator" and the time is displayed in perfect base 60. Thought that was mighty interesting and would like to know if anyone has/encountered a similar bug with such a script. "Playsound" is also called when the items are added/removed.
- --Antares 04:13, 26 August 2008 (EDT)
Error with the Script[edit source]
The completed script only returns the correct time (down to +/- 0.5minutes, a natural limitation of the vanilla language thus far) from 11pm-12am. Every other hour of the day the time will be returned as a decimal and not in base 60. I found that if the following code is added to each Elseif block the correct time is returned in flawless base 60 for each of the 24 hours of the day.
Elseif time < x1 Set Hour to x1-1 Set time to time - Hour Set time to ((time / 5) * 3) Set time to time + Hour Elseif time < x2 Set Hour to x2-1 Set time to time - Hour Set time to ((time / 5) * 3) Set time to time + Hour Elseif time < x3 ... etc, etc
What I am trying to say is that the code specifying the divisions of an hour needs to be within each block that defines a given hour.
I will update the article in 24 hours if no one has any disagreements or proof otherwise. I did test it fairly comprehensively myself, so I find the latter to be quite doubtful.
--Antares 08:04, 26 March 2009 (EDT)
- Unnecessary. Looking at the script, it appears to be missing an EndIf, and that's all. I'll change that. But anyway, that block need not appear in every ElseIf - just make it appear after the conditions, so that it affects all of them. This the author intended to do, but forgot an EndIf.
- Dragoon Wraith TALK 19:37, 26 March 2009 (EDT)
- Actually, there's a lot of unnecessary code here. The entire set of if/elseif's for setting Hour are unnecessary - just make Hour a short. This page oughta be rewritten entirely, methinks. I will but don't have time to do so right now.
- Dragoon Wraith TALK 19:40, 26 March 2009 (EDT)
- COBL's script has worked flawlessly for a while now. I'll put it up, either later tonight or tomorrow.
- --Haama 20:45, 26 March 2009 (EDT)
Can someone please correct the information in the article. Dragoonwraith and Haama suggested they know how to make the script better/more correct. I have such a functionality in a mod I am working on and although I have a working script by the sounds of it there is much more optimal code going around. Cheers guys.
Antares 02:24, 5 August 2009 (EDT)
- Done QQuix 09:36, 5 August 2009 (EDT)