LEDZ widgets: nukeTracker.lua
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: LEDZ widgets: nukeTracker.lua
Inconsistent, and non-chili gui stuff looks awful comparatively (ZK's fugly ass teal chili skin is not to be used as an example here, that thing is a crime against nature).
Re: LEDZ widgets: nukeTracker.lua
well chili people can make a chili version.
Re: LEDZ widgets: nukeTracker.lua
I've had a look at the Chili GUI and I don't see why a widget like that makes a problem. I'm going to make it look a bit more finished and it will be a smaller screen element (size is based on font size, made bigger only for show in videos) so I don't see the fuss.
Re: LEDZ widgets: nukeTracker.lua
it is just visually conflicting. Don't worry about it. Like i said if someone wants a chilli version they can make it.
Re: LEDZ widgets: nukeTracker.lua
I cannot get the widget to find a nuke projectile consistently after it launches.
At the moment I'm using stockpile change (reduces by one when nuke fires) as a call-in and then looking for projectiles on the map that correspond to a nuke (from weaponDefID) however this doesn't always work.
I believe there some frames passing between the stockpile going down and the sim creating the projectile.
Any help with this would be vastly appreciated and then I can release this cool/useful nukeTracker widget.
At the moment I'm using stockpile change (reduces by one when nuke fires) as a call-in and then looking for projectiles on the map that correspond to a nuke (from weaponDefID) however this doesn't always work.
I believe there some frames passing between the stockpile going down and the sim creating the projectile.
Any help with this would be vastly appreciated and then I can release this cool/useful nukeTracker widget.
Re: LEDZ widgets: nukeTracker.lua
XTA has the ota style minimap X: http://code.google.com/p/xta-springrts/ ... nimapx.lua
Would it be more efficient to call that getprojectiles_in_rect instead of watching weapons?
Would it be more efficient to call that getprojectiles_in_rect instead of watching weapons?
Re: LEDZ widgets: nukeTracker.lua
That is precisely what it does currently but it seems to call it before the projectile is created. Bit stuck with this one.
Re: LEDZ widgets: nukeTracker.lua
Okay guys, I've reopened my dusty chest of lua scripts.
This widget has stopped working but was at last use practically finished.
There is a new issue however:
Spring.GetUnitCommands is returning an empty table even after being initiated by a widget:UnitCommand callin for a nuke silo attack command. Any ideas why this may be?
I've had a look through the wiki and changelog but I cannot find any clues as yet.
This widget has stopped working but was at last use practically finished.
There is a new issue however:
Spring.GetUnitCommands is returning an empty table even after being initiated by a widget:UnitCommand callin for a nuke silo attack command. Any ideas why this may be?
I've had a look through the wiki and changelog but I cannot find any clues as yet.
Re: LEDZ widgets: nukeTracker.lua
Is http://springrts.com/phpbb/viewtopic.ph ... =0#p529535 the newest version?
The script is full of "magic numbers" like that.
If the game (BA?) adds or removes a unit then the unitDefID numbers might change and the script gets confused.
That might have caused it to stop working.
See http://springrts.com/wiki/Lua_UnitDefs# ... 2Fsnippets how to get unitDefID from a unitname.
Similiar for the commandIDs, they are less likely to randomly change but still better to use the constants. (even if it is just for easier reading)
http://springrts.com/wiki/Lua_CMDs#Commands
About the "new issue" idk.
Do the units/weapon use canManualFire/commandfire? Perhaps with those tags they automatically drop the attack-order after one shot. But that is just guess, would have to test. Maybe give a longer commandqueue and see if it is still empty?
Or if you post your code then maybe can look for error.
Code: Select all
function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams)
if unitDefID == 141 or unitDefID == 312 or unitDefID == 333 or unitDefID == 55 or unitDefID == 182 or unitDefID == 2 then
if cmdID == 20 then
If the game (BA?) adds or removes a unit then the unitDefID numbers might change and the script gets confused.
That might have caused it to stop working.
See http://springrts.com/wiki/Lua_UnitDefs# ... 2Fsnippets how to get unitDefID from a unitname.
Similiar for the commandIDs, they are less likely to randomly change but still better to use the constants. (even if it is just for easier reading)
http://springrts.com/wiki/Lua_CMDs#Commands
About the "new issue" idk.
Do the units/weapon use canManualFire/commandfire? Perhaps with those tags they automatically drop the attack-order after one shot. But that is just guess, would have to test. Maybe give a longer commandqueue and see if it is still empty?
Or if you post your code then maybe can look for error.
Re: LEDZ widgets: nukeTracker.lua
I noticed that problem already. They did indeed change recently so that was broken. I'm now using the unit names (corsilo) instead. And I've add CMD.ATTACK instead too. Thanks.
This is the part of the code that I'm having problems with; the newest command order is not within the tables. For example, if (whilst holding shift) I select an armsilo and perform the following orders:
Wait, Attack (somewhere on map), Attack, Attack
Each time, only the commands up to and not including the latest one are in the table.
This is the part of the code that I'm having problems with; the newest command order is not within the tables. For example, if (whilst holding shift) I select an armsilo and perform the following orders:
Wait, Attack (somewhere on map), Attack, Attack
Each time, only the commands up to and not including the latest one are in the table.
Code: Select all
function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams)
uDef = UnitDefs[unitDefID]
unitName = uDef.name
commands = Spring.GetCommandQueue(unitID,10)
Spring.Echo("Start 1")
for x = 0, 3 do
command = commands[x]
Spring.Echo("x",x)
Spring.Echo("command",command)
if command ~= nil then
for j, expanded in pairs(command) do
Spring.Echo("j",j)
Spring.Echo("expanded",expanded)
end
end
end
end
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: LEDZ widgets: nukeTracker.lua
I guess its just that the table starts indexed at 1 (and not 0) ?
Also, if you just want to see an array table in numerical order of its keys, started at 1, ipairs() is better.
Also, if you just want to see an array table in numerical order of its keys, started at 1, ipairs() is better.
Re: LEDZ widgets: nukeTracker.lua
Oh sorry, the 0 was something I tried in case I was missing something, and I was using ipairs at first. This was an attempt to investigate further.
Re: LEDZ widgets: nukeTracker.lua
Does not really answer the question but might be worth noting...
I used BA 7.91 with /luaurules disable and all widgets disabled, except the test widget.
This widget is supposed to print a units commands as text, example output:
MOVE-SET_WANTED_MAX_SPEED-PATROL-PATROL-SET_WANTED_MAX_SPEED-FIGHT-
The set_wanted_max_speed thing is bit annoying but rest looks okay.
(it will of course fail with build-orders where the ID is negative and in some other cases, so just test with "normal" commands like move, patrol, fight etc)
In spring 98.0:
The strange thing is that if a unit is given attack-order on the ground or on enemy unit then it prints "LOOPBACKATTACK"
I would have expected "ATTACK"
Tested with ARM commander, armsilo and armpw.
In spring 94.1:
Here it prints "ATTACK", like expected.
Should LOOPBACKATTACK not be the immelmann-style attack move of aircraft?
Did not look further, so not sure what to make of that.
/edit
https://github.com/spring/spring/blob/d ... MD.cpp#L73
LuaInsertDualMapPair(L, "LOOPBACKATTACK", CMD_ATTACK); // backward compability (TODO: find a way to print a warning when used!)
Similiar with DGUN/MANUALFIRE: A Dgun-command given by players causes "DGUN" command not, the more political correct MANUALFIRE?
I used BA 7.91 with /luaurules disable and all widgets disabled, except the test widget.
Code: Select all
function widget:UnitCommand(unitID, unitDefID, unitTeam, cmdID, cmdOpts, cmdParams)
uDef = UnitDefs[unitDefID]
unitName = uDef.name
commands = Spring.GetCommandQueue(unitID,10)
Spring.Echo("-----")
local s = ""
for _,command in pairs (commands) do
if command ~= nil then
s=s..CMD[command.id].."-"
end
end
Spring.Echo (s)
end
MOVE-SET_WANTED_MAX_SPEED-PATROL-PATROL-SET_WANTED_MAX_SPEED-FIGHT-
The set_wanted_max_speed thing is bit annoying but rest looks okay.
(it will of course fail with build-orders where the ID is negative and in some other cases, so just test with "normal" commands like move, patrol, fight etc)
In spring 98.0:
The strange thing is that if a unit is given attack-order on the ground or on enemy unit then it prints "LOOPBACKATTACK"
I would have expected "ATTACK"
Tested with ARM commander, armsilo and armpw.
In spring 94.1:
Here it prints "ATTACK", like expected.
Should LOOPBACKATTACK not be the immelmann-style attack move of aircraft?
Did not look further, so not sure what to make of that.
/edit
https://github.com/spring/spring/blob/d ... MD.cpp#L73
LuaInsertDualMapPair(L, "LOOPBACKATTACK", CMD_ATTACK); // backward compability (TODO: find a way to print a warning when used!)
Similiar with DGUN/MANUALFIRE: A Dgun-command given by players causes "DGUN" command not, the more political correct MANUALFIRE?