Moktah Posted November 11, 2018 Share Posted November 11, 2018 in the middle creating a mod utility that allows a modder todisplay a string and variable on screen when asked. I started to create an ini for Hud Status Bars butthat didn't do what I wanted. I wanted thedata to go on screen right away and not wait for my scriptto end. Here's a jist of it.Lets say you were working on a mod with the following code. scn MyMod short MyVar begin gamemode let MyVar := 15 ;insert a bunch of code that changes the value of MyVar to whatever ;now you want to know the value and put it on screen ;so you call for my code to fire off call vTrack 1 "MyVar is now" MyVar call vPause endcall vTrack 1 "MyVar is now" MyVarCalls my function to fire call vTrack 1 "MyVar is now" MyVarHud element to useplanning on being able to track 10 variables if you wantcall vTrack 8 would send the data to the 8th hud element call vTrack 1 "MyVar is now" MyVarSend a string you want displayedThis can also be a string_var call vTrack 1 "MyVar is now" MyVarThe variable you want to track I'm going to have it send this info to consolewas also glancing at conscribeif I'm correct, I can send the data to a log file as well. call vPauseI've also created another function that causes the game to pausetill you press a key an idea I was throwing around earliercall vPause 207you send the value of the key you want to use to unpausein this case its the 'end' key Anybody got any ideas to add to it? Link to comment Share on other sites More sharing options...
Moktah Posted November 12, 2018 Author Share Posted November 12, 2018 Nevermind. found out its not possible to display anything on the screen while the script is being read.looks like the engine completes reading scripts before it refreshes the screen Link to comment Share on other sites More sharing options...
Moktah Posted November 14, 2018 Author Share Posted November 14, 2018 Just so it don't go to waste.Here's the source code if anyone wants to try it.I didn't add the Conscribe functionality though. I got it to send the info to console, a message, and as a hud element on screen. I didn't make it into a separate esp as that will create dependency issues.Its simpler to just hit the New Script button and paste the codeto add the function you want to your code.When you are finished, just delete the function you used.There is also an xml file that handles the on screen stuff. Here's the code for the xml file.Save it as.... vTrackHUD.xmlplace it inGameDirectory\Data\Menus\prefabs\vTrack(yup, create the folder vTrack) <rect name="vTrack"> <visible> <copy src="HUDMainMenu" trait="user3" /> <eq>1</eq> </visible> <x> 200 </x> <y> 100 </y> <width> 400 </width> <height> 800 </height> <locus> &true; </locus> <_active> 1 </_active> <font> 3 </font> <red> 200 </red> <blue> 200 </blue> <green> 200 </green> <_vis1></_vis1> <_txt1></_txt1> <_var1></_var1> <text name="vTrack_1_var"> <visible> <copy src="parent()" trait="vis1" /> </visible> <x> 0 </x> <y> 0 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt1" /> </string> </text> <text name="vTrack_1_txt"> <visible> <copy src="parent()" trait="vis1" /> </visible> <x> 0 </x> <y> 25 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var1" /> </string> </text> <text name="vTrack_2_var"> <visible> <copy src="parent()" trait="vis2" /> </visible> <x> 0 </x> <y> 75 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt2" /> </string> </text> <text name="vTrack_2_txt"> <visible> <copy src="parent()" trait="vis2" /> </visible> <x> 0 </x> <y> 100 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var2" /> </string> </text> <text name="vTrack_3_var"> <visible> <copy src="parent()" trait="vis3" /> </visible> <x> 0 </x> <y> 150 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt3" /> </string> </text> <text name="vTrack_3_txt"> <visible> <copy src="parent()" trait="vis3" /> </visible> <x> 0 </x> <y> 175 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var3" /> </string> </text> <text name="vTrack_4_var"> <visible> <copy src="parent()" trait="vis4" /> </visible> <x> 0 </x> <y> 225 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt4" /> </string> </text> <text name="vTrack_4_txt"> <visible> <copy src="parent()" trait="vis4" /> </visible> <x> 0 </x> <y> 250 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var4" /> </string> </text> <text name="vTrack_5_var"> <visible> <copy src="parent()" trait="vis5" /> </visible> <x> 0 </x> <y> 300 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt5" /> </string> </text> <text name="vTrack_5_txt"> <visible> <copy src="parent()" trait="vis5" /> </visible> <x> 0 </x> <y> 325 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var5" /> </string> </text> <text name="vTrack_6_var"> <visible> <copy src="parent()" trait="vis6" /> </visible> <x> 0 </x> <y> 375 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt6" /> </string> </text> <text name="vTrack_6_txt"> <visible> <copy src="parent()" trait="vis6" /> </visible> <x> 0 </x> <y> 400 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var6" /> </string> </text> <text name="vTrack_7_var"> <visible> <copy src="parent()" trait="vis7" /> </visible> <x> 0 </x> <y> 450 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt7" /> </string> </text> <text name="vTrack_7_txt"> <visible> <copy src="parent()" trait="vis7" /> </visible> <x> 0 </x> <y> 475 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var7" /> </string> </text> <text name="vTrack_8_var"> <visible> <copy src="parent()" trait="vis8" /> </visible> <x> 0 </x> <y> 525 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt8" /> </string> </text> <text name="vTrack_8_txt"> <visible> <copy src="parent()" trait="vis8" /> </visible> <x> 0 </x> <y> 550 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var8" /> </string> </text> <text name="vTrack_9_var"> <visible> <copy src="parent()" trait="vis9" /> </visible> <x> 0 </x> <y> 600 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt9" /> </string> </text> <text name="vTrack_9_txt"> <visible> <copy src="parent()" trait="vis9" /> </visible> <x> 0 </x> <y> 625 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var9" /> </string> </text> <text name="vTrack_10_var"> <visible> <copy src="parent()" trait="vis10" /> </visible> <x> 0 </x> <y> 675 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_txt10" /> </string> </text> <text name="vTrack_10_txt"> <visible> <copy src="parent()" trait="vis10" /> </visible> <x> 0 </x> <y> 700 </y> <font> <copy src="parent()" trait="font" /> </font> <red> <copy src="parent()" trait="red" /> </red> <blue> <copy src="parent()" trait="blue" /> </blue> <green> <copy src="parent()" trait="green" /> </green> <string> <copy src="parent()" trait="_var10" /> </string> </text> </rect>And then we have our FunctionCreate a new script in the CScopy and paste this code and you'll have the function ready to roll. scn vTrack short vtHUD string_var vtTXT float vtVAR begin function{vtHUD, vtTXT, vtVAR} if 0 == (tile_GetFloat "vTrack\_active", 1004) InsertXML "vTrack\vTrackHUD.xml" 1004 endif if vtHUD == 1 tile_setfloat "vTrack\_vis1", 1004, 2 tile_setstring "vTrack\_txt1|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var1", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 2 tile_setfloat "vTrack\_vis2", 1004, 2 tile_setstring "vTrack\_txt2|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var2", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 3 tile_setfloat "vTrack\_vis3", 1004, 2 tile_setstring "vTrack\_txt3|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var3", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 4 tile_setfloat "vTrack\_vis4", 1004, 2 tile_setstring "vTrack\_txt4|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var4", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 5 tile_setfloat "vTrack\_vis5", 1004, 2 tile_setstring "vTrack\_txt5|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var5", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 6 tile_setfloat "vTrack\_vis6", 1004, 2 tile_setstring "vTrack\_txt6|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var6", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 7 tile_setfloat "vTrack\_vis7", 1004, 2 tile_setstring "vTrack\_txt7|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var7", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 8 tile_setfloat "vTrack\_vis8", 1004, 2 tile_setstring "vTrack\_txt8|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var8", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 9 tile_setfloat "vTrack\_vis9", 1004, 2 tile_setstring "vTrack\_txt9|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var9", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif if vtHUD == 10 tile_setfloat "vTrack\_vis10", 1004, 2 tile_setstring "vTrack\_txt10|%z", vtTXT, 1004 tile_SetFloat "vTrack\_var10", 1004, vtVAR printtoconsole "%z %5.0f" vtTXT vtVAR msgex "%z %5.0f" vtTXT vtVAR endif endNow anywhere you want to 'see' what your code is doing behind the scenes.Just issue a call for the function to fire. call vTrack *Short *String *FloatReplace *short with the value of the Hud element you want to use. 1-10Replace *String with the string you want it to say.And the *Float to whatever Variable you want to track. (you can pass on a short if you want.)It can be directly entered such ascall vTrack 3 "The door is activated" 2You can also have use it like this....call vTrack 5 "Frames Per Second =" getfps Might be helpfull to scope out at obse's User-Defined Fuctions for more info This last bit of code is purely optional.If you'd like to force you're code to pause the game till you hit a buttonthen you can add this other function scn vPause short vpKeyCode begin function {vpKeyCode} while 1 if onkeydown vpKeyCode break endif loop end When you want to call for a pausecall vPause *keycodereplace *keycode with a number that represents the key you'd like to use to unpause so if I wanted the End key to unpause itcall vPause 207 see a list of keycodes in the wikihttps://cs.elderscrolls.com/index.php?title=OnKeyDown Link to comment Share on other sites More sharing options...
Recommended Posts