[REL] Floating Framework v1.2.1 [58197]

Discussion in 'Released Mods' started by Raevn, December 9, 2013.

  1. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Yeah I just realized that. Thanks. :oops:
  2. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Well I'm making good progress. I think all the bugs are worked out of the code but right now I'm trying to set up an easy for mods to get code in and out of live game from the panel. It looks like next Sunday is the most likely release date but we'll see what happens.
    Raevn and DeathByDenim like this.
  3. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Well it looks like I'm going to need a little more help. I tried to setup a system where a mod in LiveGame_FloatZone could send a function to run in live_game like this:
    Code:
    var toLiveGame = { funct: function () { console.log("test"); } };
    RunLiveGame(toLiveGame);
    In my LiveGame_FloatZone panel I have this function:
    Code:
    function RunLiveGame(Code) {
        api.Panel.message(api.Panel.parentId, Code);
    }
    and as part of the setup it runs this in live_game:
    Code:
    handlers.LiveGame = function(Code) {
        Code.funct();
        console.log("Message received from LiveGame_FloatZone");
    };
    I have a similar system for live_game to run code in LiveGame_FloatZone. The idea is that a mod could use this to send data back and forth which could be used to create sort of cross-panel KO variables or do any number of other tasks.

    My problem is that whenever I try adding RunLiveGame(toLiveGame); to a mod it causes the LiveGame_FloatZone panel to disappear from the game and causes all sorts of UI glitches. Worst of all "test" never appears in live_game's log. Any suggestions? I don't know if the other half of the system (the live_game to LiveGame_FloatZone part) works because I need this working to test it.
  4. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    BTW, the current WIP code for this is now on GitHub here: https://github.com/pamods/LavaSnake-s-Mods

    I'm using the WIP version of Commander HUD as the testing mod for this and you can see the glitch by uncommenting line 46 of rCommanderHP/ui/mods/rCommanderHP/rCommanderHP.js. Everything else works fine when the line is commented.
  5. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    Haven't looked into why it's causing such a severe error, but I believe messages are sent via JSON, and functions aren't part of JSON; at best you're sending a string of the function's code, and then trying to call that string. If you really want to do this, you may be able to eval() the function string but keep in mind you won't be able to get any closured variables in the function.

    First things to try: try printing what you get to see if it's even coming through in a usable form. Perhaps before that, just do .toString() on a function in the sending panel to see if functions even stringify usefully, and then JSON.stringify(Code) to see what it's going to send.

    Yes, this all complicated and difficult. Here be dragons.
  6. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    ok, thanks. That helps a lot in the me-understanding-what-this-is department which should help in the good-old-debugging department. :D I'll run some tests and possibly redesign the system to make it work better with JSON. Anyway, that really helps!
  7. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Well that helped. Now it doesn't glitch but no payloads seem to get through. Here's my updated code:

    in LiveGame_FloatZone:
    Code:
    function toLiveGame(payload) {
         api.Panel.message(api.Panel.parentId, "floatmessage", payload);
         console.log("Sent payload");
    }
    
    var handlers = {};
    handlers.floatmessage = function(payload) {
         console.log("Payload received from live_game:");
         console.log(payload);
    };
    in live_game:
    Code:
    handlers.floatmessage = function(payload) {
         console.log("Payload received from LiveGame_FloatZone:");
         console.log(payload);
         SendBack(payload);
    };
    
    function SendBack(payload) {
         api.panels.LiveGame_FloatZone.message("floatmessage", payload);
         console.log("and sent back.");
    }
    But when
    Code:
    toLiveGame("testing payload");
    is run in LiveGame_FloatZone nothing gets logged in live_game.

    Any ideas? I've compared my code to MC and as far as I can tell it matches. I've also checked that my handlers aren't getting overwritten. (and thanks for all your help @wondible!)
  8. wondible

    wondible Post Master General

    Messages:
    3,315
    Likes Received:
    2,089
    I'd expect this to be more of a problem going the other way, but I notice in github that you aren't calling registerWithCoherent.

    The stock panels are running code in $(document).ready, whereas you are in a script tag.

    I'd stick pretty close to the patterns you see in the uber panels until you get things working. Then you can try experiments and git-reset back to the last working version if it doesn't turn out.
  9. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    That's a good point, thanks! I'll play around with some of that and see what's missing.

    @raevn
    If you don't mind I'd like to "assume ownership" of this mod like I did with Commander HP. That should make it easier for both of us since this update has a lot of API changes and that way I'll be able to easily manage code changes and future updates. My GitHub repo will still be open in case anyone wants to contribute. If that ok with you I'll make a new thread once I've finished this update and you can link to it from the OP of this thread.
  10. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    I am 100% ok with this. It's a useful mod, but I just don't have the time to maintain or update it.

    Thanks heaps! :)
  11. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Sweet, thanks! I guess I'm officially a mod hijacker now. :D (The thanks really goes to @wondible though. I never would've gotten this far without his help.)
  12. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
    Well it turns out it was a combination of that and some issues with how I added the handler in live_game. So now I have a functional way of sending messages across panels. Thanks for helping me with that!

    Now I just need to turn this into a usable method of getting data....
    proeleert likes this.
  13. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
  14. LavaSnake

    LavaSnake Post Master General

    Messages:
    1,620
    Likes Received:
    691
  15. elodea

    elodea Post Master General

    Messages:
    1,694
    Likes Received:
    3,040
    Trying to install floating framework on pamm by itself isn't working for me. It just keeps trying to download it forever.

    All mods with floating framework as a dependancy are refusing to install/update as a result

    *should add that it's only floating framework as far as i can tell. All other mods are installing successfully
  16. mishtakashi

    mishtakashi Active Member

    Messages:
    369
    Likes Received:
    217
    Cola Colin managed to updated by completely uninstalling frameworks mod and reinstalling it. I didn't have it installed prior to trying to update hotbuild so I can't try that but you possibly could?
  17. elodea

    elodea Post Master General

    Messages:
    1,694
    Likes Received:
    3,040
    Didn't work! :(
  18. Kryoclasm

    Kryoclasm New Member

    Messages:
    29
    Likes Received:
    14
    Same problem, won't download, or install.
  19. coolmanyou1

    coolmanyou1 New Member

    Messages:
    2
    Likes Received:
    0
  20. Raevn

    Raevn Moderator Alumni

    Messages:
    4,226
    Likes Received:
    4,324
    Last edited: November 15, 2014
    Kryoclasm likes this.

Share This Page