Page 1 of 2

build que?

Posted: 14 Jan 2012, 05:24
by smoth
How do I get at the current build que, find out what is currently being built, what is the que count etc?

Re: build que?

Posted: 14 Jan 2012, 09:21
by det
¿que?

Re: build que?

Posted: 14 Jan 2012, 09:54
by knorke
manger à la fortune du pot:
Spring.GetUnitIsBuilding and http://springrts.com/wiki/Lua_SyncedRead#CommandQueues

Re: build que?

Posted: 14 Jan 2012, 10:59
by Jools
det wrote:¿que?
Actually you can't write ¿que?, it must be ¿qué?.

que = conjuction = "that" (he said that he would come)
qué = interrogative pronoun = "what?" (what did he say)

Re: build que?

Posted: 17 Jan 2012, 04:16
by Prominence
Jools wrote:
det wrote:¿que?
Actually you can't write ¿que?, it must be ¿qué?.

que = conjuction = "that" (he said that he would come)
qué = interrogative pronoun = "what?" (what did he say)
You forgot to include abbreviation for Quebec.

Re: build que?

Posted: 17 Jan 2012, 09:15
by Google_Frog
Factory build queues are extremely broken. Check Integral Menu for examples of buildqueues and haxy workaround required to read and edit them.

Unit build queues are a bit less broken but still suck because CMD.SET_WANTED_MAX_SPEED is a really really annoying implementation of it's feature.

Re: build que?

Posted: 17 Jan 2012, 09:28
by jK
Google_Frog wrote:Factory build queues are extremely broken. Check Integral Menu for examples of buildqueues and haxy workaround required to read and edit them.
bullshit

Re: build que?

Posted: 17 Jan 2012, 11:03
by Forboding Angel
det wrote:¿que?
queue even :-)

Re: build que?

Posted: 17 Jan 2012, 16:47
by smoth
jK wrote:
Google_Frog wrote:Factory build queues are extremely broken. Check Integral Menu for examples of buildqueues and haxy workaround required to read and edit them.
bullshit
Care to explain jk? Not disagreeing, just want to understand what google is talking about and why it is wrong

Re: build que?

Posted: 17 Jan 2012, 17:28
by jK
It's not my job to further extend my statement.
It was googlefrog who made a clumsy statement w/o any arguments.

I know the functions work fine period

Re: build que?

Posted: 17 Jan 2012, 19:31
by smoth
Well google? What do you mean

Re: build que?

Posted: 17 Jan 2012, 20:39
by FLOZi
jK wrote:It's not my job to further extend my statement.
It was googlefrog who made a clumsy statement w/o any arguments.

I know the functions work fine period

The functions may work as intended, I think google was implying that the architect is at fault, not the bricklayer.

Re: build que?

Posted: 17 Jan 2012, 21:08
by smoth
Ok, so then how is this question:

Google, what is the expected behavior in your eyes and what happens? What is undesired, what is desired?

Re: build que?

Posted: 18 Jan 2012, 08:51
by Google_Frog
I don't recall many specifics as I worked with them 15 months ago. According to these comments if you remove units from a queue they are left behind with ID 0. There was a bit of unexpected stuff like that so just be wary of them.

Re: build que?

Posted: 22 Jan 2012, 20:09
by smoth
get build queue

Code: Select all

					local buildQueue = spGetUnitCommands(unitID)
					
					if buildQueue ~= nil then
						recursiveTableReader(buildQueue, "")
					end
Traverse

Code: Select all

	local function recursiveTableReader(currTable, dashes)
		dashes = dashes .. " - "
		if type(currTable) == 'table' then
			for k,v in pairs(currTable) do
				if (v ~= nil) then
					Spring.Echo(dashes .. "table :" .. k)
					recursiveTableReader(v, dashes)

				end
			end
		else
			if (k ~= nil and v ~= nil) then
				Spring.Echo(dashes .. " " .. k .. " " .. v)
			else
				if (v ~= nil) then
					Spring.Echo(dashes .. " value: " .. v)
				else
					if (k ~= nil) then
						Spring.Echo(dashes .. " key: " .. k)
					else
						Spring.Echo(dashes .. " nil ")
					end
				end
			end
		end
	end
result
- table :1
- - table :id
- - - nil
- - table :tag
- - - nil
- - table :options
- - - table :coded
- - - - nil
- - - table :shift
- - - - nil
- - table :params
- - - table :1
- - - - nil
- - - table :2
- - - - nil
- - - table :3
- - - - nil
- - - table :4
- - - - nil
What am I doing wrong here?

Re: build que?

Posted: 22 Jan 2012, 21:30
by jK
smoth wrote:What am I doing wrong here?
Your recursiveTableReader() is bugged:

Code: Select all

local function recursiveTableReader(currTable, dashes)
	dashes = dashes .. " - "
	if type(currTable) == 'table' then
		...
		recursiveTableReader(v, dashes)
		...
	else
		if (k ~= nil and v ~= nil) then <<<<<<<<<<<<<<<<<<<<
			Spring.Echo(dashes .. " " .. k .. " " .. v)
		else
			...
		end
	end
k & v aren't defined there. only currTable is and that is not a table, instead it is of a different type.

Re: build que?

Posted: 23 Jan 2012, 00:41
by smoth
I am a retard..
thanks jk

Re: build que?

Posted: 23 Jan 2012, 02:02
by smoth
So the fixed code now

get orders

Code: Select all

				
					local buildQueue = spGetUnitCommands(unitID)
					
					if buildQueue ~= nil then
						for k,v in pairs(buildQueue) do
							Spring.Echo("============" .. " table: " .. k .. " =============")
							recursiveTableReader(v, "  ")
						end
					end
get parameters

Code: Select all

	local function recursiveTableReader(currTable, dashes)
		dashes = dashes .. "   "
		if type(currTable) == 'table' then
			for k,v in pairs(currTable) do
				if (v ~= nil) then
					Spring.Echo(dashes .. "[" .. k .. "]")
					recursiveTableReader(v, dashes)
				end
			end
		else
			if (currTable ~= nil) then
				Spring.Echo(dashes .. tostring(currTable) )
			end
		end
	end

Code: Select all

 ============ table: 1 =============
      [id]
         -33
      [tag]
         1
      [options]
         [coded]
            32
         [shift]
            true
      [params]
         [1]
            8880
         [2]
            85.338134765625
         [3]
            2224
         [4]
            0
 ============ table: 2 =============
      [id]
         70
      [tag]
         2
      [options]
         [coded]
            32
         [shift]
            true
      [params]
         [1]
            0
 ============ table: 3 =============
      [id]
         -32
      [tag]
         3
      [options]
         [coded]
            32
         [shift]
            true
      [params]
         [1]
            8728
         [2]
            49.150390625
         [3]
            2600
         [4]
            0
 ============ table: 4 =============
      [id]
         70
      [tag]
         4
      [options]
         [coded]
            32
         [shift]
            true
      [params]
         [1]
            0
 ============ table: 5 =============
      [id]
         -31
      [tag]
         5
      [options]
         [coded]
            32
         [shift]
            true
      [params]
         [1]
            8832
         [2]
            32.40234375
         [3]
            3024
         [4]
            0
 ============ table: 6 =============
      [id]
         70
      [tag]
         6
      [options]
         [coded]
            32
         [shift]
            true
      [params]
         [1]
            0
 ================================
ok, now, to make sense of this.

Re: build que?

Posted: 28 Jan 2012, 02:57
by smoth

Code: Select all

============ table: 1 =============
     [id]
        -33
     [tag]
        1
     [options]
        [coded]
           32
        [shift]
           true
     [params]
        [1]
           1712
        [2]
           132.29370117188
        [3]
           1312
        [4]
           0
============ table: 2 =============
     [id]
        70
     [tag]
        2
     [options]
        [coded]
           32
        [shift]
           true
     [params]
        [1]
           0
============ table: 3 =============
     [id]
        -33
     [tag]
        3
     [options]
        [coded]
           32
        [shift]
           true
     [params]
        [1]
           1904
        [2]
           132.29370117188
        [3]
           1312
        [4]
           0
============ table: 4 =============
     [id]
        70
     [tag]
        4
     [options]
        [coded]
           32
        [shift]
           true
     [params]
        [1]
           0
============ table: 5 =============
     [id]
        -25
     [tag]
        5
     [options]
        [coded]
           32
        [shift]
           true
     [params]
        [1]
           1872
        [2]
           132.29370117188
        [3]
           1568
        [4]
           0
============ table: 6 =============
     [id]
        70
     [tag]
        6
     [options]
        [coded]
           32
        [shift]
           true
     [params]
        [1]
           0
================================
so what does any of this mean?

Re: build que?

Posted: 28 Jan 2012, 03:42
by knorke
smoth wrote:so what does any of this mean?
[1]
1712
this might be x!