UI modding - support thread
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
ah, ok.. sounds to me like you are missing an <event_conversation_returned_to_section/> in your MD part..
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
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
-
- Posts: 2725
- Joined: Tue, 29. Oct 13, 21:59
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Coerce to component
This code is triggered by
This code is managing to output
[=ERROR=] Hello World cArch_deployatstation Foodstuffs Supply I
but its then meant to pass a component to cArch_deployatstation
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:1e891>: <event_conversation_next_section> section: 'cArch_deployatstation'
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:1e891>: [0,0,component.{0x1cba1L}]
but instead it just passes the objectid
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:42dae>: <event_conversation_next_section> section: 'cArch_deployatstation'
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:42dae>: [0LF,0LF,269100LF]
How do I coerce or change eventparam into a component ?
jth
Code: Select all
<raise_lua_event name="'cArch_deployatstation'" param="$playerstation"/>
Code: Select all
function menu.cArch_deployatstation(eventname, eventparam)
DebugError("Hello World " .. eventname .. " " .. GetComponentData(eventparam, "name") )
Helper.closeMenuForSubSection(menu, false, eventname, { 0, 0, eventparam})
menu.cleanup()
end
[=ERROR=] Hello World cArch_deployatstation Foodstuffs Supply I
but its then meant to pass a component to cArch_deployatstation
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:1e891>: <event_conversation_next_section> section: 'cArch_deployatstation'
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:1e891>: [0,0,component.{0x1cba1L}]
but instead it just passes the objectid
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:42dae>: <event_conversation_next_section> section: 'cArch_deployatstation'
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:42dae>: [0LF,0LF,269100LF]
How do I coerce or change eventparam into a component ?
jth
-
- Posts: 545
- Joined: Thu, 11. Apr 13, 14:12
@jth: Glad you found out the details about how to use the interface between Lua and MD already. We are aware that the provided interface is quite limited and would like to improve that at some point. Unfortunately, this is not as simple as it might sound. I've added a feature request for you to extend the interface to also allow passing on tables as a parameter which I believe should cover your requirements, no? https://www.egosoft.com:8443/jira/browse/XRUIMOD-102
For the time being serializing the parameters, as you already pointed out, is one way to work around this limitation.
@jth: Regarding the script error you get: What's going on behind the scene here is related to how components (or rather componentIDs) are handled in the UI and MD. See the section about FFI IDs and Lua IDs here: https://wiki.egosoft.com:1337/X%20Rebir ... d%20guide/
In your case you pass the eventparam to Helper.closeMenuForSubSection. That parameter is then converted (recursively for tables) to a plain integer (see helper.lua Helper.closeMenuForSubSection() and Helper.convertComponentIDs()). Hence when passed back to MD you lost the data type infomration that the ID is actually a component. Therefore in MD you have to tell that the provided "integer" is actually a component and create a componentID again as in (pseudo code):
Again, this limitation is something we'd like to remove at some point to simplify UI modding further. I've added a corresponding JIRA issue for that one now: https://www.egosoft.com:8443/jira/browse/XRUIMOD-103
For the time being serializing the parameters, as you already pointed out, is one way to work around this limitation.
@jth: Regarding the script error you get: What's going on behind the scene here is related to how components (or rather componentIDs) are handled in the UI and MD. See the section about FFI IDs and Lua IDs here: https://wiki.egosoft.com:1337/X%20Rebir ... d%20guide/
In your case you pass the eventparam to Helper.closeMenuForSubSection. That parameter is then converted (recursively for tables) to a plain integer (see helper.lua Helper.closeMenuForSubSection() and Helper.convertComponentIDs()). Hence when passed back to MD you lost the data type infomration that the ID is actually a component. Therefore in MD you have to tell that the provided "integer" is actually a component and create a componentID again as in (pseudo code):
Code: Select all
component.{$ID}
Stefan Hett
-
- Posts: 421
- Joined: Wed, 22. Jul 09, 22:31
Hey.
I ran into a problem with the workshop tool and the buildvcat command.
Basically the ui.xml file is properly inserted in / copied to ext_01, but an empty one (0 byte) is inserted in ext_v361, which prevent the real ui.xml file from being read if I launch X Rebirth 3.61. Removing that empty file worked.
My v361 folder is a copy of my base folder (with minor changes), but without contents.xml and ui.xml. I haven't tried to add ui.xml to v361/ because I don't think that's what we're supposed to do, but maybe I'm wrong.
WorkshopTool output
Sorry if it's not the proper place to report that issue.
I ran into a problem with the workshop tool and the buildvcat command.
Basically the ui.xml file is properly inserted in / copied to ext_01, but an empty one (0 byte) is inserted in ext_v361, which prevent the real ui.xml file from being read if I launch X Rebirth 3.61. Removing that empty file worked.
My v361 folder is a copy of my base folder (with minor changes), but without contents.xml and ui.xml. I haven't tried to add ui.xml to v361/ because I don't think that's what we're supposed to do, but maybe I'm wrong.
WorkshopTool output
Sorry if it's not the proper place to report that issue.
-
- EGOSOFT
- Posts: 639
- Joined: Wed, 6. Nov 02, 20:31
The ui.xml has to be in the v361 folder as well, that should fix your problem. The catalog tool detects that the ui.xml is present in the root folder but missing in v361, so it adds the 0-byte file, which marks it as "deleted".bm01 wrote:My v361 folder is a copy of my base folder (with minor changes), but without contents.xml and ui.xml. I haven't tried to add ui.xml to v361/ because I don't think that's what we're supposed to do, but maybe I'm wrong.
-
- Posts: 421
- Joined: Wed, 22. Jul 09, 22:31
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Thanks for the informationstefanEgo wrote:@jth: Glad you found out the details about how to use the interface between Lua and MD already. We are aware that the provided interface is quite limited and would like to improve that at some point. Unfortunately, this is not as simple as it might sound. I've added a feature request for you to extend the interface to also allow passing on tables as a parameter which I believe should cover your requirements, no? http://www.egosoft.com:8282/jira/browse/XRUIMOD-102
For the time being serializing the parameters, as you already pointed out, is one way to work around this limitation.
@jth: Regarding the script error you get: What's going on behind the scene here is related to how components (or rather componentIDs) are handled in the UI and MD. See the section about FFI IDs and Lua IDs here: http://www.egosoft.com:8292/confluence/ ... rted+guide
In your case you pass the eventparam to Helper.closeMenuForSubSection. That parameter is then converted (recursively for tables) to a plain integer (see helper.lua Helper.closeMenuForSubSection() and Helper.convertComponentIDs()). Hence when passed back to MD you lost the data type infomration that the ID is actually a component. Therefore in MD you have to tell that the provided "integer" is actually a component and create a componentID again as in (pseudo code):Again, this limitation is something we'd like to remove at some point to simplify UI modding further. I've added a corresponding JIRA issue for that one now: http://www.egosoft.com:8282/jira/browse/XRUIMOD-103Code: Select all
component.{$ID}
I have modified my script a bit to incorporate a ConvertStringToLuaID(eventparam) which seems to get it into the right format
Code: Select all
-- Auto answer for structural rebuild conversations
local utf8 = require("utf8")
local menu = {
name = "STRebuildConversationControl"
}
local function init()
Menus = Menus or { }
table.insert(Menus, menu)
if Helper then
Helper.registerMenu(menu)
end
RegisterEvent("cArch_deployatstation", menu.cArch_deployatstation)
end
function menu.cArch_deployatstation(eventname, eventparam)
DebugError(eventname .. " - " .. GetComponentData(eventparam, "name") .. " " .. string.format("0x%x", eventparam))
Helper.closeMenuForSubSection(menu, false, eventname, { 0, 0, ConvertStringToLuaID(eventparam)})
menu.cleanup()
end
function menu.cleanup()
end
init()
[=ERROR=] cArch_deployatstation - Foodstuffs Supply I 0x1c50f
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
but it does trigger the call into the Architect script
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:1d6db>: <event_conversation_next_section> section: 'cArch_deployatstation'
[Scripts] *** Context:md.NPC_Architect.SectionHandler<inst:1d6db>: [0LF,0LF,component.{0x1c50fL}]
and the CV dutifully deploys to the station
.... however if I then re-run the whole mod again on the same station then it does something very strange
Mod pseudo code
Code: Select all
Build a new station on the same spot
Clone the station structure
Calculate the difference in cost betwen the new and old stations
Ask if you want to procede
If Yes
Move the NPC's over
Rename the new station
Delete the old station
Recreate the Architect on the original CV
Deploy to station -- this is where the lua comes in
Code: Select all
<start_conversation actor="$Architect" conversation="st_struct_rebuild"/>
<raise_lua_event name="'cArch_deployatstation'" param="$playerstation"/>
[General] ======================================
[General] ======================================
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
[=ERROR=] cArch_deployatstation - aOld Foodstuffs Supply I 0x33bce
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
What it is doing is re-running the second half of the md script. There are some debug_text commands in there and I get two complete sets of debug comments for the second half
I can also actually hear the beep beep of it opening two conversations
Unfortunately the two instances of the second half of the script interfere with each other and the CV fails to "Deploy to station" the second time
I think that it may be something to do with Helper.closeMenuForSubSection which may be going back to the "Ask if you want to procede" and running it again
I have a feeling that there is something in the functions that closeMenuForSubSection calls that is generating the two lines
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
[=ERROR=] Invalid call to UnregisterEvent(). Given script function must be a function but is 'nil'
What I really need it to do is a bare bones closeMenuForSubSection and do not return back anywhere
I have had a look at the other possibilities in helper.lua but don't really know what to do
Help
Regards
jth
-
- Posts: 545
- Joined: Thu, 11. Apr 13, 14:12
@jth: From the looks at the presented code, everything seems right. Guessing, the two UnregisterEvent() errors you get are related to the code in helper.lua: clearMenu() (which is triggered by ur call to Helper.closeMenuForSubSection()).
These two UnregisterEvent() calls are unregistering event callbacks which are registered by your call to Helper.registerMenu() so that part seems to be fine at first glimpse.
All I could imagine is that for whatever reason in ur case Helper is nil (you can check that by adding some output there). In this case you would register a callback (cArch_deployatstation) which then triggers the UnregisterEvent-calls without the corresponding events having been registered first and (what would trigger the error) the actual callback functions not having been defined.
What causes that, I cannot determine by the provided code here.
Maybe that info helps you to trace the problem down a bit?
If not, maybe you can provide a sample addon which I could test directly?
These two UnregisterEvent() calls are unregistering event callbacks which are registered by your call to Helper.registerMenu() so that part seems to be fine at first glimpse.
All I could imagine is that for whatever reason in ur case Helper is nil (you can check that by adding some output there). In this case you would register a callback (cArch_deployatstation) which then triggers the UnregisterEvent-calls without the corresponding events having been registered first and (what would trigger the error) the actual callback functions not having been defined.
What causes that, I cannot determine by the provided code here.
Maybe that info helps you to trace the problem down a bit?
If not, maybe you can provide a sample addon which I could test directly?
Stefan Hett
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Uniquely identifying a production module within a station
I am working on some code to put a throttle on production modules
The heavy lifting needs to be done in lua code
I am intending to replace the menu_production code with a customised version.
menu_production gets passed two parameters, the station and the production module
A lot of stations have more than one production line of the same type.
In a FoodStuffs Supply I need to be able to identify which Valley forge is which. So that I can adjust the throttle later, on the right one.
Obviously I cannot use objectID as they change every time the game is reloaded.
Is it possible to get the build stage of a particular production module or find a couple of parameters that combined together uniquely identify a specfic production module within a station ?
It needs to be valid over save games and survive the player extending the station ....
jth
EDIT 18:40
Put together some code borrowed heavily from menu_buildtree.lua that goes through the station buildtree and finds the buildstage for each production module
results
[General] ======================================
[=ERROR=] Station is Foodstuffs Supply I
[General] ======================================
[General] ======================================
[=ERROR=] Module is Liquor Still
[General] ======================================
[General] ======================================
[=ERROR=] Module ID: 16881844
[General] ======================================
[General] ======================================
[=ERROR=] [a,0] Foodstuff Fac ID: 16819627
[General] ======================================
[General] ======================================
[=ERROR=] [a,1] Foodstuff Fac ID: 16878931
[General] ======================================
[General] ======================================
[=ERROR=] [b,1] Valley Forge ID: 16819617
[General] ======================================
[General] ======================================
[=ERROR=] [b,2] Valley Forge ID: 16879060
[General] ======================================
[General] ======================================
[=ERROR=] [c,1] Liquor Still ID: 16881844
[General] ======================================
[General] ======================================
[=ERROR=] [d,1] Argnu Paradise ID: 16879153
[General] ======================================
[General] ======================================
[=ERROR=] [e,1] Spice Tubes ID: 16803969
[General] ======================================
[General] ======================================
[=ERROR=] [f,1] Container Storage ID: 16882068
[General] ======================================
A good days work
The heavy lifting needs to be done in lua code
I am intending to replace the menu_production code with a customised version.
menu_production gets passed two parameters, the station and the production module
A lot of stations have more than one production line of the same type.
In a FoodStuffs Supply I need to be able to identify which Valley forge is which. So that I can adjust the throttle later, on the right one.
Obviously I cannot use objectID as they change every time the game is reloaded.
Is it possible to get the build stage of a particular production module or find a couple of parameters that combined together uniquely identify a specfic production module within a station ?
It needs to be valid over save games and survive the player extending the station ....
jth
EDIT 18:40
Put together some code borrowed heavily from menu_buildtree.lua that goes through the station buildtree and finds the buildstage for each production module
Code: Select all
DebugError("Station is " .. GetComponentData(menu.object, "name"))
DebugError("Module is " .. GetComponentData(menu.module, "name"))
DebugError("Module " .. tostring(menu.module))
menu.buildtree = GetBuildTree(menu.object)
table.sort(menu.buildtree, function (a, b) return a.name < b.name end)
for seqidx, seqdata in ipairs(menu.buildtree) do
if seqdata.sequence == "a" then
modules = GetBuildStageModules(menu.object, "", 0)
for _, module in ipairs(modules) do
if module.library == "moduletypes_production" then
DebugError("[a,0] " .. module.name .. " " .. tostring(module.component))
end
end
end
for stageidx, stagedata in ipairs(seqdata) do
if stagedata.stage <= seqdata.currentstage or menu.task == "building" then
DebugError("[" .. seqdata.sequence .. "," .. stagedata.stage .. "] " .. stagedata.name .. " " .. tostring(stagedata.primarycomponent))
end
end
end
[General] ======================================
[=ERROR=] Station is Foodstuffs Supply I
[General] ======================================
[General] ======================================
[=ERROR=] Module is Liquor Still
[General] ======================================
[General] ======================================
[=ERROR=] Module ID: 16881844
[General] ======================================
[General] ======================================
[=ERROR=] [a,0] Foodstuff Fac ID: 16819627
[General] ======================================
[General] ======================================
[=ERROR=] [a,1] Foodstuff Fac ID: 16878931
[General] ======================================
[General] ======================================
[=ERROR=] [b,1] Valley Forge ID: 16819617
[General] ======================================
[General] ======================================
[=ERROR=] [b,2] Valley Forge ID: 16879060
[General] ======================================
[General] ======================================
[=ERROR=] [c,1] Liquor Still ID: 16881844
[General] ======================================
[General] ======================================
[=ERROR=] [d,1] Argnu Paradise ID: 16879153
[General] ======================================
[General] ======================================
[=ERROR=] [e,1] Spice Tubes ID: 16803969
[General] ======================================
[General] ======================================
[=ERROR=] [f,1] Container Storage ID: 16882068
[General] ======================================
A good days work
-
- Posts: 545
- Joined: Thu, 11. Apr 13, 14:12
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Didn't spot those parameters yesterdaystefanEgo wrote:@jth: Take a look at GetComponentData() with the properties "sequence" and "stage". That might be what you are looking for.
It is certainly a bit shorter and simpler than my effort. Have added something to take care of [a,0]
Code: Select all
local sequence, stage = GetComponentData(component, "sequence", "stage")
if sequence == "" then
sequence = "a"
end
DebugError("BuildStage [" .. sequence .. "," .. stage .. "]")
jth
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
How do I remove a specific entry from a BlackBoard table in lua
I am storing a list of production modules on the manager's Blackboard in a lua script
Its using $manager.$ProdData as a table and storing each production module as a sub table
I want to remove one of them
how do I do that in lua ?
Do I read $ProdData into a temp table, delete the specific entry and then save the amended table back onto the BlackBoard ?
or is there a simpler way to do it ?
Thanks
jth
Its using $manager.$ProdData as a table and storing each production module as a sub table
I want to remove one of them
how do I do that in lua ?
Do I read $ProdData into a temp table, delete the specific entry and then save the amended table back onto the BlackBoard ?
or is there a simpler way to do it ?
Thanks
jth
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
Re: How do I remove a specific entry from a BlackBoard table in lua
it should bejth wrote:I am storing a list of production modules on the manager's Blackboard in a lua script
Its using $manager.$ProdData as a table and storing each production module as a sub table
I want to remove one of them
how do I do that in lua ?
Do I read $ProdData into a temp table, delete the specific entry and then save the amended table back onto the BlackBoard ?
or is there a simpler way to do it ?
Thanks
jth
Code: Select all
table.remove($manager.$ProdData, index)
Code: Select all
$manager.$ProdData[module] = nil
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Re: How do I remove a specific entry from a BlackBoard table in lua
Thanks will give it a tryPhipsz wrote:it should beor, if the table is key-basedCode: Select all
table.remove($manager.$ProdData, index)
with index(integer) and module of course being variables containing the respective contentCode: Select all
$manager.$ProdData[module] = nil
jth
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Extending the menu-production screen
I need to add some extra functionality into menu-production to support my station production throttling mod
I was initially thinking of a slider at the bottom
For most production modules a single slider is all that is needed but for the Missile and Turret Forges I need to show all the possible products and be able to select and use a slider on each of them.
This could possibly be done by switching from a TwoTableView to a TwoTableSliderView. I have attempted to bolt bits of menu_build_production_slider in but without much luck
I added in
and changed
to
and got the following
[=ERROR=] CWidgetController::SetUpView() - Validation error: 'Script error: 'Invalid tab orders. Tab orders must be unique.'
That has me stumped
My alternative thoughts were to turn it into a ThreeTableView and add some buttons at the bottom but that ran into a different hitch. Is there an easy way to convert from a two tableview to a three ?
I was also considering adding a "production module throttling" section and list of all the available products to the bottom of the infotable but with the "encyclopedia" button redirected to a separate slider menu. That might just cover the missile and turret forges.
I don't really know what is the best way to go and as usual am attempting the olympic sprint before being able to walk
Having hit a brick wall with the first two options I may spend some time investigating the third
Any thoughts, documentation (beyond the listings for helper.lua) ?
jth
I was initially thinking of a slider at the bottom
For most production modules a single slider is all that is needed but for the Missile and Turret Forges I need to show all the possible products and be able to select and use a slider on each of them.
This could possibly be done by switching from a TwoTableView to a TwoTableSliderView. I have attempted to bolt bits of menu_build_production_slider in but without much luck
I added in
Code: Select all
local sliderinfo = {
["background"] = "tradesellbuy_blur",
["captionLeft"] = "",
["captionCenter"] = "",
["captionRight"] = "",
["min"] = 0,
["minSelectable"] = 0,
["max"] = 100,
["zero"] = 0,
["start"] = 50
}
local scale1info = {
["left"] = nil,
["right"] = nil,
["center"] = false,
["inverted"] = false,
["suffix"] = nil
}
local scale2info = {
["left"] = nil,
["right"] = nil,
["center"] = false,
["factor"] = nil,
["inverted"] = true,
["suffix"] = nil
}
local sliderdesc = Helper.createSlider(sliderinfo, scale1info, scale2info, 1, Helper.sliderOffsetx, 443)
Code: Select all
-- create tableview
menu.infotable, menu.selecttable = Helper.displayTwoTableView(menu, infodesc, selectdesc, false)
Code: Select all
-- create tableview
menu.infotable, menu.selecttable, menu.slider = Helper.displayTwoTableSliderView(menu, infodesc, selectdesc, sliderdesc, true)
[=ERROR=] CWidgetController::SetUpView() - Validation error: 'Script error: 'Invalid tab orders. Tab orders must be unique.'
That has me stumped
My alternative thoughts were to turn it into a ThreeTableView and add some buttons at the bottom but that ran into a different hitch. Is there an easy way to convert from a two tableview to a three ?
I was also considering adding a "production module throttling" section and list of all the available products to the bottom of the infotable but with the "encyclopedia" button redirected to a separate slider menu. That might just cover the missile and turret forges.
I don't really know what is the best way to go and as usual am attempting the olympic sprint before being able to walk
Having hit a brick wall with the first two options I may spend some time investigating the third
Any thoughts, documentation (beyond the listings for helper.lua) ?
jth
-
- Posts: 545
- Joined: Thu, 11. Apr 13, 14:12
@jth:
Given the error you get, it's likely you created two elements with the same tab order (aka: 1). Simply change the 1 to something else (presumably 3) and the error should be resolved.
I see that the helper.lua file (in ego_fullscreenHelper) is missing the taborder in the comment. I've corrected that locally and the corrected docu is expected to make it in the next build.
Note that the taborder inside a view specifies the order interactive elements can be tabbed through (by pressing the tab key) and therefore each element must have a unique tab order number.
Code: Select all
Helper.createSlider(sliderinfo, scale1info, scale2info, 1, Helper.sliderOffsetx, 443)
I see that the helper.lua file (in ego_fullscreenHelper) is missing the taborder in the comment. I've corrected that locally and the corrected docu is expected to make it in the next build.
Note that the taborder inside a view specifies the order interactive elements can be tabbed through (by pressing the tab key) and therefore each element must have a unique tab order number.
Stefan Hett
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Thanks for that explanation.stefanEgo wrote:@jth:Given the error you get, it's likely you created two elements with the same tab order (aka: 1). Simply change the 1 to something else (presumably 3) and the error should be resolved.Code: Select all
Helper.createSlider(sliderinfo, scale1info, scale2info, 1, Helper.sliderOffsetx, 443)
I see that the helper.lua file (in ego_fullscreenHelper) is missing the taborder in the comment. I've corrected that locally and the corrected docu is expected to make it in the next build.
Note that the taborder inside a view specifies the order interactive elements can be tabbed through (by pressing the tab key) and therefore each element must have a unique tab order number.
That got me a slider at the bottom of the page
However the page doesn't have an up down slider on the right hand side any more and I have a lot of stuff on that page
I have had a bit of a play at getting the up down slider back but it looks to get very complicated very fast. It looks like it turns into a complicated geometry problem
Is there any way to simply get the up down slider back or does the TwoTableSliderView not practically allow an up down slider on the right hand side when you have a left right slider at the bottom ?
As a bit of lateral thinking can I add one or more slider(s) as a table entry(s) to a TwoTableView, make the row taller and say pop it\them in as the second column ?
I am trying to get a grip on what is possible\practical and what would need a lot of work by someone that knows what they are doing
jth
-
- Posts: 296
- Joined: Tue, 3. Jan 06, 23:31
Slider documentation
I am experimenting with the slider and making some progress but would like to know what some of the parameters do. I have looked in the helper.lua file
I found most of the following in menu_build_upgrades_slider.lua and have tweaked it a bit
The sliderinfo seems reasonably self documenting
scale1info and scale2info are less obvious. I made a guess on scalinfo1 and set center to true and a number popped up a the right hand side of the slider which is what I was looking for
Is there any way to scale that number ?
Thanks
jth
EDIT
Had a further play and came up with
It looks like there are two possible numbers that can appear immediately to the right of the slider bar, scale1info controls the first and scale2info the second. If you use both then the second number automatically gets a set of () around it. The second appears to be the most formattable
and my code produces 0% - 100%. So that answers my scaling question
left, right, inverted ?
I found most of the following in menu_build_upgrades_slider.lua and have tweaked it a bit
Code: Select all
local sliderinfo = {
["background"] = "tradesellbuy_blur",
["captionLeft"] = ReadText(1001, 19) .. " " .. ReadText(1001, 1600) .. " (0)",
["captionCenter"] = "Production Brake",
["captionRight"] = ReadText(1001, 1601) .. " (" .. menu.maxslider .. ")",
["min"] = 0,
["minSelectable"] = 0,
["max"] = menu.maxslider,
["zero"] = 0,
["start"] = math.floor(menu.prodbrake * menu.maxslider)
}
local scale1info = {
["left"] = nil,
["right"] = nil,
["center"] = true,
["inverted"] = false,
["suffix"] = nil
}
local scale2info = {
["left"] = nil,
["right"] = nil,
["center"] = false,
["factor"] = nil,
["inverted"] = true,
["suffix"] = nil
}
scale1info and scale2info are less obvious. I made a guess on scalinfo1 and set center to true and a number popped up a the right hand side of the slider which is what I was looking for
Is there any way to scale that number ?
Thanks
jth
EDIT
Had a further play and came up with
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"] = true,
["suffix"] = "%"
}
and my code produces 0% - 100%. So that answers my scaling question
left, right, inverted ?
-
- Posts: 545
- Joined: Thu, 11. Apr 13, 14:12
@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".
Adding multiple sliders on a single view is on our list already. No ETA when this will be possible however atm. In theory you could achieve this, but it would require heavy modifications on the widget system.
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:
Adding multiple sliders on a single view is on our list already. No ETA when this will be possible however atm. In theory you could achieve this, but it would require heavy modifications on the widget system.
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
Stefan Hett