UI modding - support thread

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

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

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31

Post by jth » Mon, 1. Feb 16, 17: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, 14:58, edited 1 time in total.

jth
Posts: 295
Joined: Wed, 4. Jan 06, 00:31

Wiping a BlackBoard entry

Post by jth » Tue, 2. Feb 16, 14: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: 295
Joined: Wed, 4. Jan 06, 00:31

Post by jth » Wed, 3. Feb 16, 14: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: 295
Joined: Wed, 4. Jan 06, 00:31

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

Post by jth » Fri, 12. Feb 16, 15: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: 295
Joined: Wed, 4. Jan 06, 00:31

RoundTotalTradePrice documentation

Post by jth » Tue, 23. Feb 16, 16: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: 13817
Joined: Sun, 20. Nov 05, 23:45

Re: RoundTotalTradePrice documentation

Post by UniTrader » Tue, 23. Feb 16, 16: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: 295
Joined: Wed, 4. Jan 06, 00:31

Re: RoundTotalTradePrice documentation

Post by jth » Tue, 23. Feb 16, 17: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: 197
Joined: Sat, 4. Oct 14, 13:07

Post by antoniut » Wed, 2. Mar 16, 16: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, 15:06

Post by DarthNihilus » Tue, 8. Mar 16, 00: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: 12
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: 13817
Joined: Sun, 20. Nov 05, 23:45

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: 12
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: 13817
Joined: Sun, 20. Nov 05, 23:45

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: 12
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: 13817
Joined: Sun, 20. Nov 05, 23:45

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 ;)

Post Reply

Return to “X Rebirth - Scripts and Modding”