UI modding - support thread

The place to discuss scripting and game modifications for X Rebirth.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 1. Feb 16, 16:44

Thanks for the documentation on scale1info
stefanEgo wrote:@jth: The scrollbar will appear on the table, if the table grows too large. If you ensure that the slider is visible, it will never "go out of view".
That explains what is happening, thanks

How do I get around the problem ?

Is there a way to get the slider to sit at the end of the table and scroll down with it ?

jth

EDIT 03/02/2016

I have pretty much got a plan B production limiting configuration menu working that is based upon menu_encyclopediaproductionmethod with a slider tacked on the bottom and a lot of stuff borrowed from menu_production.

Its triggered from my modified menu_production menu

Its just difficult to keep it all on one screen with no scrolling :(
Last edited by jth on Wed, 3. Feb 16, 13:58, edited 1 time in total.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Wiping a BlackBoard entry

Post by jth » Tue, 2. Feb 16, 13:06

I would like to completely delete a BlackBoard variable in lua as it causing me grief in md script plus its cluttering up the manager object un-necessarily

<do_if value="@$Manager.$TestVar"> remains true even if $TestVar is empty

but there is no RemoveNPCBlackboard or DeleteNPCBlackboard command

Code: Select all

	local testtable = {}
	table.insert(testtable, "dummydata")
	SetNPCBlackboard(menu.manager, "$TestVar", testtable) 
	
	local readbacktable = GetNPCBlackboard(menu.manager, "$TestVar")		
	DebugError("Read back " .. tostring(readbacktable[1]) .. " " .. #readbacktable)

	SetNPCBlackboard(menu.manager, "$TestVar", nil) 

	readbacktable = GetNPCBlackboard(menu.manager, "$TestVar")		
	DebugError("Read back " .. tostring(readbacktable[1]) .. " " .. #readbacktable)
[General] ======================================
[=ERROR=] Read back dummydata 1
[General] ======================================
[General] ======================================
[=ERROR=] Read back dummydata 1
[General] ======================================

I then tried

SetNPCBlackboard(menu.manager, "$TestVar", "")

which gives

[General] ======================================
[=ERROR=] Read back dummydata 1
[General] ======================================
[General] ======================================
[=ERROR=] Read back nil 0
[General] ======================================

which means that it blanked it but it still exists and has zero entries

how do I do it ?

jth

EDIT
I have manged to recreate a work around in md script that detects missing or empty list

<do_if value="$Manager.$TestVar? and $Manager.$TestVar != '' ">

which keeps me going but my save games could do with an answer on completely deleting variables from the BlackBoard please

EDIT2
The lua code is having the same problem as the md code where its interpreting an empty table variable from the BlackBoard as an empty string so had to code round that too. Yuck :(

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Wed, 3. Feb 16, 13:33

stefanEgo wrote:@jth: Regardling the scale1info/scale2info entries: By design a single slider can represent two distinct scales. So by moving the slider, you practically can change two different values. Documentation for the scale1info is as follows:

Code: Select all

["left"]     = number|nil = nil,	-- value displayed on the left side (representing a slider position of 0 - nil => no display)
["right"]    = number|nil = nil,	-- value displayed on the right side (representing a slider position of 0 - nil => no display)
["center"]   = true|false = true,	-- indicates whether the current scale value is to be displayed on the center of the slider
["minLimit"] = number|nil = nil,	-- the minimal value the scale will display, even if the slider indicates a smaller value (nil => no limit)
["maxLimit"] = number|nil = nil,	-- the maximal value the scale will display, even if the slider indicates a larger value (nil => no limit)
["inverted"] = true|false = false,	-- indicates whether left/right behavior is inverted (i.e. if false, value changes will be subtracted on the left side and added to the right side)
["factor"]   = number     = 1,		-- factor which the slider value is multiplied with to set the values
["floored"]  = true|false = true,	-- indicates whether the displayed scale values are floored (true) or ceiled (false)
["suffix"]   = string     = ""		-- suffix which is being printed after the scale values

Code: Select all

	local scale1info = { 
		["left"] = nil,
		["right"] = nil,
		["center"] = false,
		["inverted"] = false,
		["suffix"] = nil
	}
	local scale2info = {
		["left"] = nil,
		["right"] = nil,
		["center"] = true,
		["factor"] = (100 / menu.maxslider) or 100,
		["inverted"] = false,
		["suffix"] = "%"
Thanks for the documentation

Turns out that my code works but not how I thought it did :)

The scale2info gets me a number to the immediate right of the slider that goes from 0 to 100% and displays the slider position nicely on the GUI as a percentage. I don't use the value2 that it produces.

I am actually using value1 which isn't scaled to feed into my code as that lets me control the rounding.

The following may be an enhancement request

The displayed scale2info value shows up as a single number with no decimal point. Is there any way to format its output ?

Being able to show two (or more) digits after a decimal point with no lagging zeros would be ideal for me.

Example
foodstuffs. smallest primary resource is meat and each batch uses 40. That means that I configure the slider to have 40 possible positions (you can't use part of a ware). I then scale that up by 2.5 to get 100% shown in the center by scaleinfo2. value1 goes from 0 to 40. If I move the slider up one so that value1 is 1 then the scale2info center says 3% when it should say 2.5%

EDIT 08/02/2016
The formatting that I would like is the equivalent of string.format("%g", string.format("%1.2f", scale2info_value))

Hope this makes sense

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

How do I grey out or disable an existing button on the fly ?

Post by jth » Fri, 12. Feb 16, 14:42

I have an OK button created with

Code: Select all

Helper.createButton(Helper.createButtonText(ReadText(1001, 14), "center", Helper.standardFont, Helper.standardFontSize, 255, 255, 255, 100), nil, false, true)
I would like to enable and disable it depending on some other logic

I can't find a Helper.disableButton although there is a Helper.updateButtonText

Do I have to Helper.Remove it and then put it back in with

Code: Select all

Helper.createButton(Helper.createButtonText(ReadText(1001, 14), "center", Helper.standardFont, Helper.standardFontSize, 255, 255, 255, 100), nil, false, false)
or is there a better way ?

Regards

jth

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

RoundTotalTradePrice documentation

Post by jth » Tue, 23. Feb 16, 15:11

This call appears in a lot of 4.00 lua scripts

I also seem to have a lot of my scripts having numbers in them that are 100 times too large in 4.00

I have a feeling that it lines up with everything being priced in centicredits

RoundTotalTradePrice is not in the Lua function overview or the helper.lua files

I assume that it rounds down numbers to the nearest Credit

Whats the syntax ?

What build number/release did it first appear in ?

Regards

jth

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Re: RoundTotalTradePrice documentation

Post by UniTrader » Tue, 23. Feb 16, 15:25

jth wrote:I also seem to have a lot of my scripts having numbers in them that are 100 times too large in 4.00

I have a feeling that it lines up with everything being priced in centicredits
it is and afaik prices and money were always counted in cent - not really obvious in scripts since they are always suffixed with Cr which is automatically converted to ct by multiplying the value with 100
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Re: RoundTotalTradePrice documentation

Post by jth » Tue, 23. Feb 16, 16:07

UniTrader wrote:
jth wrote:I also seem to have a lot of my scripts having numbers in them that are 100 times too large in 4.00

I have a feeling that it lines up with everything being priced in centicredits
it is and afaik prices and money were always counted in cent - not really obvious in scripts since they are always suffixed with Cr which is automatically converted to ct by multiplying the value with 100
Aaaah not enough brackets in one of my formulae had the side effect of multiplying by near enough 100 :(

I still think that RoundTotalTradePrice needs adding to the Lua function overview

jth

antoniut
Posts: 198
Joined: Sat, 4. Oct 14, 13:07
xr

Post by antoniut » Wed, 2. Mar 16, 15:26

Hi I would like to change cursors size to 48 instead of 32 (edge enemy triangles
from 16 to 32 too) my eyes are not soo young than before :D

I've changed the size to 48 in mousecursors file seems that game resizes to 32 again. I suspect that I have to modify something in Crosshair Handling.lua and targetsystem.lua.

I'm wrong? If not, how can I made a little lua mod to modify it?

Sorry to ask, but I think I could learn chinese before than lua code :D

Thanks

DarthNihilus
Posts: 55
Joined: Mon, 7. Mar 16, 14:06

Post by DarthNihilus » Mon, 7. Mar 16, 23:44

in the trade window the base price string is left justifyed. when it writes about illegal wares the price in the end is on the right side, so when i browse the sellable I just look up. but when it's not reminding about illegal wares, there's just the price, and my eyes bleed to constantly look to the side. Can this part of the trade window be justified to the right, so the base price is up above the sell list? Or you wanna put me 30 spaces to that string? :D

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Sun, 24. Jul 16, 23:46

Hi all

Iwould change something like targets icons, and player faction icon, i've tried this mod but not work :l

Code: Select all

extensions/better_player_icon/
-assets
-libraries
-and content

-content: no comment.

-assets/fx/gui/textures/factions/faction_player.gz (with my tga texture)
 
-in the librairies folder : icons.xml

icons.xml:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE icons SYSTEM "icons.dtd" >

<diff> 

     <replace sel="/icons/icon[@name='faction_player']/icon"> 
	   <icon name="faction_player" texture="extensions\better_player_icon\assets\fx\gui\textures\factions\faction_player.tga" height="128" width="128"></icon>
	  </replace> 

</diff>

 
Please, what is wrong ? and how to make this ? by a mod/ patch, or can i rebuild the 01.cat with a new texture imported (tga in such case) ?

Thanks in advance ;)

And sorry for my english.

ps : i'm a GOG player, i don't have the official extract cat tools (only aviable on steam oO), but just the XRCat, and i can't rebuild a cat with this tool...

I have no idea if it's posible to rebuild a cat/dat with the official tools ??? in such case, anyone for build my new ui textues please ? i work for a realistic hud, i've already realised an HD textues pack, and a few of little mods for X:R, i'm an experienced modder for a lot of other games.

Thanks
Last edited by FantasyWarrior on Mon, 25. Jul 16, 00:23, edited 1 time in total.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Mon, 25. Jul 16, 00:11

if you want to replace files in the cats/dats you have to pack them into a subst_01.cat/dat - no need to re-pack a core-cat/dat since higher-numbered ones (or mod subst-ones) ovverride earlier ones ;)
if its just a single file you can do the following manually:
=> rename your file to subst_01.dat
=> create a text file subst_01.cat
and write the following in there:

Code: Select all

assets\fx\gui\textures\factions\faction_player.gz XXXX YYYY ZZZZZ
with XXXX being the file Size in Bytes, YYYY the File Timestamp in Unix Time (seconds since 1.1.1970) and ZZZZ is iirc an md5 hash, but not entirely sure
for more files just concentate them in the dat and write a new line for each file (same order as in dat)




V V V V V V V V V V V V V V V V V V
V V V Really relevant part here V V V
didnt want to delete the already typed start ^^

and just noticed: you can do this without cats/dats, but you did the XPath wrong, it should look like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<diff>
     <replace sel="/icons/icon[@name='faction_player']/@texture">extensions\better_player_icon\assets\fx\gui\textures\factions\faction_player.tga</replace>
</diff> 
and this just reminds me i already did something like this in my Player Logo Mod :D
https://github.com/UniTrader/UTPlayerLo ... /icons.xml
(and no, this mod is not just about changing the Icon in the UI :D)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Mon, 25. Jul 16, 00:20

Wow ! thanks a lot, realy important for me :D

I'm going to try...

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Mon, 25. Jul 16, 00:56

since you do a UI Overhaul your new Icons probably look better than the one i put in there (mine was just to externalize the Player Faction Icon for easy replacement with an own one ;) ) i think you want to make sure your Mod loads after mine to override my change.. so just put this Line in your content.xml as first in the content node:

Code: Select all

<dependency id="UTPlayerLogos" optional="true" />
usage example (because these usually describe best what is meant ;) ):
https://github.com/UniTrader/XFleetFest ... ontent.xml
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Mon, 25. Jul 16, 01:13

I've understand all parts, but not work after the first try :D

I work on it...


-the "subst_01.dat" is just a simple folder named "subst_01.dat" right ? right clic/ new folder named "subst_01.dat"...

No problem for the cat, i've just past the code lines fom the original 01.cat :roll: with my new textures (tga/gz) in the correct folders...same order than the icons.xml (library)...

Code: Select all

assets/fx/gui/textures/factions/faction_player.gz 11542 1338280629 8e3f0503f842343faf274ce42b21d8d1
assets/fx/gui/textures/target_elements/tsys_asteroid_act.gz 22109 1337933802 21e48c10622c1d1883f09ffaa37d621c
assets/fx/gui/textures/target_elements/tsys_asteroid_inact.gz 16210 1358172242 82b75cd24774359cc331fe97e32f5832

.<!--ect...-->
Last edited by FantasyWarrior on Mon, 25. Jul 16, 01:51, edited 1 time in total.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Mon, 25. Jul 16, 01:29

only doing this should be enough, no need to juggle around with cats/dats
(putting your new texture file in the directory where you initially had it)
UniTrader wrote: V V V V V V V V V V V V V V V V V V
V V V Really relevant part here V V V
didnt want to delete the already typed start ^^

and just noticed: you can do this without cats/dats, but you did the XPath wrong, it should look like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<diff>
     <replace sel="/icons/icon[@name='faction_player']/@texture">extensions\better_player_icon\assets\fx\gui\textures\factions\faction_player.tga</replace>
</diff> 
and this just reminds me i already did something like this in my Player Logo Mod :D
https://github.com/UniTrader/UTPlayerLo ... /icons.xml
(and no, this mod is not just about changing the Icon in the UI :D)
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Mon, 25. Jul 16, 08:55

OMG it work !!! :o

Thanks a lot :D


Well, this game is interesting and elitist about modding and of course i like it, i return back soon...
I have a lot of work with the HUD ^^

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Fri, 5. Aug 16, 00:55

Please, it is possible to modify a material like "cockpit_eventmonitor" (i would a transparent effect for the radar) or it is hard coded ? :l

And i 've tried to change the shield icon too, it work but the bars are deactivated...

Maybe the same ui script for cockpit_eventmonitor / shield icon, if i place a patch with new textures, these elements are broken...


edit, maybe it's in a patch...

stefanEgo
Posts: 545
Joined: Thu, 11. Apr 13, 14:12
x4

Post by stefanEgo » Mon, 8. Aug 16, 17:43

Modding the eventmonitor and/or ship status panel is unsupported, unfortunately.

That said, as a workaround you could try making use of substitution catalog files to replace the corresponding textures/scripts (the Lua scripts can be replaced by copying the *.lua file to *.xpl). The downside would be that for each version update, you'd have to provide an update for your mod, since these scripts could be changed in a patch release. Also be aware that this is a completely unsupported process which might be broken by any following update!

The eventmonitor panel is more complicated than you might expect. There is not just one material involved but rather different layers/materials. One material is the cockpit_eventmonitor (and for another cockpit the cockpit_eventmonitor_cockpit_b). You can try tweaking its parameters to see if you can get somewhere for your case.

With regards to the issue with replacing the shield icons: Take a look at the debug log in game. I'd expect you see some error output related to the broken shield/hull bars there.
Stefan Hett

FantasyWarrior
Posts: 29
Joined: Sun, 24. Jul 16, 18:43

Post by FantasyWarrior » Sun, 14. Aug 16, 18:15

Thank you !

I have discovered everything you said by myself ^^ lua file, ect...

I was try to make a patch for Cockpit Shipstatus.lua, maybe something like

Code: Select all

<diff>
 < replace>
   </replace>
</diff>

And...a lot of other things , folders...


Well Actualy, I LOVE this game :!:

Of course, the modding is not simple :l i've just made :
80% of the textures hd, sounds, musics, reworked cockpit_b, and i have a lot of other mods.


0 % of B-U-G !!!!!

Now, i just need to put the new shield icon, add a glass for cockpit b, if i can rework the cockpit b a little more...

:!: For info : no crash with windows 7/ 64 bits 8G RAM and 80% of new textures 2048 -> 4096, and the same performances !



edit: my version, with the holographic hud ^^ (not finished).


http://tw.greywool.com/i/D_9R3.jpg
http://tw.greywool.com/i/F5kI2.jpg
http://tw.greywool.com/i/8yEgm.jpg
http://tw.greywool.com/i/Um-hX.jpg
http://tw.greywool.com/i/V-eGl.jpg


Edit: removed img-tags from oversized images. Please check the forum rules for the allowed sizes. X2-Illumintus

Edit :

OK !

Finaly, i just need to add a glass for cockpit_b !

I think the best solution is replace a material/element by a new one, but i think it's not so simple :l

For ex the "blue screen" (actualy deactivated) -> become the big glass from cocpit_1...

assets/units/player/units_player_cockpit_b.xml
(Blue_screen)

Code: Select all

<connection name="Connection08" tags="part iklink animation nocollision  " parent="anim_blocker_01">
<!--ect...-->
							<materials>
									<material id="1" ref="arcp1.cp1_fight_window_bluescreen"/>
								</materials>
<!--ect...-->
And by a patch...

Code: Select all

	 <replace sel="/components/component[@name='units_player_cockpit_b']/connections/connection[@name='Connection08']/offset/parts/materials">
								<materials>
									<material id="1" ref="arcp1.cp1_window"/>
								</materials>
	 </replace>		

Not work actualy...

KlausM
EGOSOFT
EGOSOFT
Posts: 639
Joined: Wed, 6. Nov 02, 20:31
x4

Post by KlausM » Tue, 16. Aug 16, 15:01

Hi FantasyWarrior,

it doesn't work because the XPath in the sel attribute isn't correct. This is the original connection element:

Code: Select all

<connection name="Connection08" tags="part iklink animation nocollision  " parent="anim_blocker_01">
	[...]
	<parts>
		<part name="anim_blocker_01_blue">
			<lods>
				<lod index="0">
					<materials>
						<material id="1" ref="arcp1.cp1_fight_window_bluescreen"/>
					</materials>
				</lod>
			</lods>
			[...]
		</part>
	</parts>
</connection>
So the XPath should be:

Code: Select all

sel="/components/component[@name='units_player_cockpit_b']/connections/connection[@name='Connection08']/parts/part[@name='anim_blocker_01_blue']/lods/lod/materials"

Post Reply

Return to “X Rebirth - Scripts and Modding”