Search

Search found 162 matches

by Broker
01 Apr 2013, 11:17
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

There is documentation... It may not be perfect but only a few things are unclear imo (and not the stuff you are currently dealing with). If there's a particular function you are unclear about, ask away. But you should try things out yourself first ;) Unfortunately my experiments failed. Thank you.
by Broker
01 Apr 2013, 09:53
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

Man, to write something in lua, you should learn Lua Scripting . If you want world coordinate then you should use Screen & Window Geometry As I understood to get world coordinates where pointed center of view doing in such way: local w, h, x, y = Spring.GetViewGeometry() Spring.Echo( w, h, x, y ) l...
by Broker
29 Mar 2013, 15:41
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

Youth nowadays has it too easy with GetScreenGeometry! In ye ole days, to retrieve screen size I had to store the arguments a DrawScreenEffects was called with! local ScreenWidthInPixels local ScreenHeightInPixels function widget:DrawScreenEffects(vsx, vsy) ScreenWidthInPixels, ScreenHeightInPixels...
by Broker
29 Mar 2013, 15:26
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

Learn to debug then. I advise generously sprinkling your code with Spring.Echo, to find which blocks are run and what are the values of your variables, until you find precisely on which line it is going wrong. Have Spring windowed and use /luaui reload to shorten the change code - test in Spring cy...
by Broker
29 Mar 2013, 14:47
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

zwzsg wrote:
you are referring to variables outside their scope
This means that you have to change

Code: Select all

function fct()
	if tst then
		local a,b = ...
	end
	Spring.Echo(a,b)
end
into :

Code: Select all

function fct()
	local a,b
	if tst then
		a,b = ...
	end
	Spring.Echo(a,b)
end

I understand. I changed it but nothing happened.
by Broker
29 Mar 2013, 14:05
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

zwzsg wrote:return -1 ? Really? I know of some callins where you return true to say your widget ate the event or nil/false to keep it available to other events. But -1 ?
I do not know. this is the code of the original widget.
by Broker
29 Mar 2013, 12:35
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

ok start by fixing this you are referring to variables outside their scope mapX, mapY and mapZ are referred out of scope next, are you *sure* you want to get the center of the screen for this, and not the mouse position? in case you want to use the mouse position, you can just use the x and y coord...
by Broker
29 Mar 2013, 11:43
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

you are referring to variables outside their scope also that can't be the entirety of the code, right? yes. full code is it is part from gui_idle_builders_new.lua [code] function widget:MouseRelease(x, y, button) if not activePress then return -1 end activePress = false local iconNum = MouseOverIco...
by Broker
29 Mar 2013, 09:48
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

You need to put some effort in this yourself if you want help. Post the exact error, or show what isn't working. sorry local x, y = Spring.GetViewGeometry() local result, coords = Spring.TraceScreenRay(x, y, true) if result == "ground" then local mapX, mapY, mapZ = unpack(coords) end echo(x) echo(y...
by Broker
29 Mar 2013, 09:19
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

local x, y = Spring.GetCameraPosition() GetCameraPosition returns 3d coordinates of camera in world space, so is unfit as source of parameters for TraceScreenRay. What you want instead should look like: local x, y = Spring.GetViewGeometry() local result, coords = Spring.TraceScreenRay(x, y, true) i...
by Broker
28 Mar 2013, 13:23
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

local x, y = Spring.GetCameraPosition() GetCameraPosition returns 3d coordinates of camera in world space, so is unfit as source of parameters for TraceScreenRay. What you want instead should look like: local x, y = Spring.GetViewGeometry() local result, coords = Spring.TraceScreenRay(x, y, true) i...
by Broker
28 Mar 2013, 12:52
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

gajop wrote:divide by 2
not the center of the map. center of the screen. as the coordinates of the mouse cursor on the map.
by Broker
28 Mar 2013, 12:43
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

Re: question about coordinate unit.

I assume you mean map size (screen size is resolution Spring's using): http://springrts.com/wiki/Lua_ConstGame#Map. X and Z coordinates define the map size (Y is height), so yes, it's important to specify both X and Z when giving map-specific orders. Thank you. I understand about the coordinates. m...
by Broker
28 Mar 2013, 12:40
Forum: Balanced Annihilation
Topic: Factory and destination point
Replies: 17
Views: 1871

Re: Factory and destination point

According to the Lua wiki: bool canReclaim Default: builder && reclaimSpeed > 0 Can the unit be issued reclaim commands? For builders only. float reclaimSpeed Default: workerTime How fast the builder can reclaim other units and features. Since all labs have workertime>0 and canReclaim is not specif...
by Broker
28 Mar 2013, 12:38
Forum: Lua Scripts
Topic: BA Waypoint Dragger
Replies: 5
Views: 471

Re: BA Waypoint Dragger

Silentwings wrote:edit: Posted onto wrong thread, ops.
I think this is the answer about the Factory and destination point.

I added a condition unitDefID.isFactory == false. it works.
by Broker
28 Mar 2013, 12:25
Forum: Lua Scripts
Topic: question about coordinate unit.
Replies: 30
Views: 2051

question about coordinate unit.

how can I get the coordinates of the center of the screen on the map?

which means z coordinate on the map? Does it need consider when ordering others to move units.
by Broker
28 Mar 2013, 10:51
Forum: Lua Scripts
Topic: BA Waypoint Dragger
Replies: 5
Views: 471

Re: BA Waypoint Dragger

Forboding Angel wrote:Try it and see?
It is LIVE))))))

now you can drag waypoint with out selection unit before.
by Broker
27 Mar 2013, 12:31
Forum: Balanced Annihilation
Topic: Factory and destination point
Replies: 17
Views: 1871

Re: Factory and destination point

Yes, thanks, I can see your problem now. This doesn't happen for most people and there is something specific about your configuration that's causing it. Could you rerun that demo (drag the file over spring.exe and it will play as though you are a spectator), and then after that upload the file info...
by Broker
27 Mar 2013, 11:30
Forum: Lua Scripts
Topic: BA Waypoint Dragger
Replies: 5
Views: 471

Re: BA Waypoint Dragger

Broker wrote:if i change
local selUnitsTbl = sprGetSelectedUnits()
to
local selUnitsTbl = GetTeamUnits(Spring.GetMyTeamID)

do i can drag waypoint with out selecting units?

Help plz )))))
by Broker
27 Mar 2013, 11:26
Forum: Balanced Annihilation
Topic: Factory and destination point
Replies: 17
Views: 1871

Re: Factory and destination point

Silentwings wrote:please make a replay where this happens to you (run spring.exe and choose sandbox mode) and upload it, i can't reproduce the bug either.

all right?

Go to advanced search