Forged Alliance Forever Forged Alliance Forever Forums 2017-06-25T11:36:05+02:00 /feed.php?f=41&t=14782 2017-06-25T11:36:05+02:00 2017-06-25T11:36:05+02:00 /viewtopic.php?t=14782&p=151290#p151290 <![CDATA[Re: "One Click Wonder" denies Ctrl-Shift for reclaim labels]]>
i tried your fix and it seems to work. Since i don't use the rebuild function of the mod it's ok for me now!

Thanks a lot for your help!

Statistics: Posted by PsychoBoB — 25 Jun 2017, 11:36


]]>
2017-06-24T18:09:06+02:00 2017-06-24T18:09:06+02:00 /viewtopic.php?t=14782&p=151270#p151270 <![CDATA[Re: "One Click Wonder" denies Ctrl-Shift for reclaim labels]]>
R_Charger wrote:
But without the call to import('/lua/ui/game/commandmode.lua'
the Alt-click functionality for rebuilding structures doesn't work...


Yeah, sorry, the import line shouldn't actually be removed.

(I accidentally removed that line when posting those before/after code snippets, when I removed some logging instrumentation, but I've edited the post now to put the line back in.)

All that you need to do, for the fix, is move the call to oldOnSync() from the end to the start of the hooking OnSync() function definition.

That fixes the issue with reclaim labels not being shown, for me, but I'm a bit concerned if there could be any other side effects of the logged error, and it might be a good idea to look into that further..

Statistics: Posted by crispweed — 24 Jun 2017, 18:09


]]>
2017-06-24T16:45:02+02:00 2017-06-24T16:45:02+02:00 /viewtopic.php?t=14782&p=151267#p151267 <![CDATA[Re: "One Click Wonder" denies Ctrl-Shift for reclaim labels]]> the Alt-click functionality for rebuilding structures doesn't work...

Statistics: Posted by R_Charger — 24 Jun 2017, 16:45


]]>
2017-06-24T18:03:57+02:00 2017-06-24T09:37:07+02:00 /viewtopic.php?t=14782&p=151261#p151261 <![CDATA[Re: "One Click Wonder" denies Ctrl-Shift for reclaim labels]]>
Before the fix:
Code:
   local oldOnSync = OnSync
   function OnSync()
      local CM = import('/lua/ui/game/commandmode.lua')
      for id, v in Sync.ReleaseIds do
      
      --   SPEW('BOOM ' .. id)
         
         local p = false
         
         for x, row in CM.GetAliveStructs() or {} do
            for y, col in row or {} do
               if col[id] then
                  --   f*** yeah; hash functions!
                  local h = GetPositionHash(math.floor(col[id].pos[1]), math.floor(col[id].pos[3]))
                  
                  CM.structs.dead[h] = col[id].bp
                  
                  col[id] = nil
                  
                  p = true
                  
                  break
               end
            end
            
            if p then break end
         end         
      end
      oldOnSync()
   end


After the fix:

Code:
   local oldOnSync = OnSync
   function OnSync()
      oldOnSync()
      local CM = import('/lua/ui/game/commandmode.lua')
      for id, v in Sync.ReleaseIds do
      
      --   SPEW('BOOM ' .. id)
         
         local p = false
         
         for x, row in CM.GetAliveStructs() or {} do
            for y, col in row or {} do
               if col[id] then
                  --   f*** yeah; hash functions!
                  local h = GetPositionHash(math.floor(col[id].pos[1]), math.floor(col[id].pos[3]))
                  
                  CM.structs.dead[h] = col[id].bp
                  
                  col[id] = nil
                  
                  p = true
                  
                  break
               end
            end
            
            if p then break end
         end         
      end
   end


The problem is that the first call to import('/lua/ui/game/commandmode.lua') crashes out with an error.

Here is some text copied from a log, that shows this:

Code:
INFO: One Click Wonder OnSync() entry count = 1
INFO: Hooked /lua/ui/game/commandmode.lua with /mods/ui-party/hook/lua/ui/game/commandmode.lua
INFO: Hooked /lua/ui/game/commandmode.lua with /mods/reminder/hook/lua/ui/game/commandmode.lua
INFO: Hooked /lua/ui/game/commandmode.lua with /mods/notify/hook/lua/ui/game/commandmode.lua
INFO: Hooked /lua/ui/game/commandmode.lua with /mods/logstartcommandmode/hook/lua/ui/game/commandmode.lua
INFO: Hooked /lua/ui/game/commandmode.lua with /mods/oneclickwonder/hook/lua/ui/game/commandmode.lua
INFO: Hooked /lua/ui/game/construction.lua with /mods/ui-party/hook/lua/ui/game/construction.lua
INFO: Hooked /lua/ui/game/construction.lua with /mods/notify/hook/lua/ui/game/construction.lua
INFO: Hooked /lua/ui/game/construction.lua with /mods/fixbuildmodetemplatesbug/hook/lua/ui/game/construction.lua
INFO: Hooked /lua/ui/game/buildmode.lua with /mods/replacebuildmode/hook/lua/ui/game/buildmode.lua
INFO: Hooked /lua/ui/game/buildmode.lua with /mods/makebuildmodemorevisible/hook/lua/ui/game/buildmode.lua
INFO: Hooked /lua/ui/game/tabs.lua with /mods/ui-party/hook/lua/ui/game/tabs.lua
INFO: Hooked /lua/ui/game/selection.lua with /schook/lua/ui/game/selection.lua
WARNING: ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(83): Attempt to set attribute 'HandleEvent' on nil
WARNING: stack traceback:
WARNING:         [C]: in function `error'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\config.lua(12): in function <...alliance\gamedata\mohodata.scd\lua\system\config.lua:11>
WARNING:         ...orever\gamedata\lua.nx2\lua\ui\game\construction.lua(83): in main chunk
WARNING:         [C]: in function `doscript'
WARNING:         [C]: in function `pcall'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\import.lua(48): in function `import'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\import.lua(37): in function `import'
WARNING:         ...forever\gamedata\lua.nx2\lua\ui\game\commandmode.lua(10): in main chunk
WARNING:         [C]: in function `doscript'
WARNING:         [C]: in function `pcall'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\import.lua(48): in function `import'
WARNING:         ...gramdata\faforever\gamedata\lua.nx2\lua\usersync.lua(441): in function `OnSync'
WARNING:         [string "OnSync()"](1): in main chunk
WARNING: ...alliance\gamedata\mohodata.scd\lua\system\import.lua(37): Error importing '/lua/ui/game/construction.lua'
WARNING: stack traceback:
WARNING:         [C]: in function `error'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\import.lua(52): in function `import'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\import.lua(37): in function `import'
WARNING:         ...forever\gamedata\lua.nx2\lua\ui\game\commandmode.lua(10): in main chunk
WARNING:         [C]: in function `doscript'
WARNING:         [C]: in function `pcall'
WARNING:         ...alliance\gamedata\mohodata.scd\lua\system\import.lua(48): in function `import'
WARNING:         ...gramdata\faforever\gamedata\lua.nx2\lua\usersync.lua(441): in function `OnSync'
WARNING:         [string "OnSync()"](1): in main chunk
WARNING: Error running lua command: ...gramdata\faforever\gamedata\lua.nx2\lua\usersync.lua(441): Error importing '/lua/ui/game/commandmode.lua'
         stack traceback:
            [C]: in function `error'
            ...alliance\gamedata\mohodata.scd\lua\system\import.lua(52): in function `import'
            ...gramdata\faforever\gamedata\lua.nx2\lua\usersync.lua(441): in function `OnSync'
            [string "OnSync()"](1): in main chunk


The "One Click Wonder OnSync() entry count" bit is some logging instrumentation I added to the code.
There was also some logging just after the import('/lua/ui/game/commandmode.lua') call, which was never reached.

So seems like it is probably not the fault of the author of OneClickWonder.

With the call to oldOnSync() at the end, other stuff depending on OnSync() misses the first call, and don't set things up properly.
But, with the call to oldOnSync() at the start, the other stuff depending on OnSync() gets run and everything limps on from there.

Note sure what is causing the actual error shown in the log..

(edit: fixed missing import in the before/after code snippets)

Statistics: Posted by crispweed — 24 Jun 2017, 09:37


]]>
2017-06-23T20:16:13+02:00 2017-06-23T20:16:13+02:00 /viewtopic.php?t=14782&p=151250#p151250 <![CDATA[Re: "One Click Wonder" denies Ctrl-Shift for reclaim labels]]>
Edit: had a look at the lua and it looks like a problem with UserSync.lua as the hooking file seems to be interfering with the updating of reclaim. I'm only just learning lua so it might take me some time to fix....others might be able to assist more quickly (or the mod author could fix it!).

Statistics: Posted by R_Charger — 23 Jun 2017, 20:16


]]>
2017-06-21T22:12:56+02:00 2017-06-21T22:12:56+02:00 /viewtopic.php?t=14782&p=151132#p151132 <![CDATA["One Click Wonder" denies Ctrl-Shift for reclaim labels]]>
when the Mod "One Click Wonder (T2/T3 Mex Support) V5" is activated then Ctrl-Shift doesn't show the reclaim labels any more.
I deactivated all other mods (with and without "Common Mod Tools") and it's only when i activate One Click Wonder.
Then i tried to assign the reclaim label function to another hotkey but with no effect.

Can anybody take a look at this? Or just confirm my problem?

Thx in advance!

BoB

Statistics: Posted by PsychoBoB — 21 Jun 2017, 22:12


]]>