Jump to content

Needing ideas on MOD utility for Modders


Recommended Posts

in the middle creating a mod utility that allows a modder to

display a string and variable on screen when asked.

 

I started to create an ini for Hud Status Bars but

that didn't do what I wanted. I wanted the

data to go on screen right away and not wait for my script

to 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

end

call vTrack 1 "MyVar is now" MyVar

Calls my function to fire

 

call vTrack 1 "MyVar is now" MyVar

Hud element to use

planning on being able to track 10 variables if you want

call vTrack 8 would send the data to the 8th hud element

 

call vTrack 1 "MyVar is now" MyVar

Send a string you want displayed

This can also be a string_var

 

call vTrack 1 "MyVar is now" MyVar

The variable you want to track

 

 

 

I'm going to have it send this info to console

was also glancing at conscribe

if I'm correct, I can send the data to a log file as well.

 

call vPause

I've also created another function that causes the game to pause

till you press a key

 

an idea I was throwing around earlier

call vPause 207

you send the value of the key you want to use to unpause

in this case its the 'end' key

 

 

Anybody got any ideas to add to it?

 

 

Link to comment
Share on other sites

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 code

to 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.xml

place it in

GameDirectory\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 Function

Create a new script in the CS

copy 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
end

Now 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 *Float

Replace *short with the value of the Hud element you want to use. 1-10

Replace *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 as

call vTrack 3 "The door is activated" 2

You 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 button

then 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 pause

call vPause *keycode

replace *keycode with a number that represents the key you'd like to use to unpause

 

so if I wanted the End key to unpause it

call vPause 207

 

see a list of keycodes in the wiki

https://cs.elderscrolls.com/index.php?title=OnKeyDown

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...