Ok, that makes more sense ^_^zwzsg wrote:Jazcash: In C, 0 is false, so if(y) means if y is not 0, so the division is not done when y is zero.
Convert absurd buildtime values into seconds
Moderator: Moderators
Re: Convert absurd buildtime values into seconds
Re: Convert absurd buildtime values into seconds
Just keep in mind C and Lua diverge on that point.
- In C the condition is taken if (maybe after conversion) it's not 0
- In Lua the condition is taken if it's neither nil nor false
So:
- 0 is "false" in C
- 0 is "true" in Lua
- In C the condition is taken if (maybe after conversion) it's not 0
- In Lua the condition is taken if it's neither nil nor false
So:
- 0 is "false" in C
- 0 is "true" in Lua
Re: Convert absurd buildtime values into seconds
Look closer... it displays zero if workertime is zero. Which is correct way of doing it.zwzsg wrote:Okay you want the tooltip to always display 0 instead of buildtime. Sure, that's doable. Totally useless, but doable.
dozen? are you kidding me?zwzsg wrote:Also you want to read a file, always the same file, and god only know which, about a dozen time per rendering frame. I can only hope our OS handle caching well.
Code: Select all
void read_file(){
load_library("unitsync.dll");
load_modfile("BA642.sd7");
for(u = 0; u < total_units; u++){ // loop through all units in mod
if(!read_fbi(Unitdefs[u].UnitName + ".fbi")){ // read unit file and handle errors:
load_library("unitsync.dll");
load_modfile("BA642.sd7");
u--; // try again
}
}
}
Re: Convert absurd buildtime values into seconds
Nah, you never changed y, so it's still 0. I mean, no sane person would want something as ugly as having y be a global variable, and having read_file() modify y, so I assumed read_file() was here just to make it run more sluggishly.Look closer... it displays zero if workertime is zero. Which is correct way of doing it.
Assuming you always have a cons selected, and that your ctrlpanel.txt is set to display only a dozen buildpic per page.dozen? are you kidding me?
Not at all a BA specific request!load_modfile("BA642.sd7");
I know you hate LUA, but FBI are a things of the past. There's whole mods with lotsa units without a single FBI file now.+".fbi"
Loading the same .dll and .sd7 as many times as there are units?for(u = 0; u < total_units; u++){
load_library("unitsync.dll");
load_modfile("BA642.sd7");
}
Get stuck in an infinite loop if fails?u--; // try again
Wait.. you're just typing non-sensical code to trick me into replying seriously to garbage and I fell in your trap. There's no way you could believe that this code bit has any relevance to getting workertime of selected units.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Convert absurd buildtime values into seconds
I just got a brand new idea! Make a widget!
Re: Convert absurd buildtime values into seconds
Sorry, i forgot to include the read_fbi() function, it had the global variable y set in there.zwzsg wrote:Wait.. you're just typing non-sensical code to trick me into replying seriously to garbage and I fell in your trap. There's no way you could believe that this code bit has any relevance to getting workertime of selected units.
Fool. My code was a widget, i made c++ interpreter with lua. note that it compiles the script into exe every frame and executes it by using WinExec(), ofc its using SW_HIDE so you wont see the window popping up all the time.CarRepairer wrote:I just got a brand new idea! Make a widget!
Re: Convert absurd buildtime values into seconds
I think it should be as basic as possible.And check for walls that would prevent a patrolling cons to reach a factories... okay there it starts getting too stupid. But where do you draw the line?
Taking into account walktime of cons etc. is too much. This is just about the tooltip not real time estimates like the ETA widget does.
For factories buildings it should just be unitbuildtime / factoryworkspeed
Surely the engine has these informations and can transform them into to seconds?
And for multiple constructors making a building it should be unitbuildtime / workspeed_of_all_selected_cons_added_up
The engine can sum up the health of all selected units so it can surely also add up their workerspeed?
If multiple factories are selecting and the player wants each one to make the same unit, it should just show the average. Must of the time the factories will finish at the same/have same workspeed anyway.
Like 5 baracks each making one spacemarine, 5 vehlabs each making one flashtank etc.
I think as a player I just want to know "I have 10 conbots and want to make a fusion. How long will that take if i do not stall?"
The correct answer would be "90 seconds"
The answer you currently get is "622145"
Even if the time is not 100% correct due to cons walking, unfolding blabla the first answer was still more helpful.
Or the noob who does not know if "buildtime: 520145" for a Krog will take long or not. But if he sees "unassisted buildtime: 20 minutes", thats some usefull information.
Even after reading Forboding Angel's math I've already forgetten how many seconds something in BA takes to build if the tooltips reads "buildtime 42133"
One minute? 10 minutes? I think i must divide by 90.8 or something. No idea! And by which number must I divide in game X? Uhm...
30 seconds will always be 30 seconds.
Yea, I see what you mean. Its the "this just has to work" approach. But it is somewhat hackish, like when I tried to generate minimaps by taking screenshots of the map. It might have side effects for example isn't mass based on unitcost too by default? And targetting uses cost too I think?Yes the proposed system would be nifty, but the fact is that you can have something close without needing a new version of spring or any luaz.
Re: Convert absurd buildtime values into seconds
I disagree on the second point. If multiple factories are selected, then it should also shows unitbuildtime / workspeed_of_all_selected_facs_added_up. That way both factories and cons are treated the same way. That way the engine doesn't have to know if it's factory or a cons, a helper or an initiator.knorke wrote:And for multiple constructors making a building it should be unitbuildtime / workspeed_of_all_selected_cons_added_up
If multiple factories are selecting and the player wants each one to make the same unit, it should just show the average.
It still makes some sense if you reason in term of: Every 2 seconds I'll get one new Peewee from this batch of factories.
Re: Convert absurd buildtime values into seconds
How has this thread continued on for 4 pages?
The solution is just a simple lua widget, less than a dozen lines of functional code, buildtime/sum(buildspeed), want nanos factored in? Then just add them to the selection.
This is not an engine issue! It is a UI issue, which is what lua is for. Though afaik there is no easy way to override the tooltip text before it reaches tooltip rendering widgets, so you might have to get creative on how to display it, which is down to user/mod style.
The solution is just a simple lua widget, less than a dozen lines of functional code, buildtime/sum(buildspeed), want nanos factored in? Then just add them to the selection.
This is not an engine issue! It is a UI issue, which is what lua is for. Though afaik there is no easy way to override the tooltip text before it reaches tooltip rendering widgets, so you might have to get creative on how to display it, which is down to user/mod style.
Re: Convert absurd buildtime values into seconds
From what I've gathered, Niobium, that isn't a solution since we can't know what is building the structure.
Re: Convert absurd buildtime values into seconds
There is actually.:Niobium wrote:Though afaik there is no easy way to override the tooltip text before it reaches tooltip rendering widgets
function widget:GetTooltip(x,y)
return your_custom_tooltip_text
end
(I think it's widget:IsAbove(x,y) that takes care of knowing when to not.)
For instance, in KP, I have the ColorWar gadget and the BuildBar widget that swap the tooltip text with their own text, and the ToolTip widget that reformat and display the tooltip. So the tooltip content and the tooltip drawing are neatly separated.
Well, sorta, because my tooltip widget parse the tooltip text to determine which type is it, and if it is a unit tooltip, a builbutton tooltip, or a command tooltip, it extracts the relevant info then rewrite it in its own way, removing some info, adding others. So I had to modify the BuildBar widget to make it output in exactly the same format as the engine so my tooltip widget could correctly parse it. For extra cleanness I could have broken my tooltip widget in two, into a reformating widget, and a drawing widget.
I just realise now, changes in the engine tooltip could break my tooltip widget, as well as other tooltip reformatting widgets from other mods, which suddently make engine change even less desirable.
Re: Convert absurd buildtime values into seconds
this is engine default UI issue, which doesnt use lua, does itNiobium wrote:This is not an engine issue! It is a UI issue, which is what lua is for. Though afaik there is no easy way to override the tooltip text before it reaches tooltip rendering widgets, so you might have to get creative on how to display it, which is down to user/mod style.
Re: Convert absurd buildtime values into seconds
Which is exactly why the complete engine UI should go, at some point, in my opinion.
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: Convert absurd buildtime values into seconds
Why are you using engine default UI? One of the engine UI's main task is not to get in the way of lua UI. It should certainly not change as a change would break many lua UIs.
There are 2 very simple solutions:
* Write a very simple gadget to read unit selection, read tooltip and output a tooltip with your desired information.
* Use easily calculatable BT values in whichever game you think has the problem.
There are 2 very simple solutions:
* Write a very simple gadget to read unit selection, read tooltip and output a tooltip with your desired information.
* Use easily calculatable BT values in whichever game you think has the problem.
Re: Convert absurd buildtime values into seconds
no. it must work on every mod.Google_Frog wrote: * Write a very simple gadget to read unit selection, read tooltip and output a tooltip with your desired information.
i wont change every mod. waste of time, you could just make small patch like i said, but noo... need to whine here instead than do some work to improve the freaking default UI.Google_Frog wrote: * Use easily calculatable BT values in whichever game you think has the problem.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Convert absurd buildtime values into seconds
Yeah google, why are you whining instead of making a patch. TradeMark is right, you are doing nothing to help!TradeMark wrote:no. it must work on every mod.Google_Frog wrote: * Write a very simple gadget to read unit selection, read tooltip and output a tooltip with your desired information.
i wont change every mod. waste of time, you could just make small patch like i said, but noo... need to whine here instead than do some work to improve the freaking default UI.Google_Frog wrote: * Use easily calculatable BT values in whichever game you think has the problem.
Re: Convert absurd buildtime values into seconds
Oh. Then an engine patch is out of question, as that would break some mods.TradeMark wrote:no. it must work on every mod.
Re: Convert absurd buildtime values into seconds
And how it would break some mods...? I gave you the patch already, use it.zwzsg wrote:Oh. Then an engine patch is out of question, as that would break some mods.TradeMark wrote:no. it must work on every mod.
Re: Convert absurd buildtime values into seconds
I don't understand. You made maps, maybe not of top originality but nice and playable nonetheless. You made that modinfo site, which must have taken lots of work, and shows you can do coding.
So why have you now sunk to the argumentative level of a Creationist?
So why have you now sunk to the argumentative level of a Creationist?
Re: Convert absurd buildtime values into seconds
Because you dont know what youre talking about