Page 2 of 3

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 12:32
by Google_Frog
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...
Then include it in BA so people can mod BA.

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 12:35
by Regret
The deselection is a bug. Period.

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 16:26
by smoth
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...
spring is an ENGINE. You kinda need to do it this way, even modern game mods require SOME programing knowledge.

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 16:33
by TradeMark
my point is we should have basic functionalities for the UI

instead of coding all those yourself

Regret wrote:The deselection is a bug. Period.
+1111

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 16:36
by smoth
depends on what you consider correct.

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 16:39
by AF
The whole selection code should be widgetized to begin with.

Re: dont quit building when you click on wrong place

Posted: 11 Nov 2009, 16:51
by smoth
AF wrote:The whole selection code should be gadgetized to begin with.
-fixed

Re: dont quit building when you click on wrong place

Posted: 12 Nov 2009, 07:20
by CarRepairer
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.
AllowCommand is luarules, can't be in widget. But I'm sure there's still a way.

Re: dont quit building when you click on wrong place

Posted: 12 Nov 2009, 07:43
by Argh
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

Posted: 12 Nov 2009, 20:07
by zwzsg
zwzsg wrote:
smoth wrote:
AF wrote:The whole engine code is getting gadgetized to begin with.
-fixed
-fixed
It's quite concerning the engine is falling apart and we're told to patch it from gadgets.

Re: dont quit building when you click on wrong place

Posted: 12 Nov 2009, 23:43
by smoth
zwzsg wrote:It's quite concerning the engine is falling apart
explain?

Re: dont quit building when you click on wrong place

Posted: 14 Nov 2009, 11:15
by TheFatController
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

Posted: 16 Nov 2009, 01:25
by mongus

Re: dont quit building when you click on wrong place

Posted: 17 Nov 2009, 05:49
by Tribulex
mongus wrote:NOOBS!!
you are an asshole. Help you if you are going to use this word please.

Re: dont quit building when you click on wrong place

Posted: 17 Nov 2009, 07:29
by Argh
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

Posted: 17 Nov 2009, 07:56
by aegis
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) ^_^

Re: dont quit building when you click on wrong place

Posted: 17 Nov 2009, 13:31
by TradeMark
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?
Argh wrote:I am sure you can figure it out, it's an easy one. Just use AllowCommand(), and go from there. Easy, really.
Easy, really...

smoth wrote:depends on what you consider correct.
Im sure we would win if we voted about it. you would be the only one with your -1 vote, gtfo noob.

Re: dont quit building when you click on wrong place

Posted: 17 Nov 2009, 17:24
by mongus
d_b wrote:you are an asshole. Help you if you are going to use this word please.
Use invqueuekey, its an alternative that already does what is requested.
(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

Posted: 18 Nov 2009, 02:54
by Argh
Easy, really...
Well, yeah. I guess that means nobody got one working by now?

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

Posted: 18 Nov 2009, 16:19
by zerver
If no one is working on fixing this in the engine, I can give it a try.