Yacoby's Time Display Fix

Post » Wed Jul 27, 2011 8:25 am

I've been using Yacoby's mod Time Display, and noticed it had a few issues, so I rewrote the mod to fix them, and figured I would share the code since I haven't seen any alternatives to his work. (This will require some knowledge of MWEdit, MWSE, etc,.)

What my update does\fixes.

1. Vanishing AM\PM textures. (They randomly vanished and appeared.)

2. Several wrapping issues, it would for example list the time as "00:00am", and I believe the original showed "01:60", instead of wrapping on 59.

3. I eliminated tons of stuff, and condensed it into one script. (Though, the setup menu could stand to be rebuilt now that the mod is updated.)

4. The code should be pretty flexible, so it could easily be made more customizable, as far as positioning the GUI, etc,. (ie, a few variables can move the whole display around, and it automatically adjust based on screen size. You shouldn't need to mess with the formulas, they should be correct, and scale properly across all resolutions.)

Note: It still needs a limiter of some sort, it runs every frame, so a check for minutes changed would probably be good, since it only needs to change once per minute anyways. (Game time minutes, mind you.)

Time Display Download
http://yacoby.silgrad.com/MW/Mods/timedisplay.htm

Install the mod, and you're ready to start editing it.

1. Download and install MWEdit. Link: http://sourceforge.net/projects/mwedit/
2. Download MWSE v0.94a, unzip it. Link: http://sourceforge.net/projects/mwse/
3. Install the updated function list from the MWSE v0.94a package into your MWEdit directory. ("customfunctions.dat" is what you are after.)
4. Load Morrowind.esm, and the Time Display .esp into MWEdit.
5. In MWEdit navigate to the "view" toolbar, and click "View Changed", that will hide everything but changes made by Yacoby's mod.

6. Delete everything(select, then right click, you'll see the option "Delete") except the following:

Globals: "CharGenState", "YAC_ScreenX", "YAC_ScreenY"
Script: "YAC_ST_Render"

7. Clean all the deleted items, select then right click. (You'll see the option "Clean".)

8. Go to startscripts, and right click the right panel, and add "YAC_ST_Render" as the startscript.

9. Replace the contents of "YAC_ST_Render" with the following. (If you go to the section of code that says "Initial Resolution" you can edit that to match whatever resolution you play in.)

Spoiler

begin YAC_ST_Render; Note: PM: -1, AM: -2; Note: This needs limited to one tick per game minute to avoid wasting FPS.; Temp Stringlong Temp; PositionXfloat PosX; Bordershort BorderSize ; This is the border, it's positioned in the top right, so: 800x600 -> X: 800 - BorderSize, Y: 0 + BorderSize; Paddingshort Padding; ImageWidthshort ImageWidth ; Width of the numeric textures; Hud Name (Temporary Storage)long HudName; Hud Element (Current Element to Draw)short HudElement; Texture Storage (Used to Free Resources)short HudCur0short HudLast0short HudCur1short HudLast1short HudCur2short HudLast2short LastHudshort LoadHud; Time Varsshort Hourfloat Minuteshort AMPM; Startupshort DoOnce; Stop Processing (Chargen In Progress?)if ( CharGenState != -1 )	returnendif; Set Initial Resolutionif ( DoOnce == 0 )	set BorderSize to 15	set Padding to 5	set ImageWidth to 25	set YAC_ScreenX to 800	set YAC_ScreenY to 600	set DoOnce to -1endif; Stop Processing (ScreenX Invalid)if ( YAC_ScreenX < 640 )	returnendif; Stop Processing (ScreenY Invalid)if ( YAC_ScreenY < 480 )	returnendif; Get Current Timeset Hour to ( GameHour )set Minute to ( GameHour - Hour) ; (float)GameHour: 12.5 - (short)Hour: 12 = 0.5 <- Minutesset Minute to (  Minute * 100 / 10 * 6 ) ; Converts float "0.5" to 30(min) for display.; Set PM (Do before other time fixes.)if ( Hour >= 12 )	set AMPM to -1 ; PMendif; Set AM (Do before other time fixes.)if ( Hour < 12 )	set AMPM to -2 ; AMendif; Hour Correction (00:00am Fix)if ( Hour < 1 ) ; ie, no 00:00am, render as 12:00am	set Hour to 12endif; Hour Correction (12 Hour Format)if ( Hour > 12 )	set Hour to ( Hour - 12 )endif; Minute Correctionsif ( Minute >= 60 )	set Minute to 0endif; Loop Through Hud Elements Rendering Each Oneif ( HudElement > 2 )	set HudElement to 0endif; Store Last Time Settingsif ( HudElement ==  0 )	set HudLast0 to ( HudCur0 )	set HudCur0 to Hour	set LastHud to ( HudLast0 )	set LoadHud to ( Hour )	set PosX to ( YAC_ScreenX - BorderSize - (ImageWidth * 3 + Padding) )elseif ( HudElement == 1 )	set HudLast1 to ( HudCur1 )	set HudCur1 to Minute	set LastHud to ( HudLast1 )	set LoadHud to ( Minute )	set PosX to ( YAC_ScreenX - BorderSize - (ImageWidth * 2) )elseif ( HudElement == 2 )	set HudLast2 to ( HudCur2 )	set HudCur2 to AMPM	set LastHud to ( HudLast2 )	set LoadHud to ( AMPM )	set PosX to ( YAC_ScreenX - BorderSize - ImageWidth )else	return		endif;== Draw Numeric Elements ==============================	; Create Hud Element	setx HudName to xStringBuild, "YAC_ST_HUD_%d", HudElement	xFileWriteText, "|MGEpipe", "HW%"  		xFileWriteText, "|MGEpipe", HudName	; Remove Existing (Matching Hud Elements)	xFileWriteText, "|MGEpipe", "Hf%"	; Free Last Hud Element Texture	setx Temp to xStringBuild, "Yacoby\Time\%d.tga", LastHud	xFileWriteText, "|MGEpipe", "tf%"	xFileWriteString, "|MGEpipe", Temp	; Load New Hud Element Texture	xFileWriteText, "|MGEpipe", "Hl%"	setx Temp to xStringBuild, "Yacoby\Time\%d.tga", LoadHud	; Enable Hud Element	xFileWriteText, "|MGEpipe", Temp	xFileWriteText, "|MGEpipe", "He%"	xFileWriteText, "|MGEpipe", "Hp%"	; Position Hud Element	xFileWriteFloat, "|MGEpipe", PosX	xFileWriteFloat, "|MGEpipe", BorderSize	xFileWriteText, "|MGEpipe", "Hc%"; == End Draw Numeric Elements ======================================================		; Increase HudElement Counter	set HudElement to ( HudElement + 1 );== Draw Dot Element ======================================	; Dot Positioning	set PosX to ( YAC_ScreenX - BorderSize - (ImageWidth * 3) + Padding + 12.5 ) ; 12.5 is half of 25(numeric image width) so this should center the dot, roughly.. (Or perhaps approximately, hard to tell... :P)	; Create Hud Element	setx Temp to xStringBuild, "YAC_ST_HUD_dot"	xFileWriteText, "|MGEpipe", "HW%"  		xFileWriteText, "|MGEpipe", Temp		; Remove Existing (Matching Hud Elements)	xFileWriteText, "|MGEpipe", "Hf%"	; Free Last Hud Element Texture	setx Temp to xStringBuild, "Yacoby\Time\dot.tga"	xFileWriteText, "|MGEpipe", "tf%"	xFileWriteString, "|MGEpipe", Temp	; Load New Hud Element Texture	xFileWriteText, "|MGEpipe", "Hl%"	setx Temp to xStringBuild, "Yacoby\Time\dot.tga"	xFileWriteText, "|MGEpipe", Temp	; Enable Hud Element	xFileWriteText, "|MGEpipe", "He%" 	xFileWriteText, "|MGEpipe", "Hp%"	; Position Hud Element	xFileWriteFloat, "|MGEpipe", PosX	xFileWriteFloat, "|MGEpipe", BorderSize	xFileWriteText, "|MGEpipe", "Hc%"end



10, Save the mod, and try it out. :)

Yacoby gave permission on his site to make updates, so if someone want's to package this up, etc, go ahead, a credit to me for my work would be nice, and of course credit Yacoby. (I may package it up eventually if no one else does.)

------------

Edit:

Despite needing a setup menu, and a limiter to save FPS, it runs fine, even on my relatively slow computer, so it should work great as is for pretty much everyone. (During testing I had the timescale set to 4000, which is WAY faster than normal, so it should run fine at normal speeds.)

Also, the screenshot on Yacoby's site doesn't represent the current GUI, it uses MW style fonts now, the format is this (ie, 01:00pm), and it goes really well with the MW GUI, I think. (All credits to Yacoby for the design, etc,. I just fixed some code.)

I wouldn't mind seeing the graphics updated so it displays like this "1:00pm", but it's nice as is.
User avatar
Dan Scott
 
Posts: 3373
Joined: Sun Nov 11, 2007 3:45 am

Post » Wed Jul 27, 2011 9:03 pm

nice, personally it works fine for me as it is,but nice with alternatives/progress regardless :goodjob:
User avatar
Amber Ably
 
Posts: 3372
Joined: Wed Aug 29, 2007 4:39 pm

Post » Wed Jul 27, 2011 10:13 am

nice, personally it works fine for me as it is,but nice with alternatives/progress regardless :goodjob:


Thanks. :)

So you don't experience those issues? What MGE\MWSE versions do you use? Do you have MCP v2.0 installed?

I have\use:

1. Latest official patch (Original .exe)
2. MCP v2.0
3. MGE v3.8.2 rev.0178 (Internal MWSE(v0.94a?))
4. MLOX\Wrye Mash (Latest)

Spoiler

Mod List
[Game Files]GameFile0=Morrowind.esmGameFile1=Tribunal.esmGameFile2=Bloodmoon.esmGameFile3=Morrowind Patch v1.6.5-BETA.esmGameFile4=Better Heads.esmGameFile5=Better Heads Tribunal addon.esmGameFile6=Better Heads Bloodmoon addon.esmGameFile7=indybank.espGameFile8=WeatheredSigns.espGameFile9=horatio_casting_trib_2.espGameFile10=LeveledMagicka.espGameFile11=NX9_Guards_Complete.ESPGameFile12=The Imperial Legion Badge.espGameFile13=Starfires NPC Additions ver-1.11.espGameFile14=Lilarcor_v4-1.espGameFile15=EnchantingSuccess.ESPGameFile16=MTC.espGameFile17=Siege at Firemoth.espGameFile18=Scripted_Spells.espGameFile19=RKCriminals TR&BM.espGameFile20=Vampire_Embrace.espGameFile21=Syc_AtHomeAlchemy.espGameFile22=ASH 2.0.espGameFile23=Flee AI Tweaks.espGameFile24=Vampiric Hunger Base.espGameFile25=Vampiric Hunger Extended.espGameFile26=Vampiric Hunger MGE Addon for MGE 1.11+.espGameFile27=Better Bodies.espGameFile28=vn_lichcraft2.espGameFile29=GRM_Companion_Recall_Ring.espGameFile30=Diablerie.espGameFile31=Diablerie_MWSE_AddOn.espGameFile32=Bloated Caves.espGameFile33=frostmoth_repaired_v0_31.espGameFile34=Time Display.espGameFile35=Better Clothes_v1.1.espGameFile36=FollowMeMWOnly.espGameFile37=Universal Companion Share.espGameFile38=The Neverhalls.espGameFile39=Blasphemous Revenants.espGameFile40=Natural Healing.espGameFile41=BR_Werewolf_Patch.espGameFile42=Graphic Herbalism.espGameFile43=entertainers.espGameFile44=AreaEffectArrows.espGameFile45=Particle Arrow Replacer.espGameFile46=TLM - Complete.espGameFile47=AEA-Compatibility.espGameFile48=WA_Signy_Signposts(!).ESPGameFile49=Better Skulls.ESPGameFile50=bcsounds.espGameFile51=adamantiumarmor.espGameFile52=EBQ_Artifact.espGameFile53=mel_teleportPlugin_1_3.espGameFile54=Creatures.espGameFile55=Quick Char (Timescale Edit).espGameFile56=More Better Clothes.ESPGameFile57=sm_ForgottenHalls.espGameFile58=Welcome to the Arena! v5.0 (normal).espGameFile59=Scrolls and SoulGems 1.1.espGameFile60=Vampiric Power.espGameFile61=Mashed Lists.esp



I also use a timescale of 1, since I'm playing a vampire character, which could easily be causing the mod to malfunction.

---

Edit: Also, note that the problem is sporadic, it may work fine on first load, but on subsequent reloads, or even as time passes, the problems start occurring, I used the mod for quite awhile before I noticed it malfunctioning.
User avatar
Kevan Olson
 
Posts: 3402
Joined: Tue Oct 16, 2007 1:09 am

Post » Wed Jul 27, 2011 3:35 pm

Is this the one that was updated for use with MGEXE?
User avatar
ZANEY82
 
Posts: 3314
Joined: Mon Dec 18, 2006 3:10 am

Post » Wed Jul 27, 2011 8:29 am

Is this the one that was updated for use with MGEXE?


Are you referring to yesterday when I mentioned updating some mods? Or was there a MGEXE specific version of this mod. ?

In either case, this was updated to fix issues I was experiencing, and so long as MGEXE supports the latest MGE\MWSE commands, this should work fine with it.
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Wed Jul 27, 2011 9:24 am

It was a pack of HUD mods updated specifically for MGEXE. I never could figure out what was updated or why, it was just a recommendation by the XE team to use those instead of the originals.

In any case, the version I'm running from the pack is working.
User avatar
Eve(G)
 
Posts: 3546
Joined: Tue Oct 23, 2007 11:45 am

Post » Wed Jul 27, 2011 11:52 am

It was a pack of HUD mods updated specifically for MGEXE. I never could figure out what was updated or why, it was just a recommendation by the XE team to use those instead of the originals.

In any case, the version I'm running from the pack is working.


I see, well if it has MGEXE specific issues, then this may not work for that version of MGE. (I can't test it, my SM3.0 card died, I'm running an old AGP card at the moment which only supports SM\PS2.0.)
User avatar
Queen of Spades
 
Posts: 3383
Joined: Fri Dec 08, 2006 12:06 pm


Return to III - Morrowind

cron