[Java] Clear factory build queue [solved]

[Java] Clear factory build queue [solved]

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
DeinFreund
Posts: 12
Joined: 14 Aug 2014, 00:12

[Java] Clear factory build queue [solved]

Post by DeinFreund » 16 Dec 2015, 22:24

Is there a simple way to clear the build queue of a factory?
I have tried unit.stop() with no success.

Code: Select all

List<Float> cmds;//contains CommandIDs(=negative unit def id) of units in queue
getUnit().executeCustomCommand(2, cmds, 64, frame + 50)
doesn't seem to work either.
2 indicates CMD_REMOVE, 64 stands for CONTROL_KEY.

Any suggestions?

Also storing command ids as float doesn't seem to make much sense to me. Is there any alternative way of issuing custom commands?
Last edited by DeinFreund on 17 Dec 2015, 00:15, edited 1 time in total.
0 x

8611z
Posts: 169
Joined: 08 Jul 2015, 20:20

Re: [Java] Clear factory build queue

Post by 8611z » 16 Dec 2015, 23:57

commands work same as for humans, so instead of ctrl-modifier try right mouse-button-modifier to reduce queue.
Then spam right-clicks on all buildoptions. (bit stupid, but iirc that worked)
0 x

DeinFreund
Posts: 12
Joined: 14 Aug 2014, 00:12

Re: [Java] Clear factory build queue

Post by DeinFreund » 17 Dec 2015, 00:11

Thanks for the quick response. Although replacing 64 with 16(RMB) doesn't alter the queue :/

Edit: After using 255 (all possible modifier keys mashed at once) it worked :D
0 x

aeonios
Posts: 202
Joined: 03 Feb 2015, 14:27

Re: [Java] Clear factory build queue [solved]

Post by aeonios » 21 Dec 2015, 16:25

for CMD_REMOVE you have to use options.alt in order for it to interpret params as command ids.
0 x

lamer
Posts: 146
Joined: 08 Mar 2014, 23:13

Re: [Java] Clear factory build queue [solved]

Post by lamer » 29 Dec 2015, 02:21

From what i see alt and control should be sufficient, e.g. 192 (tested)

Code: Select all

getUnit().executeCustomCommand(2, cmds, 192, frame + 50)
0 x

Post Reply

Return to “AI”

cron