Then include it in BA so people can mod BA.but every mod has to include these widgets... my point is we should be able to make standard mod without knowing how to program the whole game yourself...
dont quit building when you click on wrong place
Moderator: Moderators
-
- Moderator
- Posts: 2464
- Joined: 12 Oct 2007, 09:24
Re: dont quit building when you click on wrong place
Re: dont quit building when you click on wrong place
The deselection is a bug. Period.
Re: dont quit building when you click on wrong place
spring is an ENGINE. You kinda need to do it this way, even modern game mods require SOME programing knowledge.TradeMark wrote:but every mod has to include these widgets... my point is we should be able to make standard mod without knowing how to program the whole game yourself...
Re: dont quit building when you click on wrong place
my point is we should have basic functionalities for the UI
instead of coding all those yourself
instead of coding all those yourself
+1111Regret wrote:The deselection is a bug. Period.
Re: dont quit building when you click on wrong place
depends on what you consider correct.
Re: dont quit building when you click on wrong place
The whole selection code should be widgetized to begin with.
Re: dont quit building when you click on wrong place
-fixedAF wrote:The whole selection code should be gadgetized to begin with.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: dont quit building when you click on wrong place
AllowCommand is luarules, can't be in widget. But I'm sure there's still a way.Argh wrote:Use AllowCommand(), get the command ID, and check if command ID cooresponds to a UnitDef (factories it's -unitDefID, IIRC it's positive with Units that aren't factories, but whatever).
Params should give XYZ. Check validity of that command with Spring.TestBuildOrder().
If it fails, then play an alert sound locally to the end-user, and have the command return false.
IOW, go read the Wiki, so that that all makes sense... and you're done.
Re: dont quit building when you click on wrong place
Yes, you're right. That said, a Gadget's not a big deal, other than requiring an update release of whatever project's using it. I wrote a solution in about an hour, including re-selecting the Unit who went awry.
Re: dont quit building when you click on wrong place
It's quite concerning the engine is falling apart and we're told to patch it from gadgets.zwzsg wrote:-fixedsmoth wrote:-fixedAF wrote:The whole engine code is getting gadgetized to begin with.
Re: dont quit building when you click on wrong place
explain?zwzsg wrote:It's quite concerning the engine is falling apart
- TheFatController
- Balanced Annihilation Developer
- Posts: 1177
- Joined: 10 Dec 2006, 18:46
Re: dont quit building when you click on wrong place
I wrote this in 10 minutes and it doesn't work but if someone can unbug it (should be easy) it should block mouse clicks for invalid orders.
Code: Select all
function widget:MousePress(x, y, button)
if button==1 and select(1,Spring.GetActiveCommand()) < 0 then
local _,coords = Spring.TraceScreenRay(x,y,true,true)
local dx,dz = coords[1],coords[3]
if dx and dz and (not Spring.TestBuildOrder((select(1,Spring.GetActiveCommand())*-1),dx,0,dz)) then
return true
end
end
return false
end
Re: dont quit building when you click on wrong place
you are an asshole. Help you if you are going to use this word please.mongus wrote:NOOBS!!
Re: dont quit building when you click on wrong place
Hey, TFC, I am pretty sure that this has to be a Gadget. In the case of this error, the Command has already been "sent", the problem for the end-user is that it was not sent as they'd prefer. You want to catch the problem in AllowCommand(), basically.
Re: dont quit building when you click on wrong place
no argh, his method really would work. he's blocking it at a mouse click level before the command is sent.
that'd make a nice addition to my widget mouse handler (unreleased but basic demo/example here) ^_^
that'd make a nice addition to my widget mouse handler (unreleased but basic demo/example here) ^_^
Re: dont quit building when you click on wrong place
So much about the easyness...
Argh wrote:Easy Widget.
Argh wrote:But my point is that it's very easy to write a Widget to solve this problem. I.E., this is a great, "my first Widget" project for somebody.
Argh wrote:Seriously, though, this really is a "my first project" thingie. If you don't want to write it, then request it in the Lua forum, this is pretty trivial.
Argh wrote:but this really is a very simple Widget project, so maybe follow that link and start working on it?
Easy, really...Argh wrote:I am sure you can figure it out, it's an easy one. Just use AllowCommand(), and go from there. Easy, really.
Im sure we would win if we voted about it. you would be the only one with your -1 vote, gtfo noob.smoth wrote:depends on what you consider correct.
Re: dont quit building when you click on wrong place
Use invqueuekey, its an alternative that already does what is requested.d_b wrote:you are an asshole. Help you if you are going to use this word please.
(and the coloured text is a wiki link to how to use it.)
So at least im an informative asshole.
Re: dont quit building when you click on wrong place
Well, yeah. I guess that means nobody got one working by now?Easy, really...
When I get done working on what I am currently messing with (buncha Photoshop stuff for a friend of mine, we're scanning and resizing some 1950's children's stories tonight), I will release some source.
Re: dont quit building when you click on wrong place
If no one is working on fixing this in the engine, I can give it a try.